
π Documentation & Examples
Everything you need to integrate with GNews
π Quick Start Examples
// GNews API Example
const response = await fetch('https://gnews.io/', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);The news search API from Gnews.io provides an efficient way to access the latest articles from various reliable sources. With the ability to filter by topics, sources, and even regions, developers can integrate up-to-date news content into their applications seamlessly. This API not only offers an extensive database of news articles but also employs advanced search functionalities that make it easier for users to find specific information. Whether you are developing a news aggregator app, a content curation tool, or any application that requires real-time news updates, the Gnews.io API is an invaluable resource for sourcing information.
Leveraging the Gnews.io API can significantly enhance your application's value by providing users with timely and relevant news content. Here are some benefits of utilizing this API:
- Access to a wide range of news articles from numerous sources
- Customizable search filters to refine results by keyword or category
- Real-time updates to ensure users receive the latest news
- User-friendly integration and comprehensive documentation
- Global coverage of news articles, including localization options
Hereβs a simple JavaScript code example demonstrating how to call the Gnews.io API:
const fetch = require('node-fetch');
const API_KEY = 'YOUR_API_KEY';
const query = 'latest news';
const url = `https://gnews.io/api/v4/search?q=${encodeURIComponent(query)}&token=${API_KEY}`;
fetch(url)
.then(response => response.json())
.then(data => {
console.log('News Articles:', data.articles);
})
.catch(error => {
console.error('Error fetching news:', error);
});
How to Get a GNews API Key
- Sign up for free at gnews.io/register β no credit card required.
- Verify your email address.
- Open your dashboard to find your API key.
The free plan allows 100 requests per day (about 1 request/second) and returns up to 10 articles per request. The free tier returns article metadata with truncated content, not full article bodies; larger quotas and full content require a paid plan. Your daily counter resets at 00:00 UTC.
Authenticate by adding your key as the apikey query parameter (older examples use token, which still works):
const apiKey = 'YOUR_API_KEY';
const url = `https://gnews.io/api/v4/search?q=technology&lang=en&max=5&apikey=${apiKey}`;
fetch(url).then(res => res.json()).then(data => console.log(data.articles));









