Response formats depend on the endpoint
Integration APIs retain several compatible error formats. Anerror value can be a string or an object; a machine-readable code may be at the top level or inside that object. Do not require type, code, or request_id on every error.
The examples below describe gateway-generated Integration API errors. OpenAI-compatible and Anthropic-compatible endpoints have their own protocol shapes. Ordinary Provider responses can preserve the upstream status, body, and content type, including non-JSON errors. Check the HTTP status and content type before parsing a response.
For support, retain X-Request-ID when returned, and request_id when present in the body. Their presence and location depend on the error path; the examples do not promise that every rejection includes both.
Six diagnostic categories
A
503 does not by itself identify an upstream failure. A 404 can refer to a route or an upstream resource; authentication can run before route lookup, so a missing credential is not proof that a route is absent. 403, 422, and 429 remain endpoint-specific: do not assume a universal code list or rate-limit headers. Honor Retry-After when it is actually returned.
Missing credentials can follow different paths
ForGET /apis/v1/similarweb/website/traffic-engagement, the following responses have been observed with otherwise valid request parameters:
For this path, a
404 without credentials does not establish that the endpoint is absent. Supply the AISA credential before diagnosing route availability, and distinguish quote mode from execution. These observations do not promise the same authentication status or error layout for every endpoint.
Documentation and sales-source availability
The Website’s contract and sales-data endpoints report source availability separately from Integration API execution errors. To inspect a published contract, readhttps://aisa.one/api/contracts/version. Its contentHash identifies the OpenAPI bytes and docsRevision identifies the immutable Docs input. Request /api/contracts/source?hash=<contentHash>&bundled=1 for those bytes, or /api/contracts/source?hash=<contentHash>&operation_id=<operationId> for one operation. A mismatched hash returns 409; unavailable verified bundled content can return 503. Check the response’s X-AISA-Contract-Hash and X-AISA-Docs-Revision against the selected version. mode: formal describes the bundled declarations; it does not establish that dynamic prices, availability, or every consumer are fresh.
A definition marked pending remains incomplete. Do not invent missing request fields or treat an unavailable request definition as a ready-to-call contract. A pending response definition remains unknown even when the existing endpoint can be called.
The sales JSON endpoint /api/sales-api-data can return HTTP 503 with freshness: unavailable and reason_code: verified_sales_source_unavailable when it cannot acquire a verified sales snapshot. This response is a documentation/source-availability result; it is not evidence that a Provider request was executed, authentication failed, or a charge settled. Retain a previously verified snapshot only with its original observation time and an explicit stale state; never relabel a static snapshot as fresh. Recheck the source and release identities before treating recovery as current data.
Observed gateway examples
These examples preserve the actual error shapes. The request ID is illustrative.Authentication: API key
HTTP401
Parameters: native request
HTTP400
Budget: estimate exceeds cap
HTTP402
Idempotency: completed request
HTTP409
Idempotency: Similarweb compatibility
HTTP409
Upstream: native transport failure
HTTP502
Upstream: managed transport failure
HTTP503
Dependency: billing timeout
HTTP503; X-Request-ID: example-request-id
Configuration: invalid billing configuration
HTTP503
error with code and message, rather than the top-level authentication layout above. Validation failures for a supplied API key also return request_id; rejection when credentials are missing can omit it. Preserve an ID when returned, without requiring one on every quote rejection. Consult the endpoint’s quote contract when handling that mode.
For reported charges, see Settled call cost; an error or missing cost header does not establish zero debit.
Retry guidance
- Fix credentials, parameters, and budget limits before retrying the corresponding rejection.
- A
retryablehint does not guarantee that execution had no side effects, that the retry is free, or that an endpoint supports idempotency. Even repeated GET or chat requests can incur charges. - On
409, inspect the original operation and follow that endpoint’s idempotency rules. Keep the same key and payload when those rules require it; changing the key can create a second operation. - For a transient failure, first establish that repetition is safe. Respect an available
Retry-After; otherwise use bounded exponential backoff with jitter. Do not blindly replay an ambiguous Provider create or a billed call. - A persistent configuration error needs operator investigation, not an unbounded retry loop. Preserve the original status and response when a Provider error does not match these examples.