Skip to main content

Top Headlines Endpoint

This endpoint allows you to search for current trending articles, the articles that are selected to be returned by this endpoint are based on the Google News ranking. There are 9 categories available, the default category is "general".

HTTP Request

GET https://gnews.io/api/v4/top-headlines?category=general&apikey=API_KEY

Query Parameters

Parameter NameDefault ValueDescription
categorygeneralThis parameter allows you to change the category for the request. The available categories are : general, world, nation, business, technology, entertainment, sports, science and health.
langAnyThis parameter allows you to specify the language of the news articles returned by the API. You have to set as value the 2 letters code of the language you want to filter.
See the list of supported languages.
countryAnyThis parameter allows you to specify the country where the news articles returned by the API were published, the contents of the articles are not necessarily related to the specified country. You have to set as value the 2 letters code of the country you want to filter.
See the list of supported countries.
max10This parameter allows you to specify the number of news articles returned by the API. The minimum value of this parameter is 1 and the maximum value is 100. The value you can set depends on your subscription.
See the pricing for more information.
nullableNoneThis parameter allows you to specify the attributes that you allow to return null values. The attributes that can be set are description, content and image. It is possible to combine several attributes by separating them with a comma.
For example: description,content
fromNoneThis parameter allows you to filter the articles that have a publication date greater than or equal to the specified value. The date must comply with ISO 8601 format.
For example: 2025-07-18T21:32:58.500Z
toNoneThis parameter allows you to filter the articles that have a publication date smaller than or equal to the specified value. The date must comply with ISO 8601 format.
For example: 2025-07-18T21:32:58.500Z
qNoneThis parameter allows you to specify your search keywords to find the news articles you are looking for. The keywords will be used to return the most relevant articles. It is possible to use logical operators with keywords, see the section on query syntax.
page1This parameter allows you to control the pagination of the results returned by the API. The paging behavior is closely related to the value of the max parameter. The first page is page 1, then you have to increment by 1 to go to the next page. Let's say that the value of the max parameter is 10, then the first page will contain the first 10 articles returned by the API (articles 1 to 10), page 2 will return the next 10 articles (articles 11 to 20), etc.
For performance reasons, it is not possible to paginate more than 1000 articles.
expandNoneThis parameter will only work if you have a paid subscription activated on your account.
This parameter allows you to return in addition to other data, the full content of the articles. To get the full content of the articles, the parameter must be set to content, as follows expand=content

Code Examples

// TODO: replace API_KEY with your API key.
apikey = 'API_KEY';
category = 'general';
url = 'https://gnews.io/api/v4/top-headlines?category=' + category + '&lang=en&country=us&max=10&apikey=' + apikey;

fetch(url)
.then(function (response) {
return response.json();
})
.then(function (data) {
articles = data.articles;

for (i = 0; i < articles.length; i++) {
// articles[i].title
console.log("Title: " + articles[i]['title']);
// articles[i].description
console.log("Description: " + articles[i]['description']);
// You can replace {property} below with any of the article properties returned by the API.
// articles[i].{property}
// console.log(articles[i]['{property}']);

// Delete this line to display all the articles returned by the request. Currently only the first article is displayed.
break;
}
});

Alternatively, you can use our official libraries available at gnews.io/libraries.

Supported Languages

NameValue
Arabicar
Chinesezh
Dutchnl
Englishen
Frenchfr
Germande
Greekel
Hindihi
Italianit
Japaneseja
Malayalamml
Marathimr
Norwegianno
Portuguesept
Romanianro
Russianru
Spanishes
Swedishsv
Tamilta
Telugute
Ukrainianuk

Supported Countries

NameValue
Australiaau
Brazilbr
Canadaca
Chinacn
Egypteg
Francefr
Germanyde
Greecegr
Hong Konghk
Indiain
Irelandie
Italyit
Japanjp
Netherlandsnl
Norwayno
Pakistanpk
Perupe
Philippinesph
Portugalpt
Romaniaro
Russian Federationru
Singaporesg
Swedense
Switzerlandch
Taiwantw
Ukraineua
United Kingdomgb
United Statesus