NewsAPI
Search headlines and articles from thousands of news sources worldwide.
What it does
NewsAPI.org indexes headlines and articles from 150,000+ sources worldwide. Three endpoints: /top-headlines (breaking news by country, category or source), /everything (full-text search across all articles), and /sources (the source catalogue).
Base URL
Authentication
Register for an API key and send it as the X-Api-Key header (or ?apiKey=). The free Developer plan is for non-commercial use and testing only.
Code examples
curl -s "https://newsapi.org/v2/top-headlines?country=us&category=technology" \ -H "X-Api-Key: $NEWSAPI_KEY"
import requests
r = requests.get("https://newsapi.org/v2/everything", params={
"q": "renewable energy", "language": "en",
"sortBy": "publishedAt", "pageSize": 5},
headers={"X-Api-Key": KEY}, timeout=10)
for a in r.json()["articles"]:
print(a["publishedAt"][:10], a["source"]["name"], "-", a["title"])Rate limits & quotas
Developer plan: 100 requests/day, results delayed ~24 hours, /everything limited to articles from the last month, max pageSize 100, and no browser (CORS) requests — you must call it server-side. Over the limit: HTTP 429 rateLimited. Paid plans remove the delay and CORS block.
Key response fields
| status | ok or error (with code + message) |
| totalResults | Total matches (you can only page through the first 100 on free) |
| articles[].title / description / content | content is truncated to ~200 chars |
| articles[].source.name / url / publishedAt | Attribution and link |
| articles[].urlToImage | Lead image URL (may be null) |
Common errors
| 401 apiKeyInvalid / apiKeyMissing | Bad or absent key. |
| 426 | You called it from a browser on the free plan — move the call to your backend. |
| 429 rateLimited | Daily 100-request cap reached. |
| 400 parameterInvalid | e.g. /everything with no q, sources or domain filter. |
When to use it (and alternatives)
Fine for prototypes and internal dashboards where a 24-hour delay and 100 calls/day are acceptable. For a free tier you can use in the browser, try Currents or newsdata.io; for a specific publisher use The Guardian or NYT.
FAQ
Why can't I call NewsAPI from my React app?
The free plan blocks browser-origin requests (HTTP 426). Proxy through your own server, which also keeps your key secret. Paid plans allow CORS.
Why is the news a day old?
The Developer plan intentionally delays results by about 24 hours. Real-time results require a paid plan.
Can I use it on a public commercial site?
Not on the free plan — it is licensed for development and non-commercial personal projects. A paid plan is required for commercial use.
New to APIs?
Short guides for working with this API — and any other.