TL;DR
OkSurf offers a free news API that aggregates headlines from around the world and enriches them with sentiment analysis — each article includes a positive, negative, or neutral sentiment score. No API key or registration required. The endpoint at /api/news returns recent articles with title, description, source, and publication date. Particularly useful for building news dashboards or sentiment trend trackers without paying for premium news APIs.
Quick start: https://ok.surf/api/news
No API key needed — just call the endpoint!
How to Use This API
1. Get Latest News Headlines
Simply fetch the news endpoint to get the most recent articles with sentiment data:
https://ok.surf/api/news
2. JavaScript — Build a News Sentiment Dashboard
fetch('https://ok.surf/api/news')
.then(r => r.json())
.then(data => {
const positive = data.filter(a => a.sentiment === 'positive');
const negative = data.filter(a => a.sentiment === 'negative');
console.log('Positive stories:', positive.length);
console.log('Negative stories:', negative.length);
data.forEach(article => {
console.log(article.title, '—', article.source, article.sentiment);
});
});
3. Python — Print Headlines and Scores
import requests
r = requests.get('https://ok.surf/api/news')
articles = r.json()
for a in articles[:10]:
print(f"[{a['sentiment']}] {a['title']}")
print(f" Source: {a['source']} — {a['published_at']}")
https://ok.surf/api/news
Frequently Asked Questions
- How does the sentiment analysis work?
- OkSurf uses an automated NLP pipeline to classify each article as positive, negative, or neutral based on the headline and description text.
- How many articles does the endpoint return?
- The response typically contains 20–50 recent articles. The API acts as a snapshot of current news rather than a historical archive.
- Can I filter by topic or category?
- The default endpoint returns a mixed feed. You would need to filter client-side by keywords in the title or description for topic-specific views.
- How often is the data updated?
- News articles are refreshed every few hours. The timestamps in the response show when each article was published by the original source.
- What news sources are included?
- The feed pulls from international English-language news sources covering politics, technology, business, science, and world events.
- Is rate limiting enforced?
- No documented rate limit. The service is designed for lightweight use in personal and small-scale projects.
API Details
- API URL
https://ok.surf/api/news- Documentation
- https://ok.surf/
- Category
- News
- Authentication
- Not Required
- Geographic Coverage
- Global — English-language international news
- Response Format
- JSON with title, description, source, published_at, sentiment, url
What You Can Build
- Sentiment tracker showing positive vs negative news ratio over time
- Personal morning news briefing app filtered by topics you care about
- Data visualization of global media sentiment across regions
- Alert system for breaking stories matching specific keywords
- Comparison tool for how different sources cover the same story