# Error codes

> Every non-2xx Humanless response has the body `{ "error": { "code", "message", "details"? } }`. The `code` is stable and machine-readable, and each one has its own anchor on this page (`https://usehumanless.com/docs/errors#<code>`). The MCP server returns the same codes as `isError` tool results with the next action appended. `408 timeout` is not a failure: no message arrived yet, so call wait again.

Use Humanless only for applications you own or are authorized to test. Do not use it to create accounts on, or bypass verification of, third-party services.

## Summary

| Status | Code | Retry? |
|---|---|---|
| 400 | [`invalid_request`](#invalid_request) | After fixing the request. |
| 400 | [`invalid_json`](#invalid_json) | After fixing the body. |
| 400 | [`invalid_domain`](#invalid_domain) | After removing or fixing `domain`. |
| 401 | [`unauthorized`](#unauthorized) | No, not with the same key. |
| 402 | [`payment_required`](#payment_required) | Not for SMS. Retry with email or TOTP. |
| 402 | [`credits_exhausted`](#credits_exhausted) | No. Retrying will not help until the owner tops up. |
| 402 | [`sms_quota_exceeded`](#sms_quota_exceeded) | Not for SMS until the owner tops up, upgrades or you delete open SMS identities. |
| 404 | [`not_found`](#not_found) | No, not with the same id. |
| 404 | [`route_not_found`](#route_not_found) | No. |
| 408 | [`timeout`](#timeout) | Yes, immediately. |
| 409 | [`channel_not_enabled`](#channel_not_enabled) | No, not on this identity. |
| 409 | [`all_numbers_busy`](#all_numbers_busy) | Yes, after deleting finished SMS identities (plus about 30 s cooldown). |
| 410 | [`identity_ended`](#identity_ended) | No. Create a new identity. |
| 429 | [`rate_limited`](#rate_limited) | Yes, after `Retry-After` seconds. |
| 429 | [`sms_limit_reached`](#sms_limit_reached) | After `Retry-After` seconds, or use email now. |
| 500 | [`internal_error`](#internal_error) | Once. |
| 503 | [`phone_pool_exhausted`](#phone_pool_exhausted) | After `Retry-After` seconds, or use email now. |
| 503 | [`numbers_provisioning`](#numbers_provisioning) | After `Retry-After` seconds. |
| 503 | [`email_domain_not_configured`](#email_domain_not_configured) | No. |

Headers: `Retry-After` (seconds) on 429 and on 503 `numbers_provisioning` / `phone_pool_exhausted`. Every authenticated response carries `X-RateLimit-Limit` and `X-RateLimit-Remaining`; per-key 429s add `X-RateLimit-Reset`.

Machine-readable: the `ErrorCode` schema in [openapi.json](https://usehumanless.com/openapi.json) lists every code, and its `x-error-catalog` extension carries the status, next action and doc URL for each.

## invalid_request {#invalid_request}

**HTTP 400** · Invalid request

A body field or query parameter failed validation (unknown channel, more than 3 channels, ttl_seconds out of range, `domain` without the email channel, timeout above 60, and so on). The message names the field.

**Next action:** Fix the arguments and call the tool again.

**Retry:** After fixing the request.

```json
{
  "error": {
    "code": "invalid_request",
    "message": "channels.0: Invalid option: expected one of \"email\"|\"sms\"|\"totp\""
  }
}
```

## invalid_json {#invalid_json}

**HTTP 400** · Invalid JSON body

The request body is not valid JSON. An empty body is fine and is treated as `{}`.

**Next action:** Send a valid JSON body with `Content-Type: application/json` (or an empty body to use the defaults), then retry.

**Retry:** After fixing the body.

```json
{
  "error": {
    "code": "invalid_json",
    "message": "Request body must be valid JSON"
  }
}
```

## invalid_domain {#invalid_domain}

**HTTP 400** · Invalid email domain

`domain` is neither a platform domain nor a verified custom domain on this account.

**Next action:** Omit `domain` to use the default domain, or pass a verified domain on this account.

**Retry:** After removing or fixing `domain`.

```json
{
  "error": {
    "code": "invalid_domain",
    "message": "Domain \"example.org\" is not a verified domain on this account or a platform domain"
  }
}
```

## unauthorized {#unauthorized}

**HTTP 401** · Missing or invalid API key

No `Authorization: Bearer` header, or the key is unknown or revoked. The MCP endpoint (`/mcp`) returns the same error.

**Next action:** Send `Authorization: Bearer hl_live_...` with a valid key. Read it from the HUMANLESS_API_KEY environment variable; if it is missing, ask the user to create a key at https://api.usehumanless.com/app and set HUMANLESS_API_KEY. Never invent or hard-code a key.

**Retry:** No, not with the same key.

```json
{
  "error": {
    "code": "unauthorized",
    "message": "Missing or invalid API key. Send `Authorization: Bearer hl_live_...`."
  }
}
```

## payment_required {#payment_required}

**HTTP 402** · SMS not available

The request asked for the `sms` channel, which this account can't use. SMS is coming soon (carrier onboarding is pending): join the waitlist with `POST /v1/waitlist` or at https://usehumanless.com/#sms-waitlist (`details.sms_waitlist_url`). Email and TOTP identities are unaffected.

**Next action:** SMS identities aren't available on this account (SMS numbers may still be coming soon: see error.details.sms_waitlist_url). Retry with channels ["email"] or ["totp"], or ask the account owner.

**Retry:** Not for SMS. Retry with email or TOTP.

**`error.details`:** `credit_balance_cents`, `open_sms_identities`, `sms_unit_cents`, `billing_url`, `sms_waitlist_url`

```json
{
  "error": {
    "code": "payment_required",
    "message": "SMS identities aren't available yet: SMS numbers are coming soon. Use email or TOTP identities meanwhile. SMS numbers are coming soon — join the waitlist at https://usehumanless.com/#sms-waitlist (or POST /v1/waitlist)."
  }
}
```

## credits_exhausted {#credits_exhausted}

**HTTP 402** · No credits left

The account's credit balance can't pay for another identity ($0.01 each). Nothing was created or charged.

**Next action:** This account has no credits left to pay for new identities. Do not retry: ask the account owner to top up credits (from $20, one-off) at error.details.billing_url. Existing identities keep working.

**Retry:** No. Retrying will not help until the owner tops up.

**`error.details`:** `credit_balance_cents`, `identity_price_cents`, `billing_url`

```json
{
  "error": {
    "code": "credits_exhausted",
    "message": "The credit balance ($0.00) can't pay for another identity ($0.01 each). Top up credits (from $20) at https://api.usehumanless.com/app/billing."
  }
}
```

## sms_quota_exceeded {#sms_quota_exceeded}

**HTTP 402** · SMS quota or credits exhausted

New SMS identities are refused: the included SMS are used up (or the account is pay-as-you-go) and the credit balance can't cover one SMS for every open SMS identity (plus a number period when a pay-as-you-go account holds no number). Existing SMS identities keep receiving.

**Next action:** This account's SMS quota is used up and its credits can't pay for more SMS. Do not retry SMS: use channels ["email"] or ["totp"], or ask the account owner to top up credits (error.details.billing_url). Existing SMS identities keep receiving messages.

**Retry:** Not for SMS until the owner tops up, upgrades or you delete open SMS identities.

**`error.details`:** `credit_balance_cents`, `open_sms_identities`, `sms_used`, `sms_included`, `sms_unit_cents`, `required_cents`, `period_end`, `billing_url`, `sms_waitlist_url`

```json
{
  "error": {
    "code": "sms_quota_exceeded",
    "message": "SMS quota exhausted: 500/500 included SMS used this period (resets 2027-01-01T00:00:00.000Z) and the credit balance ($0.00) is below $0.08 ($0.08 per extra SMS for each open SMS identity). Top up credits, end unused SMS identities, or upgrade at https://api.usehumanless.com/app/billing."
  }
}
```

## not_found {#not_found}

**HTTP 404** · Identity not found

The identity_id is malformed (not a UUID), unknown, or belongs to another account.

**Next action:** Check the identity_id (it must come from create_verification_identity with the same API key).

**Retry:** No, not with the same id.

```json
{
  "error": {
    "code": "not_found",
    "message": "Identity not found"
  }
}
```

## route_not_found {#route_not_found}

**HTTP 404** · No such API route

The path or method does not exist under `/v1` (checked after authentication).

**Next action:** Use one of the documented routes: POST /v1/identities, GET /v1/identities/{id}, GET /v1/identities/{id}/wait, GET /v1/identities/{id}/totp, DELETE /v1/identities/{id}. The full description is at https://usehumanless.com/openapi.json.

**Retry:** No.

```json
{
  "error": {
    "code": "route_not_found",
    "message": "No such API route"
  }
}
```

## timeout {#timeout}

**HTTP 408** · No message yet (call again)

Normal outcome of a long-poll: no matching message arrived within `timeout` seconds. Nothing is wrong. Over SSE it arrives as a `timeout` event instead of a 408.

**Next action:** Nothing is wrong yet: make sure the form was submitted, then call wait again with the same identity_id (and the same `since`). Do not sleep between calls; the wait is push-based.

**Retry:** Yes, immediately.

```json
{
  "error": {
    "code": "timeout",
    "message": "No matching message arrived before the timeout"
  }
}
```

## channel_not_enabled {#channel_not_enabled}

**HTTP 409** · Channel not enabled

The identity was not created with the channel you asked for: `channel=sms` or `channel=email` on wait, or `/totp` on an identity without the `totp` channel.

**Next action:** This identity does not have that channel. Use channel "any", or create a new identity that includes it.

**Retry:** No, not on this identity.

```json
{
  "error": {
    "code": "channel_not_enabled",
    "message": "This identity was not created with the totp channel"
  }
}
```

## all_numbers_busy {#all_numbers_busy}

**HTTP 409** · All SMS numbers busy

Every dedicated SMS number on the account is held by a live SMS identity or is in its short (about 30 s) cooldown.

**Next action:** Every one of this account's dedicated SMS numbers is held by an active identity. Call delete_verification_identity on identities you have finished with (or wait for them to expire), then retry; or ask the account owner to upgrade for more numbers.

**Retry:** Yes, after deleting finished SMS identities (plus about 30 s cooldown).

```json
{
  "error": {
    "code": "all_numbers_busy",
    "message": "All 1 of this account's SMS numbers are in use by active identities (or cooling down for a few seconds). Delete identities you no longer need (DELETE /v1/identities/:id), or upgrade the plan for more numbers."
  }
}
```

## identity_ended {#identity_ended}

**HTTP 410** · Identity deleted or expired

The identity was deleted or passed its `expires_at`. Waits and TOTP reads are refused; GET still returns it with its `status`.

**Next action:** This identity was deleted or expired. Call create_verification_identity to get a new one.

**Retry:** No. Create a new identity.

```json
{
  "error": {
    "code": "identity_ended",
    "message": "Identity has expired"
  }
}
```

## rate_limited {#rate_limited}

**HTTP 429** · Rate limited

Per-key request limit (per minute) or per-account identity-creation limit (per hour) exceeded. `Retry-After` and `X-RateLimit-Reset` give the wait in seconds.

**Next action:** Too many requests. Wait for the retry-after period, then try again.

**Retry:** Yes, after `Retry-After` seconds.

```json
{
  "error": {
    "code": "rate_limited",
    "message": "API rate limit exceeded for this key"
  }
}
```

## sms_limit_reached {#sms_limit_reached}

**HTTP 429** · Daily SMS identity limit

The account created its daily maximum of SMS identities (100 pay-as-you-go, 200 Builder, 1,000 Pro).

**Next action:** Daily SMS identity limit reached. Use an email identity, or try again tomorrow.

**Retry:** After `Retry-After` seconds, or use email now.

```json
{
  "error": {
    "code": "sms_limit_reached",
    "message": "Daily SMS identity limit reached for this account"
  }
}
```

## internal_error {#internal_error}

**HTTP 500** · Internal error

Unexpected server error. The message is deliberately generic.

**Next action:** Retry once after a short pause. If it persists, stop and tell the user (status: hello@usehumanless.com).

**Retry:** Once.

```json
{
  "error": {
    "code": "internal_error",
    "message": "Internal server error"
  }
}
```

## phone_pool_exhausted {#phone_pool_exhausted}

**HTTP 503** · No phone numbers available

No phone number could be assigned right now. Sent with `Retry-After: 60`.

**Next action:** No phone numbers are free right now. Retry later or use an email identity.

**Retry:** After `Retry-After` seconds, or use email now.

```json
{
  "error": {
    "code": "phone_pool_exhausted",
    "message": "No phone numbers available to lease; try again shortly"
  }
}
```

## numbers_provisioning {#numbers_provisioning}

**HTTP 503** · SMS numbers being provisioned

The account just became SMS-enabled and its dedicated numbers are still being assigned. Sent with `Retry-After: 30`.

**Next action:** This account's dedicated SMS numbers are still being set up (just after an upgrade). Wait for the retry-after period, then retry; or use an email identity meanwhile.

**Retry:** After `Retry-After` seconds.

```json
{
  "error": {
    "code": "numbers_provisioning",
    "message": "This account's dedicated SMS numbers are still being provisioned. Retry shortly."
  }
}
```

## email_domain_not_configured {#email_domain_not_configured}

**HTTP 503** · No email domain configured

The server has no active email domain. This is an operator problem, not a client one.

**Next action:** The server operator has not configured an email domain. Tell the user; retrying will not help.

**Retry:** No.

```json
{
  "error": {
    "code": "email_domain_not_configured",
    "message": "No email domain configured; run `npm run admin -- domain:add <domain> --default` to add a platform domain"
  }
}
```

## Reserved codes

### forbidden {#forbidden}

**HTTP 403** · Reserved. Defined in the error model but not currently returned by any REST route. **Next action:** Do not retry. Tell the user the API key is not allowed to perform this action.

### conflict {#conflict}

**HTTP 409** · Reserved. Generic default of the conflict error class; REST routes return the specific codes `channel_not_enabled` and `all_numbers_busy` instead. **Next action:** Read error.message, fix the state it describes, then retry.


## Handling errors in code

```ts
import { Humanless, HumanlessError } from "humanless"; // npm i -D humanless

try {
  const id = await hl.createIdentity({ channels: ["email"] });
} catch (e) {
  if (e instanceof HumanlessError && e.isCreditsExhausted) {
    // Do not retry. Ask the account owner to open e.details?.billing_url
  } else if (e instanceof HumanlessError && e.retryAfterSeconds) {
    // 429 / 503: wait e.retryAfterSeconds, then retry
  } else throw e;
}
```

The SDK's `waitForCode`, `waitForLink` and `waitForMessage` already re-poll on `408` until their overall deadline (default 60 s), then throw `HumanlessTimeoutError`.

---
Canonical: https://usehumanless.com/docs/errors · Index of all docs: https://usehumanless.com/llms.txt
