API/Error handling

Error handling

Check the HTTP status before reading a response as a successful result. API errors return an error object containing a stable code and a human-readable message.

Example response (401 Unauthorized):

{
  "error": {
    "code": "unauthorized",
    "message": "authentication required"
  }
}

Use the code and status for application logic. Keep the message for diagnostics rather than matching its wording.

Status codes

StatusMeaningWhat to do
400Invalid input or node stateCheck request fields and the operation's state requirements.
401Authentication or scope mismatchCheck the API key and permissions.
402Account credit or billing prevents the operationResolve the account's credit or billing state.
404Node not foundCheck the identifiers and whether the node was deleted.
429Rate limit exceededWait for Retry-After before retrying.
500Unexpected server errorRecord the failure and reconcile the operation's outcome.
502Upstream request failedRetry reads with backoff; reconcile mutations first.
503A dependency or required service is unavailableRetry with backoff when the service recovers.

Malformed JSON or unsupported request content types may be rejected before the endpoint runs. Handle unexpected or non-JSON error bodies as well.

Retry carefully

Retry reads after transient failures using bounded exponential backoff. For 429 responses, follow the rate limiting guidance.

A timeout or connection error does not establish that a mutation failed. Check node state before repeating a lifecycle operation. After an interrupted create request, list nodes before creating another one. Node creation does not accept an idempotency key.

A 202 Accepted creation response means provisioning is still in progress. A successful update request also starts background work; inspect the node to determine the final outcome.

On this page