API errors and the error envelope

What the API error envelope looks like, how to handle it, and every error code the API returns.

Edit on GitHub
This page is generated from the error helpers in packages/engine, packages/auth and apps/server by pnpm generate. Do not edit it by hand; change the source and regenerate.

Every failure is the same envelope, with the HTTP status that matches the code:

{
  "success": false,
  "error": { "code": "ALREADY_IN_SEQUENCE", "message": "2 of the 142 contacts are already in a sequence. Nobody was enrolled. Remove them from the selection or exit them from their current sequence first.", "details": { "conflicts": [] } },
  "meta": { "request_id": "req_k3…" }
}

Messages are plain English and may change; code is stable, so branch on it. details is structured when there is something to act on (the conflicts of ALREADY_IN_SEQUENCE, the problems of INVALID_DEFINITION, the missing scopes of SCOPES_MISSING). The TypeScript SDK throws OpenSequenceError with status, code, message, details and requestId (the envelope's meta.request_id).

HTTP error codes

CodeHTTPMessageWhat to do
ALREADY_IN_SEQUENCE409… of the … contacts are already in a sequence. Nobody was enrolled. Remove them from the selection or exit them from their current sequence first.Remove the listed contacts (details.conflicts) from the selection, or exit them first with POST /v1/enrollments/\{id\}/exit. Nobody was enrolled.
BAD_FLAG422A flag is "global" or "channel:<name>".
BAD_OUTCOME422Give the outcome of the task, like "connected" or "no_answer".
BAD_SCOPE422Unknown scope: …. Use read, enroll or admin.
BAD_TAG422A tag is up to 24 letters, digits, dots and dashes, like v2.
BATCH_TOO_LARGE422At most … contacts per call.
CONFLICT409This owner already has a connection in another tenant.
CREDENTIAL_INVALID409The … credential was marked invalid by a health check. Register a new one.
CREDENTIALS_NEEDED409credentials_needed: connection … is …; set the channel again.
ENDPOINT_DISABLED409Enable the endpoint first; it is disabled.
FROM_REQUIRED422Say which address mail goes out from: set "from", or use the full mailbox address as the SMTP user.
HAS_ACTIVE_ENROLLMENTS409… contacts are still in this sequence. Exit them first, or send exit_active: true.Exit them first, or send exit_active: true to exit them with reason manual.
INSUFFICIENT_SCOPE403This key cannot do that; it needs the "…" scope.Use a key with the scope the route needs (read < enroll < admin).
INTERNAL_ERROR500Something went wrong on our side. Reference ….
INVALID_DEFINITION422The definition has errors; fix them before publishing. details.problems lists them.Fix every problem in details.problems (each has a path, a code and a sentence) and publish again. Saving a draft with errors is allowed; publishing is not.
INVALID_EVENT422The event is not valid: …
INVALID_SLUG422A slug is 3 to 48 lowercase letters, digits and dashes.
MISSING_SECRET422An api_key credential needs api_key.
NO_CONTACTS422Give at least one contact.
NO_PUBLISHED_VERSION409This sequence has no published version yet.Publish a version before enrolling.
NOT_ACTIVE409This enrollment is … (only active and waiting_limit enrollments can be paused).
NOT_FOUND404… "…" was not found. (Also: no route for this method and path.)
NOT_PAUSED409This enrollment is … (only paused and waiting_limit enrollments can be resumed).
NUMBER_HAS_NO_SMS422… cannot send SMS.
REQUEST_ERROR400, 413, 429A request-level error with its own message: malformed JSON (400), a body over 2 MB (413), or "Rate limit exceeded, retry in …" (429, 600 requests per minute per key, with a Retry-After header).
SENDER_DISABLED409… is disabled.
SEQUENCE_NOT_ACTIVE409The sequence is ….
SLUG_TAKEN409The slug "…" is already used.
STALE_LOCK409Someone else saved this draft after you loaded it. Reload and try again.Reload the version, re-apply your change on the new lock_version, save again.
TAG_TAKEN409Version … already exists.
UNAUTHORIZED401Send a project API key as a Bearer token. / This API key is unknown or revoked. / This endpoint needs the operator token.Send Authorization: Bearer \<key\>; the key must exist and not be revoked. /v1/admin/* wants the operator token instead.
UNKNOWN_CHANNEL422"…" is not a channel.
UNKNOWN_EVENT_TYPE422Unknown event type: …. Use "*" or one of ….Use "*" or the types listed by GET /v1/schema/events.
UNKNOWN_NUMBER422… is not a number the Allo key can see.
UNSAFE_URL422The endpoint URL ….Endpoint URLs must be https, carry no credentials, and resolve to a public address.
UNSUBSCRIBE_TOKEN_EXPIRED400This unsubscribe link has expired (links last 90 days). Ask the person to reply to the email instead, or report an opt_out with POST /v1/contacts/{id}/events.
UNSUBSCRIBE_TOKEN_INVALID400This unsubscribe token is not valid: it was not issued by this server for this project, it was altered, or its contact was deleted.
VALIDATION_ERROR400The request did not match the schema. details lists each path and message.
VERSION_NOT_EDITABLE409Version … is … and cannot be edited. Create a new version from it. (Also: only drafts can be deleted.)Published and archived versions are frozen. Create a new draft from it: POST /v1/sequences/\{id\}/versions with from_version.
VERSION_NOT_PUBLISHED409Version … is …; only a published version can enroll.

Validation problems

Returned by POST /v1/sequences:validate, PUT .../draft (as problems, saving is allowed) and POST .../publish (inside a 422 INVALID_DEFINITION). Each problem is { path, code, message, severity }. See Validation for the fix of each one.

CodeSeverityExample message
BAD_EVENTerrorThe event "…" is waited for but has no next step.
BAD_OPERATORerror"…" cannot be used on … (…). Use one of: ….
BAD_TEMPLATEerror"{{ … }}" is not something a template can read. Use contact., attrs., sender.*, sequence.name or unsubscribe_url.
BAD_VALUEerror"…" needs a value.
CYCLEerrorSteps … loop without a wait in between; the contact would never leave them.
HEAVY_EMAILwarningThis email embeds … KB of base64 images (more than … KB). Heavy emails land in spam and get clipped; host large images over https.
INVALID_DEFINITIONerrorThe definition is … MB; the limit is … MB. Host large images over https instead of embedding them.
MISSING_TRANSITIONerrorA … step must say where "…" goes.
NO_BRIEFwarningThis call turns on … but has no description. The agent only uses a skill when the description says when to.
NO_UNSUBSCRIBEwarningThis email has no {{ unsubscribe_url }}. Recipients cannot opt out with one click.
TOO_LONGwarningLinkedIn takes notes of up to … characters; this one is …. It will be cut.
UNKNOWN_ACTIONerror"…" is not an action of …. Available: ….
UNKNOWN_CHANNELerrorAn outreach step needs a channel.
UNKNOWN_FIELDerror"…" is not a field conditions can read.
UNKNOWN_NODEerrorThe entry node "…" does not exist.
UNKNOWN_NODE_TYPEerror"…" is not a node type. Available: ….
UNREACHABLE_NODEerror"…" can never be reached from the entry step.

On this page