Getting Started
Errors

Errors

All errors follow a consistent JSON format.

Error format

{
  "success": false,
  "message": "A human-readable description of what went wrong"
}

Validation errors include additional fields:

{
  "success": false,
  "message": "Validation failed",
  "errors": {
    "email": "email required",
    "amount": "must be positive"
  }
}

HTTP status codes

CodeMeaningTypical cause
200OKSuccessful GET or PATCH
201CreatedSuccessful POST that created a resource
400Bad RequestMissing required parameter, invalid JSON, business rule violated
401UnauthorizedMissing or invalid API key
403ForbiddenKey valid but missing required scope
404Not FoundResource doesn't exist or isn't in your tenant
409ConflictDuplicate (e.g. email already exists)
429Too Many RequestsRate limit exceeded — check Retry-After header
500Internal Server ErrorUnexpected server error — contact support

Common error messages

MessageWhat to do
API key requiredSend Authorization: Bearer spk_... header
Invalid or expired API keyKey is revoked, expired, or typo'd — check and regenerate
Missing required scope: XKey doesn't have the scope needed for this endpoint
Hourly rate limit exceededWait and retry; consider upgrading tier
Cart not foundCart ID doesn't exist or expired
Order is not eligible for returnOrder must be in shipped or delivered status

Retry strategy

  • Idempotent operations (GET, PATCH) can be retried on 5xx or network errors
  • Non-idempotent operations (POST) should NOT be retried blindly — you may create duplicates. Check the resource first, or use idempotency keys (coming soon).
  • Use exponential backoff: wait 1s, 2s, 4s, 8s, etc.
  • Give up after ~5 attempts — if the API is down longer than that, your own system should handle the degradation.