News API v1 legacy docs
This page is for v1 of the API. V1 will still be available for the foreseeable future.
Endpoints
Using News API is simple. There are only 2 endpoints:
GET https://newsapi.org/v1/articles
Provides a list of live article metadata from a news source or blog (99% of the time this is the one you want!).
Parameters
source | (required) - The identifer for the news source or blog you want headlines from. Use the /sources endpoint to locate this or use the sources index. | ||||||
---|---|---|---|---|---|---|---|
apiKey | (required) - Your API key. Alternatively you can provide this via the X-Api-Key HTTP header. | ||||||
sortBy |
(optional) - Specify which type of list you want. The possible options are top, latest and popular. Note: not all options are available for all sources. Default: top.
|
Request
GET https://newsapi.org/v1/articles?source=the-verge&apiKey=API_KEY
Response
status | (string) - If the request was successful or not. Options: ok, error. In the case of error a code and message property will be populated. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
source | (string) - The identifier of the source requested. | ||||||||||||
sortBy | (string) - Which type of article list is being returned. Options: top, latest, popular. | ||||||||||||
articles |
(array) The list of headline metadata requested.
|
GET https://newsapi.org/v1/sources
Provides a list of the news sources and blogs available on News API. You will need this to programmatically locate the identifier for the source you want articles from when querying the /articles endpoint.
Parameters
category | (optional) - The category you would like to get sources for. Possible options: . Default: empty (all sources returned) |
---|---|
language | (optional) - The 2-letter ISO-639-1 code of the language you would like to get sources for. Possible options: . Default: empty (all sources returned) |
country | (optional) - The 2-letter ISO 3166-1 code of the country you would like to get sources for. Possible options: . Default: empty (all sources returned) |
Request
GET https://newsapi.org/v1/sources?language=en
Response
status | (string) - If the request was successful or not. Options: ok, error. In the case of error a code and message property will be populated. | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sources |
(array) - A list of the news sources and blogs available on News API.
|