Get up and running with Byul REST API in 5 minutes
byul_v2
curl -X GET "https://api.byul.ai/api/v2/news?limit=10&minImportance=7" \ -H "X-API-Key: byul_api_key"
{ "items": [ { "_id": "67850d7b0123456789abcdef", "title": "Tesla Stock Surges After Q4 Earnings Beat", "koTitle": "테슬라 4분기 실적 상승으로 주가 급등", "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 }
const getAllNews = async () => { let allNews = []; let cursor = null; let hasMore = true; while (hasMore) { const params = new URLSearchParams({ limit: '50', minImportance: '6' }); 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; };
byul_
export BYUL_API_KEY=byul_api_key