Skip to main content

Errors

Every failure returns a JSON body in one common format and a meaningful HTTP status code. Branch on the status code and on error.code; use error.message for display and logging.

The error envelope​

Every endpoint — including POST /v1/auth/token — returns the same shape for every 4xx and 5xx response:

{
"success": false,
"error": {
"status": 400,
"code": "VALIDATION_ERROR",
"message": "One or more fields are invalid. See 'details' for more information.",
"details": [{ "field": "teamIds", "message": "Team IDs must be valid GUIDs" }],
"traceId": "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01",
"timestamp": "2026-11-16T09:00:00Z"
}
}
FieldNotes
successAlways false for an error
error.statusSame value as the HTTP status code
error.codeStable, machine-readable UPPER_SNAKE_CASE code. Branch on this
error.messageHuman-readable and safe to show. Do not parse — wording may change
error.detailsField-level validation errors. Omitted when there are none
error.traceIdQuote it when contacting support
error.timestampWhen the error occurred (UTC, ISO 8601)

Common error codes​

CodeStatusMeaning
VALIDATION_ERROR400A field is missing or invalid — see details
INVALID_JSON400The body is not valid JSON
BUSINESS_RULE_VIOLATION400The request is valid but a business rule rejected it
INVALID_CLIENT401Wrong client ID or secret
TOKEN_MISSING401No bearer token was sent
TOKEN_EXPIRED401The token has expired — get a new one
TOKEN_INVALID401The token is malformed or its signature is invalid
INSUFFICIENT_SCOPE403The token lacks the scope this endpoint requires
SENDER_INVALID403X-Sender-Id is missing, unknown, inactive or not in your organization
FORBIDDEN403The sender is not allowed to perform this operation on this resource
NOT_FOUND404The resource does not exist or is not visible to your organization
CONFLICT409The resource is not in a state that allows this operation
UNSUPPORTED_MEDIA_TYPE415Wrong Content-Type
CLIENT_LOCKED_OUT429Too many failed authentication attempts
RATE_LIMITED429Too many requests
INTERNAL_ERROR500Unexpected server error
SERVICE_UNAVAILABLE503A dependency is unavailable

Status codes​

StatusMeaningRetry?
200Success—
201Created—
400Malformed request, a missing required field, or a business ruleNo — fix the request
401Token missing, expired or invalidYes — get a new token, retry once
403Missing scope, invalid sender, or the sender lacks permissionNo — see Scopes
404Resource not found, or not visible to your organizationNo
409The resource's current state does not allow the operationNo — check its state first
429Locked out or rate limitedYes — after waiting
500Unexpected server errorYes — with backoff
503A dependency is unavailableYes — with backoff

On 404​

A file that exists but belongs to another organization — or that your sender is not allowed to see — returns 404, not 403. The cases are deliberately indistinguishable so the API cannot be used to discover whether an identifier exists elsewhere in the system.

On 401 versus 403​

This is the distinction most worth getting right:

  • 401 — we do not know who you are. A new token usually fixes it.
  • 403 — we know exactly who you are, and you are not allowed. Retrying never helps; the credential needs a scope added, or the sender needs the permission.

Handling errors well​

Retry only what is retryable. 401 (once, after refreshing), 429 (after waiting), 500 and 503 (with exponential backoff). Never retry 400, 403, 404 or 409 — the outcome will not change.

Cap your retries. One retry after a 401 is sufficient. More than that turns an expired credential into a request storm and can trigger a lockout.

Log the traceId. It identifies the request in our logs and is the fastest way to resolve a support case.

Do not branch on message. It is written for humans and may be reworded at any time. Branch on the status code and error.code.

Example​

async function callApi(url, token, senderId) {
const res = await fetch(url, {
headers: { Authorization: `Bearer ${token}`, 'X-Sender-Id': senderId },
});

if (res.ok) return res.json();

const { error } = await res.json();

switch (res.status) {
case 401:
throw new AuthError('Token rejected — refresh and retry once', error);
case 403:
// Not retryable: missing scope or the sender lacks the permission.
throw new ForbiddenError(error.code, error);
case 404:
return null;
case 429:
throw new RetryLaterError('Locked out or rate limited', error);
case 500:
case 503:
throw new TransientError(`Server error ${res.status}`, error);
default:
throw new ApiError(error.code, error);
}
}