Skip to main content

Search Endpoint

This endpoint allows you to search for news articles through a combination of keywords.

HTTP Request

GET https://gnews.io/api/v4/search?q=example&apikey=API_KEY

Query Parameters

Parameter NameDefault ValueDescription
qNoneThis parameter is mandatory.
This 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.
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.
intitle,descriptionThis parameter allows you to choose in which attributes the keywords are searched. The attributes that can be set are title, description and content. It is possible to combine several attributes by separating them with a comma.
For example: title,description
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
sortbypublishedAtThis parameter allows you to choose with which type of sorting the articles should be returned. Two values are possible:
publishedAt = sort by publication date, the articles with the most recent publication date are returned first
relevance = sort by best match to keywords, the articles with the best match are returned first
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

Query Syntax

Things to know before you start:

  1. In this section, the word query refers to the value of the q parameter and not to the HTTP request.
  2. The query must be URL-encoded.
  3. It is not possible to use special characters without putting quotes around them.

Example:

Not ValidValid
Hello!"Hello!"
Left - Right"Left - Right"
Question?"Question?"

Phrase Search Operator

This operator allows you to make an exact search. Keywords surrounded by quotation marks are used to search for articles with the exact same keyword sequence. For example the query: "Apple iPhone" will return articles matching at least once this sequence of keywords.

Logical AND Operator

This operator allows you to make sure that several keywords are all used in the article search. By default the space character acts as an AND operator, it is possible to replace the space character by AND to obtain the same result. For example the query: Apple Microsoft is equivalent to Apple AND Microsoft

Logical OR Operator

This operator allows you to retrieve articles matching the keyword a or the keyword b. It is important to note that this operator has a higher precedence than the AND operator. For example the query: Apple OR Microsoft will return all articles matching the keyword Apple as well as all articles matching the keyword Microsoft

Due to the higher precedence of the operator OR the following query will not work as expected: Apple AND iPhone OR Microsoft. Normally, articles matching the keywords Apple and iPhone are returned first and then articles matching the keyword Microsoft are returned. Because of the precedence of the OR operator, in practice the query will return articles matching Apple AND iPhone or Apple AND Microsoft. To have a normal behavior, it is necessary to add brackets. The query Apple AND iPhone OR Microsoft will behave normally when it is in this form: (Apple AND iPhone) OR Microsoft

Logical NOT Operator

This operator allows you to remove from the results the articles corresponding to the specified keywords. To use it, you need to add NOT in front of each word or phrase surrounded by quotes. For example the query: Apple NOT iPhone will return all articles matching the keyword Apple but not the keyword iPhone

Examples of Valid Queries

Query
Microsoft Windows 10
Apple OR Microsoft
Apple AND NOT iPhone
(Windows 7) AND (Windows 10)
"Apple iPhone 13" AND NOT "Apple iPhone 14"
Intel AND (i7 OR i9)
(Intel AND (i7 OR "i9-14900K")) AND NOT AMD AND NOT "i7-14700K"

Code Examples

// TODO: replace API_KEY with your API key.
apikey = 'API_KEY';
url = 'https://gnews.io/api/v4/search?q=example&lang=en&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
Spaines
Swedense
Switzerlandch
Taiwantw
Ukraineua
United Kingdomgb
United Statesus