The OkSurf News API provides a simple, free REST API for developers to retrieve the latest Google news in a familiar JSON format
US, World, Business, Technology, Entertainment, Sports, Science, & Health
Developer friendly endpoints for backends and frontends
Use your preferred language's HTTP client to make requests
Test the API right in your browser and view example CURL commands
Hot or iced, coffee can improve the overall API experience
Retrieve the latest news as valid JSON:
/news-section-names
Fetch available Google News section names, such as World, Sports, and Science
/news-feed
Retrieve all available Google News articles, for all available section names
/news-section
Get all available news articles for the specified Google News section name(s)
title | article title |
link | article URL |
og | og:image URL |
source | name of news source |
source_icon | source logo/icon URL |
Use the below Swagger documentation to try the API. Select an endpoint and and press Try it out. An API response and CURL command will be visible after pressing the Execute button.
Use the OkSurf API with your favorite programming language. Here are some simple examples:
curl -X 'GET' \
'https://ok.surf/api/v1/news-feed' \
-H 'accept: application/json'
curl -X 'POST' \
'https://ok.surf/api/v1/news-section' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"sections": ["Business"]}'
fetch('https://ok.surf/api/v1/cors/news-feed').then((res) => {
if (!res.ok) {
throw Error('could not fetch data for that resource');
}
return res.json();
}).then((data) => {
console.log(data);
}).catch((err) => {
console.log(err);
});
from json import load
from pprint import pprint
from urllib.request import Request, urlopen
req = Request('https://ok.surf/api/v1/news-feed')
req.add_header('accept', 'application/json')
req.add_header('Content-Type', 'application/json')
response = load(urlopen(req))
pprint(response)
Use our API to power news-feeds in your applications.
Example news feed driven by the OkSurf API: