HTTP conventions
The OpenAPI document, and the Link header
Section titled “The OpenAPI document, and the Link header”The API does not serve its own description. The OpenAPI 3.1 document is
/openapi.json on this site, and the
API reference renders the same document. Each environment
has its own docs site, and its copy names that environment’s API in
servers, so a client generated from it calls the API it was read beside.
Every response carries two Link relations (RFC 8288), including the
401, the 404 and the 204 below. From the API this site documents:
Link: <https://developer.ninetables.io/openapi.json>; rel="service-desc"; type="application/json", <https://developer.ninetables.io/>; rel="service-doc"service-desc is the OpenAPI document and service-doc this site
(RFC 8631), both on the docs site of the environment you called. A client that
has touched any endpoint, even unauthenticated and even wrongly, has already
been handed both — follow service-desc rather than guessing.
Request bodies are strict; query strings and headers are not
Section titled “Request bodies are strict; query strings and headers are not”Request BODIES are strict (additionalProperties: false) all the way
down — the outer body, each /batch item, and the op objects inside
values (MultiSelectOp, CounterOp, CounterOpBatch) alike, so a misspelt
by is a 400 rather than a silent +1.
Unknown query-string parameters are ignored, so do not assume an undocumented
one is honoured: ?limit=2 on a route that declares no limit returns the
full collection, silently. An undocumented request HEADER is ignored the same
way, which matters most for Idempotency-Key: see
Honoured only where declared.
Bodies are JSON
Section titled “Bodies are JSON”Every route that declares a body needs Content-Type: application/json and a
non-empty body. The media type is matched per RFC 9110 §8.3.1 —
case-insensitively, parameters ignored, +json suffixes accepted — so
APPLICATION/JSON and application/json; charset=utf-8 are the same type as
application/json, while text/plain, form encoding and an absent header are
each a 400 validation-failed on (root). It is never a 200 with your body
quietly discarded:
{ "type": "https://ninetables.io/problems/validation-failed", "title": "Validation Failed", "status": 400, "detail": "Request validation failed", "code": "VALIDATION_FAILED", "errors": [ { "key": "(root)", "code": "schema_invalid", "detail": "Content-Type must be application/json — got 'text/plain'" } ]}That refusal, a missing body and a body that is not parseable JSON are the
request-body contract. One middleware raises all four ahead of the operation’s
own handler, so ahead of the rate-limit charge too: they cost no token and
carry no X-RateLimit-*.
Paths match exactly
Section titled “Paths match exactly”Do not join a base URL that ends in / with a path that begins with one.
Paths are matched EXACTLY: /me/ is not /me and answers
unknown-endpoint. //me may work or may not — collapsing a doubled
slash is a property of the gateway in front of a given deployment, like CORS
and like the plain-text 400 described under Errors, not of this application.
OPTIONS and HEAD
Section titled “OPTIONS and HEAD”Every OPTIONS that reaches THIS APPLICATION is answered on every path
with 204 No Content and no Allow header, before routing and before
authentication. It is the CORS preflight handler, not a method-discovery
mechanism — do not read a 204 as “this path exists”, because an OPTIONS to
a path that does not exist answers 204 as well. To discover a path’s methods,
read this document plus the HEAD rule below; to confirm a path exists, make
the real request. (This is
the one place where a 405 would otherwise be the pattern —
DELETE /categories/{key} is documented precisely so its 405 is discoverable
from the spec.)
HEAD is served on every operation this document lists as GET, and
on no other method. It runs the GET handler and returns the identical status
and headers with no body — scopes, validation, 404s and quota headers all
behave exactly as they do for the GET — so it costs a rate-limit token like any
other request and is a cheap existence/freshness check rather than a free one.
It is deliberately absent from the operations in the API reference, because OpenAPI has no
head operation that would not duplicate every get verbatim; the
authority is the Allow header, which lists HEAD beside GET on every
path that has one. No other method is inferred: PUT, PATCH, POST
and DELETE exist only where they are written down, and anything else on a
known path is a 405.
A GENUINE preflight may never reach the application at all. A gateway that
answers OPTIONS itself — the reference deployment’s does, when Origin
and Access-Control-Request-Method arrive together — replies with its own
status, 200 there rather than this 204. That is the same gateway-owned
behaviour the CORS section describes, and the reason the status above is
scoped to what reaches the application: an OPTIONS carrying neither header,
or only one of them, is not a preflight and does reach it.
Versioning
Section titled “Versioning”This API is version 1: every response carries X-NT-API-Version: 1, and
every webhook delivery carries the same value as api_version. The
/functions/v1/ in the base URL is the hosting platform’s path segment for
its functions, not this API’s version.
Version 1 changes only additively: new fields and endpoints may appear at any
time, so build tolerant readers that ignore unknown members. A breaking change
would ship under a new API path, such as …/customer-data-api/v2, and be
announced in the changelog with a notice period. The one
exception already taken is the 1.1.0 scope realignment, made days after launch
while few keys existed, and recorded in the changelog with what each affected
key should do.
info.version in the OpenAPI document is the document’s own revision, not the
API version.