Skip to main content

API errors and status codes

How the Sandscale API reports errors and what to do for each status code.

S
Written by Sanjay Senthilkumar

A refused request answers with an HTTP status and a JSON body that names the reason in a stable code. Program against code; the message is for people and can change.

{
  "error": {
    "code": "lease_expired",
    "message": "the lease has ended",
    "request_id": "8f3c2a71-..."
  }
}

Quote the request_id (it matches the X-Request-ID header) when you contact support.

Status

Meaning

What to do

400

Malformed request or invalid field

Fix the request. Do not retry unchanged.

401

No valid credential

Check the key or refresh the token.

402

The account cannot take on new spend, or a quota is used up

Settle billing or raise the limit. Reads keep working.

403

Signed in, but not allowed (including elevation_required)

Ask an administrator, or do it from your own session in the console.

404

Does not exist, or you may not see it

Check the ID and the organization.

409

Conflicts with the current state

Read the current state, then decide. See ConflictError (409).

429

Too many requests or a quota is used up

Wait for Retry-After.

5xx

Something on our side is unavailable

Retry with backoff.

Retrying safely

  • Retry 429 after Retry-After, and 502, 503 and 504 with exponential backoff and jitter.

  • Do not retry 400, 401, 403, 404, 409, 410 or 422 unchanged.

  • After a timeout on a call that creates something, list what exists before you create it again.

Did this answer your question?