Skip to content

More than a decade of news, ready for your research

Working on a new model for computing sentiment? Studying how information propagates through news media, or building a methodology to detect fake news? Retrieve exactly the learning data you need from an archive that goes back to January 2014.

2,000 free tokens · No credit card required

1000+ companies and institutions rely on NewsAPI.ai

  • Spotify
  • IBM
  • Accenture
  • Bloomberg
  • BBVA
  • World Bank Group
  • BASF
  • Huawei
  • OECD.AI Policy Observatory

Exactly the data your study needs

When you build data models you need a lot of learning data, and you need to be sure that it is exactly the data you want. The API gives you both.

A large archive and extensive search options

Our databases contain news articles published by over 150,000 news sources, and the archive goes back to January 2014.

A large number of search filters lets you specify exactly which articles you want to retrieve. Among others, you can search by keyword, concept, category, source, source location, language, date and sentiment.

  • Date ranges down to a single day
  • 50+ languages, selected per query
  • News categories such as news/Health work across languages
corpus.py
# one category, two languages, one year, no copies
q = QueryArticlesIter(
    categoryUri = "news/Health",
    lang = QueryItems.OR(["eng", "deu"]),
    dateStart = "2023-01-01", dateEnd = "2023-12-31",
    isDuplicateFilter = "skipDuplicates")

corpus = []
for art in q.execQuery(er, sortBy = "date", maxItems = 20000):
    corpus.append(art)

Comes back with titlebodylangdatesource

Extensive article metadata

When analyzing news data you might need various details about each article. Some of the returned details are provided by the news source: title, body, image, date of publication, author, URL, source information, and mentioned external links and videos.

Additionally, we compute several properties: the list of mentioned concepts and categories, the sentiment score for articles in English, and the ID of the event to which the article belongs.

  • The article text in the body field
  • Computed fields that you switch on per request
  • Categories, concepts and sentiment as ready-made labels
features.py
info = ReturnInfo(
    articleInfo = ArticleInfoFlags(
        concepts = True, categories = True,
        links = True, videos = True))

q = QueryArticlesIter(keywords = "climate summit")
for art in q.execQuery(er, returnInfo = info, maxItems = 500):
    print(art["body"][:200])
    print(art["categories"], art["sentiment"])

Comes back with bodyconceptscategoriessentiment

Event identification for propagation studies

If you are looking to analyze information propagation, fake news or related tasks, you can make use of our event detection. News API automatically finds and groups the articles that discuss the same thing that occurred into a unit that we call an event, likely even in multiple languages.

Retrieve all the articles about one event in the order in which they were published and you have a complete record of how the story spread, instead of manually searching for related articles.

  • All articles about one event, across languages
  • Ordered by time of publication
  • The isDuplicate flag marks copies of another article
propagation.py
# every article about one event, earliest first
q = QueryEventArticlesIter("eng-5059598")
for art in q.execQuery(er, sortBy = "date", sortByAsc = True):
    print(art["dateTime"], art["lang"],
          art["source"]["title"], art["isDuplicate"])

Comes back with dateTimelangsourceisDuplicate

Summaries without downloading every article

Sometimes the answer is a count. Aggregates return a summary of all the articles that match a query: the time distribution, the top concepts, keywords, categories and sources, or which concepts frequently co-occur.

Use them to size a dataset before you retrieve it, or for studies that only need the distribution.

  • Time distribution of the search results
  • Top concepts, keywords, categories and sources
  • A graph of concepts that frequently co-occur
aggregates.py
# the concepts most often mentioned with a topic
q = QueryArticles(
    conceptUri = er.getConceptUri("Vaccine"),
    dateStart = "2021-01-01", dateEnd = "2021-12-31",
    requestedResult = RequestArticlesConceptAggr())
res = er.execQuery(q)
for concept in res["conceptAggr"]["results"]:
    print(concept["label"]["eng"], concept["score"])

Comes back with conceptAggr

Labels that come with the text

Every article is annotated when it is collected. Use the fields as features, as labels, or as a baseline for your own models.

conceptsEntity annotations
People, organizations, locations and things detected in the text, disambiguated and given stable IDs.
categoriesTopic labels
The categories assigned to each article, usable for stratified sampling or as labels for a classifier.
sentimentSentiment score
A score from -1 to 1 for each article in English, as a baseline to compare your own model with.
eventUriEvent membership
The ID of the event to which the article belongs, which links reports of the same thing across sources and languages.
sourceSource metadata
Publisher, location and ranking, to compare coverage between countries or between large and small outlets.
isDuplicateDuplicate flag
Marks an article that is a copy of another one, which matters when you count sources or study how a story spread.

From query to dataset in three steps

  1. Create a free account

    You get 2,000 tokens with no credit card. A 30-day article search costs 1 token, so that is plenty to evaluate the data.

  2. Pick how you call the API

    Run pip install eventregistry for Python, use the Node.JS SDK, or send the REST request from any language. Switch the example to see each one.

  3. Run the query

    Set the category, the languages and the date range and run it. The sandbox builds queries interactively and generates the code for you.

Explore the docs
build_dataset.py
from eventregistry import *
import json

er = EventRegistry(apiKey = YOUR_API_KEY)

q = QueryArticlesIter(
    categoryUri = "news/Business",
    lang = QueryItems.OR(["eng", "deu", "fra"]),
    dateStart = "2024-01-01",
    dateEnd = "2024-03-31",
    isDuplicateFilter = "skipDuplicates")

info = ReturnInfo(articleInfo = ArticleInfoFlags(
    concepts = True, categories = True))

# one JSON object per line, ready for pandas or Spark
with open("business-2024-q1.jsonl", "w") as out:
    for art in q.execQuery(er, sortBy = "date",
            returnInfo = info, maxItems = 50000):
        out.write(json.dumps(art) + "\n")

Research that starts from news data

  • Sentiment models

    Train and evaluate on articles in many languages, with source, category and date as metadata.

  • Information propagation

    Trace how a story moves from the first report to wide coverage, source by source.

  • Fake news detection

    Compare how different sources report the same event, and build the learning data for your methodology.

  • Topic and trend analysis

    Use aggregates to measure how much attention a topic, a person or an organization receives over time.

  • Event datasets

    Build a dataset of news or events for further analysis, with dates, locations and article counts.

  • Media studies

    Compare coverage across countries and outlets using the location and ranking of each source.

Good to know before you start

What content does the API cover?

News articles, blog posts and press releases from 150,000+ publishers in 50+ languages, with a searchable archive that goes back to 2014.

How far back does the archive go?

To January 2014. The archive takes the same queries and returns the same fields as the real-time data.

What does an archive search cost?

An article search over the last 30 days uses 1 token. A search in the archive uses 5 tokens per searched year. Each search returns up to 100 articles, and each further page of results counts as another search. The plans page has the full table and shows which plans include historical data.

How do I retrieve a large result set?

The iterator classes in the SDK, such as QueryArticlesIter, request one page after another for you; set maxItems to limit how many articles are retrieved. Over REST, one call returns up to 100 articles, and articlesPage selects the following pages.

What does it cost to try?

Nothing. Registration gives you 2,000 tokens with no credit card, and they do not expire. An article search over the last 30 days uses 1 token. After that, paid plans are a monthly subscription that you can upgrade or downgrade at any time.

Do I have to use the Python SDK?

No. Every query is available through the REST API, and each example on this page can be switched to Node.js, cURL or the plain REST request. The Node.js version calls the REST API with fetch; there is also a Node.JS SDK. The sandbox lets you build a query interactively and generates the code for you.

Effortless integration

Our API is very easy to integrate and provides great documentation with examples. Simply use the sandbox to generate code that you can directly deploy in your application.

Start with 2,000 free tokens, no credit card required. After that it is a simple pay-as-you-go monthly subscription: upgrade or downgrade your plan at any time.