Cabinhub News API v1.0.0

Docs / Errors

Errors

Every status the API answers, the exact body it carries, and the two shapes an error body can take.

One rule

Branch on the HTTP status code, not on the body text. There are only two body shapes and both put everything under detail.

The envelope

Most failures
JSON
{"detail": "limit must be between 1 and 200"}
429 only
JSON
{"detail": {"error": "quota_exceeded", "detail": "...", "quota": 1, "used": 2, "resets_at": "..."}}

Statuses documented in the contract

StatusDocumented causes
40014
4011
4045
4051
4091
4101
4291
5011
5033

Counted from the table in docs/API.md §8 on every build, so a status added to the contract appears here.

Every status, with its cause and body

Source: docs/API.md §8.

Success bodies vary by route. Error bodies have two shapes, both under detail:

JSON
{"detail": "limit must be between 1 and 200"}
JSON
{"detail": {"error": "quota_exceeded", "detail": "...", "quota": 1, "used": 2, "resets_at": "..."}}

The second shape occurs only for 429. Branch on the HTTP status code, not on the text: detail strings are stable in wording but written for humans and logs.

StatusCauseVerified detail
400limit out of range (items)limit must be between 1 and 200
400limit below range (related)limit must be between 1 and 50
400limit not an integerlimit must be an integer
400bad categorycategory must be one of: markets, macro, commodities, fx, crypto, central_banks, corporate, energy
400malformed locale taglocale is not a well-formed locale tag
400bad since / untilsince is not a valid RFC3339 timestamp: 'bad'
400inverted rangesince must not be later than until
400bad min_importancemin_importance must be <= 1.0 (and >= 0.0, must be a number, must be a finite number)
400bad cursorcursor is not valid base64url JSON
400stale/reused search cursorcursor was issued for a different query / cursor is stale: the index changed since it was issued; start from the first page
400search q too shortq must be at least 2 characters
400search q too longq must be at most 256 characters
400edition day shapeday must be a UTC date in YYYY-MM-DD form, got '11-11-04'
400bad monthmonth must be a YYYY-MM string
401auth (see §3.5)invalid or missing bearer token / invalid admin token
404unknown item or a withheld oneitem not found
410an id a duplicate migration retired (see §8b)object shape {"error": "duplicate_superseded", "survivor_id": …, "survivor_url": …}
404unknown image keyimage not found
404unknown run idrun not found
404edition day with no publishable itemsno digest for locale 'en' on 1999-01-01
404locale that has never publishedno digest for locale 'de': no published items
405HEAD on a GET-only route; a bare OPTIONS with no Access-Control-Request-Method (a real preflight on /v1/site/* answers 200, §5a){"detail":"Method Not Allowed"}
409refresh already runninga refresh is already running
429quota exhaustedobject shape above
501/v1/usage, /v1/usage/history on a non-database keyusage reporting requires a database-issued key; ...
503store unreadable (/v1/health only)body is the degraded health object, not a detail
503SQLite build without FTS5 (/v1/search only)keyword search is unavailable: this SQLite build has no FTS5 support
503admin token not configuredrefresh is disabled: NEWS_ADMIN_TOKEN is not configured / admin usage is disabled: ... / operator routes are disabled: NEWS_ADMIN_TOKEN is not configured

Note the 405: a HEAD /v1/feed/en is rejected (measured). An OPTIONS request is also 405 unless CORS is configured and the request carries an allowed Origin. Use GET even for a reachability probe; /v1/health is the cheapest one and needs no auth.