How to Fix 400 Bad Request Errors
What the ERxxxx validation codes mean, why a lookup filter can return 400, and how to correct the parameter the message names
Written by Erick Horn
July 6, 2026
How to fix 400 Bad Request errors
A 400 Bad Request from the APITube News API means one specific parameter in your request failed validation, and the error message names it. Read errors[0].message in the response body — it tells you which parameter to fix and what the accepted values are, so the fastest fix is always to correct exactly what the message says, not to guess.
The envelope looks like this:
{
"status": "not_ok",
"request_id": "…",
"errors": [
{
"status": 400,
"code": "ER0171",
"message": "Limit is out of range."
}
]
}
What are the most common 400 validation errors?
Validation messages follow a few repeating patterns, each pointing at a different kind of mistake:
Invalid <parameter> value.— the value has the wrong type or format for that filter, for example a word where a number is expected.<parameter> must be 0 or 1.— boolean-style flags such asis_duplicateoris_paywallaccept only the literal digits0and1, nottrue/false.<parameter> must be between 1 and N characters.— a length bound. For exampletitleaccepts 1 to 100 characters andlanguage.codeaccepts 1 to 2 characters.<parameter> must be greater than or equal to 0.— numeric filters such asmedia.images.count.minreject negative numbers.
Why do pagination parameters return 400?
Pagination has its own set of codes:
- ER0170 —
'Per page' is not a number.per_pagemust be an integer. - ER0171 —
Limit is out of range.per_pageis capped at 250 (the default is 100). Request 250 or less per page. - ER0172 —
Page is not a number.pagemust be an integer. - ER0173 — the free plan is limited to the first 5 pages. Deep pagination needs a paid plan; until then, narrow the query with filters instead of paging past results.
Why does a name filter return 400 instead of empty results?
Lookup filters resolve a name against APITube’s entity index before the search runs. If the name is unknown, the API rejects the request with a 400 rather than silently returning zero articles:
- ER0204 —
author with name '…' not found. - ER0214 —
source domain name '…' not found. - ER0216 —
entity person name '…' not found.(theperson.namefilter) - ER0220 —
entity organization name '…' not found.(theorganization.namefilter)
This is deliberate: a typo like organization.name=Aple fails loudly instead of looking like “no news about Apple today”. Check the spelling, try the canonical English name, or search the text with title instead of an entity filter. If the request is accepted but still returns nothing, that is a different problem — see why does my query return no results.
Suggest endpoints add one more: ER0346 — `Prefix` in query required. — the autocomplete endpoints need a non-empty prefix to complete.
How should my code handle a 400?
Do not retry a 400 unchanged — the same request produces the same error. Branch on the HTTP status, log code and message, and surface the message to whoever built the query, since it already contains the fix. The full envelope format and the other status codes (401, 402, 403, 429) are covered in understanding API error codes.
Common Questions
Does a 400 consume quota?
No. Validation happens before the search executes, so a rejected request does not draw down your plan credits.
Can one request produce several 400 errors?
errors is an array, but validation stops at the first failing parameter group in most cases — fix what is reported, re-send, and repeat if another parameter is also wrong. Fixing parameters one message at a time converges in a couple of attempts.
The message names a parameter I did not send — why?
Check for a typo in a parameter name. An unrecognised name can make its value land in the wrong place, and the validator then reports the canonical parameter. Compare your request against the parameter reference and the walkthrough in how to debug failed API requests.