Skip to main content

Get Started in 5 Minutes

Prerequisites

REST API is available on all plans. See pricing for rate limits and features.

Step 1: Get Your API Key

  1. Login to Byul API Dashboard
  2. Your API key is automatically generated and displayed
  3. Copy your API key (starts with byul_v2)

Step 2: Make Your First Request

curl -X GET "https://api.byul.ai/api/v2/news?limit=10&minImportance=7&startDate=2024-01-01T00:00:00.000Z&endDate=2024-01-31T23:59:59.999Z" \
  -H "X-API-Key: byul_api_key"

Step 3: Parse the Response

{
  "items": [
    {
      "_id": "67850d7b0123456789abcdef",
      "title": "Tesla Stock Surges After Q4 Earnings Beat",
      "koTitle": "테슬라 4분기 실적 상승으로 주가 급등",
      "content": "Tesla Inc. reported stronger-than-expected Q4 2024 earnings, with revenue beating analyst estimates by 8%. The electric vehicle maker delivered 484,507 vehicles in Q4, up 15% year-over-year, driving shares up 12% in after-hours trading.",
      "koContent": "테슬라가 2024년 4분기 실적에서 애널리스트 예상치를 8% 상회하는 매출을 기록했습니다. 이 전기차 제조업체는 4분기에 484,507대를 인도하며 전년 대비 15% 증가했고, 시간외 거래에서 주가가 12% 상승했습니다.",
      "url": "https://www.byul.ai/news/tesla-earnings-q4-2024",
      "date": "2024-01-15T10:30:00.000Z",
      "importanceScore": 8,
      "category": "earnings",
      "symbols": ["TSLA"],
      "sentiment": "positive"
    }
  ],
  "nextCursor": "67850d7b0123456789abcde0",
  "hasMore": true
}

Step 4: Handle Pagination

const getAllNews = async () => {
  let allNews = [];
  let cursor = null;
  let hasMore = true;
  
  while (hasMore) {
    const params = new URLSearchParams({
      limit: '50',
      minImportance: '6',
      startDate: '2024-01-01T00:00:00.000Z'
    });
    
    if (cursor) {
      params.append('cursor', cursor);
    }
    
    const response = await fetch(`https://api.byul.ai/api/v2/news?${params}`, {
      headers: { 'X-API-Key': process.env.BYUL_API_KEY }
    });
    
    const data = await response.json();
    allNews.push(...data.items);
    
    cursor = data.nextCursor;
    hasMore = data.hasMore;
  }
  
  console.log(`Retrieved ${allNews.length} total articles`);
  return allNews;
};

Congratulations!

You’ve successfully made your first REST API request and retrieved financial news!

What’s Next?

Authentication

Learn about API key management and security

Filtering News

Filter news by importance, symbols, and categories

Data Format

Understand the complete news article structure

Error Handling

Handle API errors and rate limits properly

Troubleshooting

Common Issues

401 Unauthorized
  • Check your API key format (must start with byul_)
  • Verify your API key at Dashboard
  • Ensure the X-API-Key header is set correctly
429 Too Many Requests
  • You’ve exceeded your plan’s rate limit
  • Check rate limit headers in the response
  • Implement exponential backoff retry logic
  • Consider upgrading your plan at Pricing
400 Bad Request
  • Check parameter values (limit: 1-100, minImportance: 1-10)
  • Ensure proper URL encoding for query parameters
  • Validate JSON structure if sending request body

Need Help?

Pro Tip: Use environment variables in production instead of hardcoding API keys:
export BYUL_API_KEY=byul_api_key

Rate Limits by Plan

  • Test (Free): 30 requests/minute
  • Starter ($19/month): 60 requests/minute
  • Pro ($99/month): 120 requests/minute
  • Enterprise: Custom limits
All responses include rate limit headers for monitoring usage.