APITube Help Center

How to Combine Multiple Filters in One Request

Stack language, category, date and source filters with AND logic on one call

Kent Hudson

Written by Kent Hudson

June 27, 2026

Updated July 6, 2026

Open this example in the API Playground ↗

How to combine multiple filters in one request

Add as many filter parameters as you need to the same /v1/news/everything call: APITube applies every parameter to one query, so different filters combine with AND logic and each one you add narrows the results. Inside a single parameter, a comma-separated list uses OR. Sorting and pagination then run on top of whatever the filters return.

curl "https://api.apitube.io/v1/news/everything?language.code=en&category.id=medtop:15000000&published_at.start=2026-06-01&sort.by=published_at&per_page=50&api_key=YOUR_API_KEY"

That request returns English articles and in the Sport category and published since 1 June 2026, newest first, 50 per page. You can send the key as a header (X-API-Key: YOUR_API_KEY) instead of the api_key query parameter.

How does APITube combine multiple filters?

APITube builds one query and runs each filter parameter against it in turn, so the conditions add up: an article must satisfy every parameter to be returned (AND logic). Adding more filters always makes the result set smaller or equal, never larger.

The two layers behave differently:

  • Across different parameters — AND. language.code=en and category.id=medtop:15000000 together return only articles that are both English and Sport.
  • Inside one parameter — OR. A comma-separated list such as category.id=medtop:15000000,medtop:04000000 returns articles matching either code. Most list parameters accept up to three values.

So language.code=en,fr&category.id=medtop:15000000 means “(English OR French) AND Sport”.

How to combine filters in one request

List each parameter with &. This call stacks four filters plus sorting and pagination:

curl "https://api.apitube.io/v1/news/everything?source.domain=theguardian.com&language.code=en&category.id=medtop:15000000&sentiment.overall.polarity=positive&sort.by=relevance&per_page=25&api_key=YOUR_API_KEY"

It returns positive-sentiment Sport articles in English from theguardian.com, ranked by relevance, 25 per page. A few rules to keep in mind:

  • per_page defaults to 100 and maxes out at 250 — a larger value returns HTTP 400 with error ER0171. Use page to walk through the rest; see how to paginate through results.
  • sort.by and sort.order are not filters — they only reorder what the filters already selected. Without them, results come back sorted by published_at descending (newest first).
  • To restrict the time window, add published_at.start and published_at.end together; see how to filter news by date range.

What happens if one filter in the request is invalid?

If any single parameter is invalid, the whole request fails — the filter chain stops at the first problem and returns its error, so none of the other filters run. For example, an unknown category.id returns HTTP 400 with error ER0206, and an unknown source.domain returns ER0214. The fix is to validate values one parameter at a time before combining them.

This also means a typo in one filter can make a multi-filter request look like it “returns nothing” when it actually returned an error. Check the HTTP status and error code first.

How to exclude results while combining filters

Every positive filter has an ignore. counterpart, and you can mix include and exclude filters in the same request. This call keeps English Sport articles but drops one publisher:

curl "https://api.apitube.io/v1/news/everything?language.code=en&category.id=medtop:15000000&ignore.source.domain=theguardian.com&api_key=YOUR_API_KEY"

ignore.category.id, ignore.language.code and ignore.source.domain follow the same comma rules as their positive versions and also abort the request on an unknown value (for example ER0215 for an unknown ignored domain). For more on removing terms and publishers, see how to exclude keywords or sources.

Does the order of filters in the URL matter?

No. The order you write parameters in the URL has no effect on the result. APITube runs filters in a fixed internal order optimised by cost — cheap indexed checks first, expensive lookups last — regardless of how you arranged them in the request. Write parameters in whatever order is clearest to read.

Common Questions

Do different filters use AND or OR?

Different parameters use AND: an article must match all of them. A comma-separated list inside one parameter uses OR: the article must match at least one value in that list. So language.code=en,fr is OR within the language filter, while pairing it with category.id=... adds an AND condition.

How many values can I pass to one filter?

List parameters such as language.code, category.id and source.domain accept up to three comma-separated values; values beyond the third are dropped. To match more than three of something, run separate requests or use a broader filter.

Why does my multi-filter request return an error?

Because the filter chain stops on the first invalid parameter and returns that error instead of results — one bad category.id (ER0206) or unknown source.domain (ER0214) fails the entire call. Test each filter value on its own, then combine them once each one works.

Can I sort and paginate a filtered request?

Yes. sort.by, sort.order, page and per_page apply on top of any combination of filters. The filters decide which articles match; sorting decides their order; pagination decides how many you get per call (default 100, maximum 250).


Related Articles