Overview

Errors & Rate Limits

Error codes, rate limits, and how to handle API errors

HTTP Status Codes#

StatusMeaningCommon Cause
200SuccessRequest completed successfully
400Bad RequestThe operation refused a value, such as an amount out of range
401UnauthorizedMissing, invalid, revoked or expired API token, or no seat with the x-role-type role
403ForbiddenValid token, but the role can't run this operation or reach this record
404Not FoundOperation name is unknown, or a record the request names doesn't exist
405Method Not AllowedThe HTTP method isn't used by any operation (only GET, POST, PUT and DELETE are)
409ConflictThe record already exists or is in a state that blocks the change
429Too Many RequestsRate limit exceeded
500Internal Server ErrorA request body that fails schema validation, other refusals without their own status, or an unexpected server error

Response Format#

A successful call returns 200 with the result in data:

{
  "data": { "grantID": "550e8400-e29b-41d4-a716-446655440000" },
  "error": null
}

Errors come in two shapes, so check for both.

Errors from the operation itself (validation, permissions, missing records) put the message in error.message, with the status from the table above:

{
  "error": {
    "message": "Recipient not found"
  }
}

Errors before the operation runs (token, unknown operation, wrong method, rate limit) return error as a plain string:

{
  "error": "Invalid token or insufficient permissions"
}

There is no details field.

Common Errors#

Authentication Errors (401)#

// No token
{ "error": "Token is required" }

// Unknown, revoked or expired token, missing or unknown x-role-type,
// or no seat with that role. The reason isn't returned.
{ "error": "Invalid token or insufficient permissions" }

Authorization Errors (403)#

// The role can't run this operation
{ "error": { "message": "You do not have permission to perform this operation" } }

// orgID in the body isn't your token's organization
{ "error": { "message": "You do not have permission to access this organization" } }

Validation Errors (400 and 500)#

A value the operation checks itself returns 400:

{
  "error": {
    "message": "The grant amount must be at least 0.000001 tokens and below 100 trillion."
  }
}

A body that fails the operation's schema (a missing required field, a wrong type, an unknown field) currently returns 500. The message is the list of problems as JSON text:

{
  "error": {
    "message": "[\n  {\n    \"expected\": \"string\",\n    \"code\": \"invalid_type\",\n    \"path\": [\n      \"grantDescription\"\n    ],\n    \"message\": \"Invalid input: expected string, received undefined\"\n  }\n]"
  }
}

Not Found (404)#

// Unknown operation, or one that can't be called with an API token
{ "error": "No external API operation found for unknownEndpoint" }

// A record the request names doesn't exist
{ "error": { "message": "Recipient not found" } }

Wrong Method (405)#

{ "error": "Method PATCH not allowed" }

An operation called with a method it isn't registered for (for example GET listGrants sent as POST) returns 404, not 405.

Rate Limiting#

By default, the API allows:

  • 300 requests a minute for the seat your token acts as
  • 600 requests a minute for your IP address
  • 200 requests a second from one IP address to one server

When rate limited, you'll receive a 429 with a Retry-After header (in seconds):

// 429 Too Many Requests
{
  "error": "Too Many Requests"
}

Handling Rate Limits#

  • Wait for the Retry-After seconds, then retry with exponential backoff
  • Batch operations where possible (e.g., use terminateEmployeeGrants instead of multiple individual calls)
  • Cache responses that don't change frequently (e.g., listGrantConfigurations, getTokenTypes)

Best Practices#

  1. Always check the status code before parsing the response body
  2. Read both error shapes — error.message for operation errors, error as a string for the rest
  3. Retry 429 after the Retry-After seconds, with exponential backoff
  4. Retry a 500 carefully. A 500 can be either shape: an unexpected server failure usually comes back as {"error": {"message"}}, the same shape as a request that failed validation. Retry a GET a few times with backoff. Before retrying a write, check whether it already took effect (for example with listGrants), and stop retrying when the same error.message comes back, because the request itself needs fixing
  5. Don't retry 400, 401, 403, 404 or 409 errors — fix the request first
  6. Refresh tokens before they expire — a 401 doesn't say why it was refused, so track expiresAt and call refreshUserApiToken in time
Was this page helpful? Suggest edits