How do I filter articles by category (e.g. business, sports)?

Use categoryUri. Examples:

"categoryUri": "news/Business"
"categoryUri": "news/Sports"
"categoryUri": "dmoz/Sports/Soccer"
  • We use several taxonomies. The news taxonomy (news/Business, news/Politics, news/Technology, ...) works for all languages and all archive years. The dmoz taxonomy is much more detailed (e.g. a category for every sport) but is available only for English articles. There is also an IPTC taxonomy (subject codes).
  • The full lists of categories for each taxonomy can be downloaded in the categories section of the documentation: newsapi.ai/documentation. You can also search for categories with the free suggestCategoriesFast endpoint or in the sandbox.
  • To exclude categories, put them in $not:
"$query": {
  "lang": "eng",
  "$not": { "$or": [ { "categoryUri": "news/Business" }, { "categoryUri": "news/Politics" } ] }
}

To get the categories of each returned article, request them with includeArticleCategories: true (Python SDK: ReturnInfo(articleInfo=ArticleInfoFlags(categories=True))).