Skip to main content

The “News archive” endpoint allows you to delve into the past and extract valuable historical news articles along with valuable insights. In this article, we’ll explore the News “Archive” endpoint of the NewsData.io API documentation, uncovering its features and discussing how it empowers users to access and analyze historical news data.

Understanding the News “Archive” Endpoint

The News “Archive” endpoint allows users to retrieve news content from a specific date range. The date range varies for everyone as per their subscription plan.

  • For Basic users, the date range is from the past 6 months.
  • For professional users, the date range is 1 year.
  • For corporate users, the date range is 2 years, enabling them to study trends, events, and narratives that have shaped our world over time.

NOTE: You can also request the past data for up to 5 years. This can be done by contacting us at as well.

How to use News “Archive” endpoint

1. Construct Your Request

The first and foremost step is constructing an API request using the News “Archive” endpoint.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY

NOTE: You can also access the base URL and details about query parameters from the documentation.

2. Authentication

Just like other NewsData.io API requests, include your API key for authentication.

3. Define Date Range

Specify the start and end dates of the period you’re interested in exploring.

4. Apply Filters

You can customize your request by adding filters like sources, countries, languages, or keywords. This ensures that the fetched articles align with your specifications.

5. Retrieve and Analyze

Upon sending the request, you’ll receive a JSON response containing historical news articles within your specified date range.

Parameters of News Archive Endpoints

1. id

Search specific news articles using a unique “article_id” string assigned to each article. You can include up to 50 such ‘article_id’ strings in a single query.

For better understanding, below are some examples.

    • If you want to fetch only a single article with specified ‘article_id’,
      https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=war&id=936fbaa50b8ba3abca62f9e798cc32d3
  • If you want to fetch several articles with individual specified ‘article_id’,
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=war&id=936fbaa50b8ba3abca62f9e798cc32d3,

2. from_date

This parameter helps users set a particular date they want to retrieve data from. The date can be set in YYYY-MM-DD format.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=War&from_date=2023-02-02

This query will fetch articles containing the keyword ‘war’ from February 2, 2023, to the present date.

3. to_date

This parameter helps the users set the end date of the query in YYYY-MM-DD format.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=War&to_date=2023-05-02

For better understanding, below is an example.

  • For Instance, you want to fetch articles related to the FIFA World Cup event, so the request parameter would be ‘q=FIFA_World_Cup
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=FIFA_World_Cup
  • Now you need to add the timeline you want the news of the World Cup from. Let’s fix the start date as November 20, 2022, and the end date as December 18, 2022. So your query would be
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=”FIFA_World_Cup”&from_Date=2022-11-20&to_date=2022-12-18.
    This query would extract all the articles which contain the phrase “FIFA World Cup,” which dates from November 20, 2022, to December 18, 2022

4. q

Search news articles of specific keywords present anywhere throughout the entire article.
For example, q=messi will show all the relevant articles that contain the keyword Messi.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=ronaldo
This will fetch all the relevant articles that contain the keyword Ronaldo, even if it’s between the content or title.

You can further add a query of your choice and fetch the articles as shown in above example.

5. qInTitle

This parameter will help users search news articles for specific keywords or phrases present in the news titles only. For example, qInTitle=messi will show all the relevant articles that contain messi in the news title.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&qInTitle=messi
This request will fetch all the related articles which contain the keyword “Messi” in the article’s title.

6. qInMeta

Search the news articles from the URL, Meta description, and Title by using this parameter.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&qInMeta=global warming

7. Country

Search the news articles from a specific country. You can add up to 5 countries in a single query. Check the codes for all the countries here. For example, country=au, jp, where au means Australia and jp means Japan.

For better understanding, below are some examples.

  • If you set the ‘country=in’, it will fetch articles from India related to your query.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=festivals&country=in
  • If you set the ‘country=au,jp’, it will fetch articles from Australia and Japan.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&country=au,jp

8. Category

Search the news articles for a specific category. You can add up to 5 categories in a single query. Check the codes for all the categories here. There are a total of 12 categories options available for users to choose from.
For example, category=politics
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=trump&category=politics
This request will fetch the related articles that contain the keyword Trump and are related to the politics category.

9. excludecategory

Exclude Categories to search for news articles.
For example, ‘excludecategory=politics’, this request will fetch all news articles from all other categories except politics.
The given request will fetch all the news articles containing the keyword ‘Modi’ from all the categories except politics.
https://newsdata.io/api/1/archive?apikey=YOUR_API_KEY&q=modi&excludecategory=politics

NOTE: You can exclude up to 5 categories in a single query.

NOTE: You can either include the ‘category’ or ‘excludecategory’ parameter in your query. You can’t use both parameters simultaneously.

10. language

Search the news articles for a specific language. You can add up to 5 languages in a single query. Check the codes for all the languages here. For example, language=fr,en where fr means French and en means English.

For better understanding, below are some examples.

  • If you set ‘language=en’, it will fetch only those articles which are in English.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&language=en
  • If you set ‘language=en,fr’, it will fetch only those articles which are in English and French.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&language=en,fr

NOTE: NewsData.io provides 77 different languages. To fetch articles in different languages, you can check out the documentation.

11. domain

You can search the news articles of specific news domains, such as BBC or the New York Times. You can add up to 5 domains in a single query. The request parameter would be ‘domain=bbc’.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&domain=bbc
This query would fetch the articles that contain the keyword football, which is from the bbc domain only.

NOTE: This parameter is currently being merged with the domainurl parameter.

12. domainurl

This parameter will allow users to extract articles from news domains. You can add up to 5 domain URLs in a single query. If any domain URL is incorrect, you will be suggested the correct domainurl.
The request parameter would be ‘domainurl=bbc.com’.

For better understanding, below is an example.

  • If you set ‘domainurl=bbc.com’, it will fetch all relevant articles from the BBC domain.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&domainurl=bbc.com

NOTE: If you enter the wrong domainurl, the system will show error and will suggest you the correct domainurl(s). You can then choose from the correct domainurl(s) and continue data fetching.

13. excludedomain

You can exclude the domains you don’t want articles from using this parameter. The request parameter would be ‘excludedomain=bbc.com’.

For better understanding, below are some examples.

  • If you set ‘excludedomain=bbc.com’, it will fetch you all articles except from BBC domain.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&excludedomain=bbc.com
  • If you set ‘excludedomian=nytimes.com,bbc.com’, it will fetch you all articles except from NY Times and BBC domain.
    https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&excludedomain=nytimes.com,bbc.com

14. prioritydomain

Domain priority allows the users to extract news articles on the basis of the domain authority of news sources.

The priority is set on 3 different levels which are top, middle, and low.

    • Top: Fetches news articles from the top 10% of the news domains. The request parameter would be ‘prioritydomain=top’.

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=global_warming&prioritydomain=top

    • Medium: Fetches news articles from the top 30% of the news domains. The request parameter would be ‘prioritydomain=medium’.

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=global_warming&prioritydomain=medium

    • Low: Fetches news articles from the top 50% of the news domains. The request parameter would be ‘prioritydomain=low’.

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=global_warming&prioritydomain=low

15. Timezone

You can search the articles on the basis of specific time zones. You can add any specific time zone by checking the time zone here.
The request parameter for the time zone would be ‘timezone=Asia/Dubai’.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=movies&timezone=Asia/Dubai

16. Full Content

With this request parameter, users can request a full-content article or without a full-content article. The request parameter for this would be ‘full_content=1’ for full content and ‘full_content=0’ for content that doesn’t contain full-width content.

    • For Full Content

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=movies&full_content=1

    • Without full content

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=movies&full_content=0

17. Image

This parameter will allow you to search the articles with or without featured images. The request parameter would be ‘image=1’ for articles with images and ‘image=0’ for articles without featured images.

    • For articles with featured images

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=messi&image=1

    • For articles without featured images

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=messi&image=0

18. Video

This parameter would help users retrieve articles containing videos. The request parameter would be ‘video=1’ and for those articles without video, the request parameter would be ‘video=0’.

    • For articles with video

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&video=1

    • For articles without video

https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&video=0

19. Size

This parameter allows the users to customize the number of articles that they can obtain from per API request.
For free users, the max limit is 10, and for paid users, the limit is up to 50 per request.
The ‘size=30’ request will fetch 30 articles/requests.
https://newsdata.io/api/1/archive?apikey=pub_YOUR_API_KEY&q=football&size=30

20. page

This parameter allows the user to navigate to the next page. While fetching the data you will see a ‘nextPage’ string at the bottom of the screen. You can insert this in your query to navigate to the next page manually.

For Example:
https://newsdata.io/api/1/archive?apikey=YOUR_API_KEY&q=war&page=XXXPPPXXXXXXXXXX
This parameter will take you to the nextPage with a set of new articles.
To learn more about this parameter, click here.

Leave a Reply