APITube Help Center

How to Filter News by Category

Select subject categories with recognized IPTC codes

Tasha Tatum

Written by Tasha Tatum

August 22, 2026

Updated October 16, 2026

Open this example in the API Playground ↗

How to filter news by category

Add category.id with an IPTC subject code, such as medtop:15000000 for Sport. Up to three comma-separated codes match with OR, so an article can belong to any selected category.

curl "https://api.apitube.io/v1/news/everything?category.id=medtop:15000000&api_key=YOUR_API_KEY"

Send your key through api_key or X-API-Key. Without a category condition, the search does not restrict subjects.

What is the category.id parameter?

It selects recognized IPTC categories, whose codes use the medtop: prefix. An unknown code stops the request with 400 ER0206. Use a category lookup rather than guessing the code.

How to filter by one or more categories

Use one code or a list:

curl "https://api.apitube.io/v1/news/everything?category.id=medtop:15000000,medtop:04000000&api_key=YOUR_API_KEY"

Only the first three values are applied. Other filter parameters combine with AND:

curl "https://api.apitube.io/v1/news/everything?category.id=medtop:15000000&language.code=en&sort.by=published_at&sort.order=desc&api_key=YOUR_API_KEY"

Add publication dates for a reporting window.

How to find the right category ID

Look up a category by prefix:

curl "https://api.apitube.io/v1/suggest/categories?prefix=sport&api_key=YOUR_API_KEY"

Use the returned id directly in category.id. Results also include names, taxonomy and links.self. A missing prefix returns ER0346; a missing API key returns 401 ER0201.

See the category list.

How to exclude a category

Use ignore.category.id:

curl "https://api.apitube.io/v1/news/everything?ignore.category.id=medtop:15000000&api_key=YOUR_API_KEY"

It accepts up to three recognized codes. Unknown exclusions return 400 ER0207. Include and exclude filters can be combined.

Which endpoints support category filtering?

Use these filters on Everything, Top Headlines, Story and category, topic, industry or entity news. The direct route /v1/news/category/{taxonomy}/{id} selects one category; take its URL from a suggestion’s links.self. An unknown category there returns 404 ER0241.

What does the category data look like in the response?

Read the article’s categories array:

{
    "categories": [
        {
            "id": 314,
            "name": "Sport",
            "taxonomy": "iptc_mediatopics",
            "links": {
                "self": "https://api.apitube.io/v1/news/category/iptc_mediatopics/medtop:15000000"
            }
        }
    ]
}

Entries can include a match score and a link to category coverage. Use suggestions for the medtop: code needed by the filter; the numeric article-category id is not that code. For totals, see counting articles.

Common Questions

How many categories can I filter by at once?

Three per inclusion or exclusion parameter. Extra values are dropped.

What category codes does category.id accept?

Recognized IPTC codes returned by /v1/suggest/categories, such as medtop:15000000.

What error do I get for an unknown category?

400 ER0206 for inclusion or ER0207 for exclusion. Check every code in the list.

Can I include and exclude categories in the same request?

Yes. Inclusion selects matching categories; exclusion removes articles matching an excluded one. Other conditions must also hold.


Related Articles