
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 within the NewsData.io API is a treasure trove of historical news articles. It allows users to retrieve news content from a specific date range from the past 6month for basic users, 1 year for professional users, and 2 years for corporate users which enables them to study trends, events, and narratives that have shaped our world over time.
Users can also request the past data up to 5 years for this this you have to contact us at contact@newsdata.io Whether you’re a researcher, analyst, or curious individual, the “News Archive” endpoint offers a rich dataset for exploration.
How to use News “Archive” endpoint
1. Construct Your Request: Begin by constructing an API request using the “News Archive” endpoint. The documentation provides the base URL and details about query parameters.
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY
2. Authentication: As with all NewsData.io API requests, include your API key for authentication.
3. Define Date Range: Specify the start and end dates that correspond to the period you’re interested in exploring.from_date=2022-12-01
4. Apply Filters: Customize your request by adding filters like sources, countries, languages, or keywords. This ensures that the retrieved articles align with your specific criteria.
5. Retrieve and Analyze: Upon sending the request, you’ll receive a JSON response containing historical news articles within your specified date range. Each article’s details provide insights into the past.
Parameters of News Archive Endpoints
1. From date: from_date parameter help users to set a particular date from the past in YYYY-MM-DD format which the user wants to retrieve from
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=War&from_date=2023-02-02
This query will begin to fetch articles containing the phrase war from 2nd February 2023 to the present date.
2. To Date: to_date parameter help the users set an 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
- Users can set the to and from date according to their plans. For the basic plan users can request up to the past 6 months of data.
- Profession plan users can request up to the past 1 year of data.
- Corporate users can request up to the past 2 years of data.
Users can also go beyond 2 years and request up to 5 years of historical data but for that, you would need to contact us through contact@newsdata.io.
So now let’s understand how to fetch articles using this parameter with an example. I want to retrieve the articles for the event of FIFA World Cup so the query would be q=FIFA World Cup
The request would be https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=FIFA World Cup
Then you need to add the timeline in which you want the news of so the World Cup was started on 20 November 2022 to 18 December 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 20 November 2022 to 18 December 2022
3. q: Search news articles of specific keywords anywhere presented in 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 query of your choice and fetch the articles as shown in above example.
4. 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
5. qInMeta: Search the news articles from the URL, Meta description, and Title by using this parameter.
https://newsdata.io/api/1/archive?apikey=pub_YOU API KEY&qInMeta=global warming
To know more about how the q, qInTitle, and qInMeta functions you you check out this blog.
6. 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
https://newsdata.io/api/1/archive?apikey=pub_YOU API KEY&q=festivals&country=in
This will fetch the articles related to query=festivals from the mentioned specific country which is India.
Similarly you can add further country code’s and narrow down you result’s by adding country specific parameter.
7. 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. For example, category=sports,top there is a total of 12 categories option available from which users can filter.
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. So if the user enters category=politics the API will fetch the articles related to the politics category.
Furthermore, you can add 12 different categories that NewsData.io offers such as politics, sports, science , business, etc.
8. 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.
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=football&language=en
This query will fetch only those articles which are in English and to change the language you can check the list accordingly and modify your request.
NewsData.io provides 77 different languages. To fetch articles in different languages you can check out the documentation page.
9. 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 and the request parameter would be domain=bbc,nytimes.
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.
There are 28000+ domains that NewsData.io fetches the article from so you can customize your domain parameter accordingly.
10. Domainurl: This parameter will allow users to extract articles from news domains. The parameter would be domainurl=nytimes.com,bbc.com,bbc.co.uk. You can add up to 5 domain URLs and if any domain URL is incorrect
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=football&domainurl=bbc.com
11. Exclude Domain: By this parameter, you can exclude the domains in which you dont want relevant articles. The parameter would be excludedomain=nytimes.com,bbc.com
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=football&excludedomain=bbc.com
This request parameter will fetch all the articles that contain the keyword football excluded from BBC domain. This would be helpful for those users who don’t want the articles of any specific domain for example above mentioned is BBC. To clarify this request further here are some more examples.
12. Domain Priority: Domain priority allows the users to extract news articles on the basis of domain authority of news sources. We have set the priority on 3 different levels which are top, middle, and low.
- Top: Fetches news articles from the top 10% of the news domains. Request parameter 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. Request parameter 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. Request parameter prioritydomain=low
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=global warming&prioritydomain=low
13. 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 time zone would be timezone=America/New_york.
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=movies&timezone=Asia/Dubai
14. Full Content: By this request parameter users can request a full-content article or without a full-content article. The request parameter of this would be full_content=1 for full content and full_content=0 for which 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
15. Image: This parameter will allow you to search the articles with or without featured images. To send this request parameter write image=1 to have the articles with images and image=0 for those 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
16. Video: This parameter would help users to retrieve videos containing articles. To get the articles containing video the request parameter would be video=1 and for those without video articles, the parameter would be video=0.
For articles with video
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=modi&video=1
For articles without video
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=modi&video=0
17. Size: This parameter allows the users to customize the number of articles that they can obtain from one API request. For free users, the max limit is 10, and for paid users, the limit is up to 50 per request. The parameter for this request would be size=25.
https://newsdata.io/api/1/archive?apikey=pub_YOUR API KEY&q=football&size=30
This request will fetch 30 articles per request but it is only for paid users because their max limit is up to 50 and for free the archive plan is not available they had to upgrade their plan.
Benefits of News Archive
- Historical News: The endpoint grants access to news articles that provide historical context, aiding in understanding the evolution of events and trends. You can access historical data up to the past 2 years and if you want data way beyond it you can contact contact@newsdata.io
- Long-Term Analysis: Researchers can perform longitudinal studies by analyzing news coverage over extended periods, uncovering trends and shifts.
- Informed Decision-making: Whether you’re tracking historical market trends, societal shifts, or geopolitical events, this endpoint equips you with insights to make well-informed decisions.
Conclusion
The “News Archive” endpoint of the NewsData.io API provides the data to the past, offering a wealth of historical news articles at your fingertips. Whether you’re conducting research, analyzing historical patterns, or gaining insights into past events, the “News Archive” endpoint serves as a valuable resource for deepening your understanding and making informed connections across time.
Dushyant is an enthusiastic and quick learner in all fields who likes to gain experience, loves to write, and works on his creativity. He loves to explore new things and information and has the potential to spread knowledge across the world. He believes in teamwork and helping others and has a strong belief in learning from our own life experiences and exploring more through our mistakes as everyone has a story to create. His hobbies include sports, drawing, learning new things, and a deep interest in geopolitics.