APIYard
Back to APIs
NewsAPI KeyFree tier

NewsAPI

Search articles and headlines from 150,000+ news sources and blogs worldwide, filterable by keyword, category, and country.

Base URL

https://newsapi.org/v2
headlinessearchsourcescategoriesglobal

Endpoints

GET/top-headlines

Get breaking news headlines for a country or category.

const response = await fetch("https://newsapi.org/v2/top-headlines?country=us&category=technology&apiKey=YOUR_API_KEY", {
  method: "GET",
  headers: {
  "Content-Type": "application/json",
  "X-API-Key": "YOUR_API_KEY"
  }
});

const data = await response.json();
console.log(data);

Response Preview

{
  "totalResults": 38,
  "articles": [{
    "title": "Tech Giants Report Strong Q1 Earnings",
    "source": { "name": "Reuters" },
    "publishedAt": "2024-05-01T09:00:00Z",
    "url": "https://reuters.com/..."
  }]
}