> ## Documentation Index
> Fetch the complete documentation index at: https://docs.byul.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get up and running with Byul REST API in 5 minutes

## Get Started in 5 Minutes

### Prerequisites

<Info>
  REST API is available on all plans. See [pricing](https://www.byul.ai/api/pricing) for rate limits and features.
</Info>

### Step 1: Get Your API Key

1. Login to [Byul API Dashboard](https://www.byul.ai/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

<Tabs>
  <Tab title="curl">
    ```bash theme={null}
    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"
    ```
  </Tab>

  <Tab title="Node.js">
    ```javascript theme={null}
    const fetch = require('node-fetch');

    const getNews = async () => {
      const response = await fetch('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', {
        headers: {
          'X-API-Key': process.env.BYUL_API_KEY
        }
      });
      
      const data = await response.json();
      console.log('Latest News:', data.items.length, 'articles');
      
      data.items.forEach(article => {
        console.log(`${article.title} - Importance: ${article.importanceScore}/10`);
      });
      
      return data;
    };

    getNews();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests
    import os

    def get_news():
        response = requests.get(
            'https://api.byul.ai/api/v2/news',
            params={
                'limit': 10,
                'minImportance': 7
            },
            headers={
                'X-API-Key': os.getenv('BYUL_API_KEY')
            }
        )
        
        if response.status_code == 200:
            data = response.json()
            print(f'Latest News: {len(data["items"])} articles')
            
            for article in data['items']:
                print(f"{article['title']} - Importance: {article['importanceScore']}/10")
            
            return data
        else:
            print(f'Error: {response.status_code}')
            return None

    get_news()
    ```
  </Tab>
</Tabs>

### Step 3: Parse the Response

```json theme={null}
{
  "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

```javascript theme={null}
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?

<CardGroup cols={2}>
  <Card title="Authentication" href="/rest-api/authentication">
    Learn about API key management and security
  </Card>

  <Card title="Filtering News" href="/rest-api/news/filtering">
    Filter news by importance, symbols, and categories
  </Card>

  <Card title="Data Format" href="/rest-api/news/data-format">
    Understand the complete news article structure
  </Card>

  <Card title="Error Handling" href="/rest-api/error-handling">
    Handle API errors and rate limits properly
  </Card>
</CardGroup>

## Troubleshooting

### Common Issues

**401 Unauthorized**

* Check your API key format (must start with `byul_`)
* Verify your API key at [Dashboard](https://www.byul.ai/api/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](https://www.byul.ai/api/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?

* Read the full [REST API Documentation](/rest-api/overview)
* Join our [Community](https://www.byul.ai/community)
* Contact [Support](https://www.byul.ai/contact)

<Info>
  **Pro Tip**: Use environment variables in production instead of hardcoding API keys:

  ```bash theme={null}
  export BYUL_API_KEY=byul_api_key
  ```
</Info>

## 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.
