Error handling

GraphQL error format and error codes

Error handling

The API uses standard GraphQL error responses. Errors are returned in the errors array alongside any partial data.

Error response shape

{
  "data": null,
  "errors": [
    {
      "message": "authentication required for this mutation",
      "path": ["createSecondaryMarketOrder"],
      "extensions": {
        "Code": "IAM_UNAUTHENTICATED",
        "Expected": true
      }
    }
  ]
}
FieldDescription
messageHuman-readable error description
pathGraphQL field path where the error occurred
extensions.CodeMachine-readable error code
extensions.Expectedtrue if this is an anticipated business error (not a server bug)

Common error codes

CodeMeaning
IAM_UNAUTHENTICATEDMissing or invalid authentication token
IAM_INVALID_CREDENTIALSAPI key not found, revoked, or secret mismatch
IAM_FORBIDDENAuthenticated but lacking required permissions
EVENT_RATE_LIMIT_EXCEEDEDMutation rate limit exceeded (see Rate limits)
EVENT_DISABLEDThe requested operation is temporarily disabled
UNEXPECTED_ERRORInternal server error

Permission errors

When a permission check fails, the error extensions include additional context:

{
  "message": "permission denied",
  "extensions": {
    "Code": "IAM_FORBIDDEN",
    "Expected": true,
    "PermissionName": "account.read",
    "PermissionScope": "ACCOUNT"
  }
}

Handling errors in your integration

  1. Always check the errors array, even when HTTP status is 200.
  2. Use extensions.Code for programmatic error handling — do not parse message strings.
  3. Retry only on transient errors (UNEXPECTED_ERROR). Do not retry authentication or permission errors without fixing the underlying issue.
  4. Use idempotency keys when retrying mutations to avoid duplicate side effects.

Partial errors

GraphQL can return partial data when some fields fail and others succeed. Check both data and errors in every response.

{
  "data": {
    "account": { "id": "account|abc", "status": "ACTIVE" },
    "linkedUsers": null
  },
  "errors": [
    {
      "message": "permission denied",
      "path": ["account", "linkedUsers"],
      "extensions": { "Code": "IAM_FORBIDDEN", "Expected": true }
    }
  ]
}

HTTP status codes

StatusMeaning
200Request processed (check errors array for GraphQL-level errors)
400Malformed request (invalid JSON, missing query)
405Wrong HTTP method (only POST is supported)

Did this page help you?