API basics

Errors

Errors are JSON with a detail field; some also carry a machine-readable code.

Error shapes

ShapeReturned for
{"detail": "<message>"}Most errors
{"detail": {"code": "<CODE>", "message": "<message>", …}}Named errors raised inside a feature, listed in Named codes; message can be absent
{"detail": "<message>", "code": "<CODE>", …}429, 428, app errors, and 402 QUOTA_EXCEEDED / FEATURE_NOT_AVAILABLE, with extra fields at the top level. 402 PAYMENT_FAILED uses the nested shape
{"detail": [{"type", "loc", "msg", "input", …}]}422 request validation

Examples, recorded from the API:

{"detail": "User not found"}
{"detail": {"code": "USER_IN_OTHER_ORGANIZATION"}}
{
  "detail": [
    {
      "type": "value_error",
      "loc": ["body", "email"],
      "msg": "value is not a valid email address: An email address must have an @-sign.",
      "input": "not-an-email",
      "ctx": {"reason": "An email address must have an @-sign."}
    }
  ]
}

Status codes

StatusMeaning
400The request is not valid in its current state, for example Missing X-Space-Slug header or This invite has expired
401No valid credential: Valid API key or Bearer token required
402A plan limit or a payment problem: QUOTA_EXCEEDED, FEATURE_NOT_AVAILABLE, PAYMENT_FAILED
403The credential is valid but not allowed here: wrong workspace for the key, no membership, or a missing permission
404The resource does not exist or is not visible to the caller
409A conflict with the current state, such as an existing member or a named code below
422The body or parameters failed validation, or a referenced item is unusable
428A connection needs the caller to sign in to it first: PER_USER_AUTH_REQUIRED
429Too many requests: REQUEST_RATE_LIMITED; see Rate limits
502An upstream service failed; nothing was changed or charged

Errors with top-level fields

StatuscodeExtra fields
429REQUEST_RATE_LIMITEDlimit_name, limit, window_secs, retry_after; headers Retry-After, RateLimit, RateLimit-Policy
402QUOTA_EXCEEDED or FEATURE_NOT_AVAILABLEquota_type, metric, limit and used (strings)
428PER_USER_AUTH_REQUIREDreason, connector_key, connection_id
401APP_VIEWER_IDENTITY_REQUIREDapp_id
403CONNECTION_NOT_DECLAREDapp_id, connection_id, kind (the app did not declare that connection)
403NO_ACCESSconnection_id, reason (the viewer cannot use that connection)

Named codes

codeStatusMeaning
MODEL_NOT_ALLOWED403The model is not available on your plan
MODEL_NOT_AVAILABLE_IN_WORKSPACE403The model is not enabled in this workspace
SANDBOX_BUSY409The chat or app is still working on an earlier message; carries run_id
MODEL_PRICE_MISSING422A model cannot be enabled without a price (platform admins)
TEMPLATE_NOT_AVAILABLE422The selected ontology template is unavailable
USER_IN_OTHER_ORGANIZATION409An organization plan cannot be bought: your home organization is one you are not an admin of
LAST_ORGANIZATION_ADMIN409An organization must keep at least one admin
HOME_SWITCH_REQUIRED409Accepting a home invite would replace your home organization, named in organization_name; repeat with switch_home: true
HOME_ORGANIZATION_CONTAINED409Your home organization, named in organization_name, does not let its members join other organizations
EXTERNAL_MEMBER409An external member cannot get a seat or plan; only their home organization gives one
OUTSIDE_ORGANIZATION409The person's home organization does not let its members join workspaces outside it
ORGANIZATION_ROLE_EXISTS409An organization role with this name already exists, or the name is admin or member
BUILT_IN_ORGANIZATION_ROLE409The admin and member organization roles cannot be deleted
ORGANIZATION_ROLE_IN_USE409The organization role is the default for new members, or a member or pending invite holds it
SEAT_REQUIRED_FOR_PERSONAL_PAYER409The user pays for a personal plan; add them with a seat
PERSONAL_SUBSCRIPTION_ACTIVE409Cancel the personal plan before joining an organization
PLAN_SWITCH_REQUIRED409Joining ends the personal plan; repeat with replace_personal_plan: true
PLAN_SWITCH_FAILED502The personal plan could not be ended; nothing was charged
STRIPE_MANAGED409The plan is billed through Stripe; change it there
USER_DISABLED409A disabled user cannot be given a plan or a seat
ORGANIZATION_ENDING409The organization's plan is ending; seats cannot be assigned
IN_ORGANIZATION409The user's organization handles their plan
ACTIVE_SUBSCRIPTION409The plan changed meanwhile; reload and try again
ALREADY_ON_PLAN409The user is already on this plan
PAYMENT_FAILED402The payment provider refused the payment
COMPANY_DETAILS_REQUIRED422A business plan needs the company email, address and VAT ID
INVALID_TAX_ID422The VAT ID was rejected
INVALID_ADDRESS422The address cannot be used for billing
CHECKOUT_FAILED502Checkout could not be opened; nothing was charged
PLAN_UPDATE_FAILED502The plan could not be updated

Treat any other code as its status code says; new codes can be added.

On this page