Errors
Every error is the same JSON object with an appropriate HTTP status code.error.code is stable and meant for your code; error.message is for people; error.param names the parameter when the error is about one, else it is null.
type follows from the status: invalid_request_error (400, 404, 405, 409, 413, 415, 422), authentication_error (401), permission_error (403), rate_limit_error (429) and api_error (5xx). A 500 says only to quote request_id.
error used to be a plain string; that text is now error.message. The older top-level code, field and details are still sent where a route sent them, and are deprecated.
Every code, with its status and what it means, is in the error reference.
Lists and cursors
Every route that returns a collection answers the list object:- Lists take
limit; the default and maximum are per route (often 1 to 200, default 50) and are in the API reference. - Send
next_cursorback ascursorwith the same filters untilhas_moreis false.has_moreis exact, andnext_cursorisnullon the last page. Nothing is cut off silently. - An unknown query parameter is a
400(parameter_unknown). A value outside what the route takes (alimitabove its maximum, for example) is a400whoseerror.paramnames the parameter; it is never replaced by a default. - A cursor from another route or other filters is a
400(cursor_invalid), never page one of something else. - The field each route used before (
alerts,recommendations,itemsand so on) and theoffsetandpageparameters still work and are deprecated: readdataand page withcursor.
Rate-limit headers
Every authenticated answer carries:
A key has 120 requests per minute and its daily limit; see Authentication. Past the daily AI budget, a route that has an answer without AI gives that answer; a route whose answer is the AI’s answers
429 model_budget_exceeded, with Retry-After at 00:00 UTC.
Idempotency-Key
Send anIdempotency-Key header (1 to 128 visible ASCII characters, a UUID for example) on any POST that creates or changes something. Keys are scoped to your organization and kept for 24 hours, and a key belongs to the route and the exact bytes of the body it was first sent with: re-send the same bytes, not a re-serialized copy.
Routes whose answer must not be kept, such as the ones that show a secret once, are not replayed.
POST /v1/ingest/records follows the same rules with its own details: a finished push is replayed with replayed: true and its original_request_id, and a push still marked in progress more than 10 minutes after it started is processed again. See Data ingestion.
Request ids
Every answer carries our id for the request in theX-Request-ID header and in request_id of the body. Quote it when you ask about a request.
Send your own id as the X-Request-ID request header (1 to 128 visible characters) and it is kept beside ours, echoed back as X-Client-Request-ID, and searchable in the request log.
Every answer to a test key also carries X-InsightChain-Sandbox: true.
Methods and bodies
GET never changes anything. A known path asked with a method it does not take is a 405, and the Allow header lists the ones it takes. A body larger than the route’s limit is a 413, and a Content-Type the route does not read is a 415.
Timestamps are RFC 3339 in UTC; dates are YYYY-MM-DD. Input and output are snake_case.