> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goyappr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Codes

> Every error code the workflow, tool, connected-account and call-request endpoints raise themselves, with the action that clears it — plus the two routes that can forward a code from a service behind them.

Every error response carries a human-readable `error` and a stable machine `code`:

```json theme={null}
{ "error": "Publish this agent's workflow before creating a call.", "code": "WORKFLOW_UNPUBLISHED" }
```

Branch on `code`, never on the `error` text — the wording may change, the code will not. The account-wide codes (`MISSING_KEY`, `INVALID_KEY`, `EXPIRED_KEY`, `INSUFFICIENT_SCOPE`, `RATE_LIMIT`, `BILLING_ERROR`) are listed on the [API Reference overview](https://docs.goyappr.com/api-reference/introduction.md); any route here can answer `401` with `MISSING_KEY` (nothing was sent), `INVALID_KEY` (a key was sent and is not one of ours) or `EXPIRED_KEY`, and `403` with `INSUFFICIENT_SCOPE`, which names the scope the key is missing. `401` means the key itself was not accepted; `403` means the key is fine and is not allowed this one request — nothing needs rotating.

The tables below are every code these endpoints raise themselves. Two of them can also hand back a code from a service behind the API — see [Forwarded service codes](#forwarded-service-codes) before you branch on an unfamiliar one.

## Reading the status

| Status | What to do |
| - | - |
| 400, 422 | The request is wrong. Change it before retrying — an identical retry fails identically. `issues[]` names each parameter or field at fault, all of them in one answer. |
| 401 | The credential was not accepted. On the secret-key API: `MISSING_KEY`, `INVALID_KEY` or `EXPIRED_KEY` — send a valid key. On the [browser data plane](#the-browser-data-plane): `UNAUTHORIZED` — no session token, share link or sign-in, or one that is not ours; mint a new session. |
| 403 | The key is valid but not allowed this request: it lacks a scope (`INSUFFICIENT_SCOPE`, which names it), or it belongs to another workspace (`WORKSPACE_MISMATCH`). Widen the key or use another; retrying with the same key fails the same way. |
| 404 | The thing is not in this workspace, or is archived. |
| 409 | Something changed under you, or the operation no longer applies. Re-read, then decide. |
| 410 | Gone for good. Do not reuse the same key or identifier. |
| 413 | Too large. Make it smaller. |
| 429 | Too many at once. Wait the number of seconds in `Retry-After`, then retry; every `429` carries it. The limit is 60 requests per minute per API key; a route's own daily cap answers `RATE_LIMITED` with the wait until it resets. |
| 502, 503, 504 | Temporary. Retry the same request unchanged — with the same `Idempotency-Key` where one was sent. `504 UPSTREAM_TIMEOUT` is a service behind the API that did not answer in time. **Two exceptions**, on the browser data plane's offer only: `502 VOICE_CONNECTION_REFUSED` and `503 VOICE_UNAVAILABLE` spend the session token, so the same request can never succeed — mint a new session with `POST /calls {"type":"web"}`, then connect again. |

## When you are rate limited

Every key is allowed **60 requests per minute**. Past that the answer is `429` with
`RATE_LIMIT`, and three headers say where you stand on every response — `X-RateLimit-Limit`,
`X-RateLimit-Remaining` and `X-RateLimit-Reset` (a Unix timestamp). The `429` adds
`Retry-After`: whole seconds to wait before the next attempt. Honour it rather than retrying
at once — an immediate retry spends the rest of the window on refusals. Nothing you sent was
acted on, so the same request, with the same `Idempotency-Key` where one was used, is safe to
send again after the wait.

Every refusal from the same key names the same window, so one wait clears all of them — retry the
batch together rather than staggering it. And a burst that seems to repeat `X-RateLimit-Remaining`
is almost always a burst over more than one key: see [reading a burst](https://docs.goyappr.com/api-reference/introduction.md#rate-limiting).

## The code is always there

The gateway has one exit and every response leaves through it, so a `code` cannot be forgotten. A refusal that names nothing more specific than its status carries the code that status means:

| Status | Fallback code | Status | Fallback code |
| - | - | - | - |
| 400 | `BAD_REQUEST` | 413 | `PAYLOAD_TOO_LARGE` |
| 401 | `UNAUTHORIZED` (the browser data plane) | 415 | `UNSUPPORTED_MEDIA_TYPE` |
| 402 | `BILLING_ERROR` | 422 | `UNPROCESSABLE_REQUEST` |
| 403 | `FORBIDDEN` | 429 | `RATE_LIMIT` |
| 404 | `NOT_FOUND` | 500 | `INTERNAL_ERROR` |
| 405 | `METHOD_NOT_ALLOWED` | 502 | `UPSTREAM_ERROR` |
| 409 | `CONFLICT` | 503 | `SERVICE_UNAVAILABLE` |
| 410 | `GONE` | 504 | `UPSTREAM_TIMEOUT` |

Anything else answers `REQUEST_FAILED`. Every one of them, on every route and on the browser data plane, has the same shape — the `Error` schema in the OpenAPI file: `error`, `code`, and on a refusal that names what is wrong, `issues[]` (`code`, `path`, `message` each). These are the floor, not a replacement: where a table below names a code for your case, that code is what arrives, and a fallback in its place means the refusal was a different one. Treat a fallback code the way the status table above says to treat its status.

## Any resource

Every list and every read refuses a query parameter it does not read — by name, beside what it does read — instead of ignoring it. An ignored filter answers with every row and reads as a filtered answer. A parameter sent twice, or sent with no value, is refused too. The refusal names each parameter in `issues[]`: `path` is the parameter's name, and `code` is `query_param_unknown`, `query_param_repeated` or `query_param_blank` — or `query_param_invalid` where the value is what is wrong (`limit=ten`) — beside `error`, which says it in one sentence. These reads are not held to this, so do not rely on them to refuse one: `GET /campaigns/{id}/leads`, which also takes a `limit` or `offset` that is not a number; every read under `/carrier-accounts`; and the signed recording link `GET /calls/{id}/recording`, which audio players open with parameters of their own.

A create or a change refuses a body field it does not read, by name, on `POST /agents`, `PATCH /agents/{id}`, `POST /agents/{id}/duplicate`, `POST /agents/{id}/extraction/dry-run`, `POST /agents/{id}/test-call` (`TEST_CALL_INVALID`), the workflow's save, check, publish, rebind, restore and train (`PUT /agents/{id}/workflow`, `…/validate`, `…/publish`, `…/rebind`, `…/restore`, `…/train`), a workflow tool's `POST /tools` and `PATCH /tools/{id}`, `POST /tools/{id}/restore` (which takes no body at all), `POST /tools/{id}/workflow-revisions`, `POST /tools/{id}/test`, `POST /tools/attach` and `/detach`, `POST /campaigns`, `PATCH /campaigns/{id}`, `POST /campaigns/{id}/leads` (`field_unknown`, with the field it was likely meant to be) and `POST /campaigns/{id}/restore` (which takes no body at all), `POST /api-keys`, `POST /calls` (but see below), `POST /calls/{id}/recording/revoke`, `POST /calls/{id}/end` (it takes no body: `CALL_END_INVALID`), `POST /sip-endpoints`, `PATCH /sip-endpoints/{id}` and `POST /sip-endpoints/{id}/rotate-password` (`SIP_ENDPOINT_REQUEST_INVALID`; rotate-password takes no body at all), `POST /phone-numbers/{id}/release` and `POST /phone-numbers/{id}/keep` (which take no body at all: `PHONE_NUMBER_REQUEST_INVALID`), `PATCH /tool-connections/{id}` (`CONNECTION_INVALID`, with the field in `issues`), an agent's integrations — `POST /agents/{id}/integrations` and `PATCH /agents/{id}/integrations/{id}` (`AGENT_INTEGRATION_REQUEST_INVALID`) — and `POST /tool-connections/{id}/actions/prepare` and `POST /tool-connections/{id}/check`, which takes no body at all (`TOOL_CONNECTION_REQUEST_INVALID`), `PATCH /billing/details` (`BILLING_DETAILS_UNKNOWN_FIELD`, naming the field), and every write on `/leads`, `/do-not-call`, `/lead-tags`, `/dispositions`, `/shared-links`, `/call-windows` and `/agent-eval`. Connecting, reconnecting or cleaning up accounts refuses one too, and the message says what the route takes rather than which field it refused (`CONNECTION_INVALID`). An ignored field is a setting the caller believes they made. Other writes may drop a field they do not read, so do not rely on them to refuse one: a phone call through `POST /calls` to an agent that does not run a workflow (a browser session, `"type": "web"`, refuses one on any agent), `/call-requests`, the rest of `/phone-numbers`, `/carrier-accounts`, the rest of `/billing`, a campaign's `launch`, `pause`, `resume` and `stop`, `/agents/{id}/flow/…`, `POST /deliveries/{id}/retry`, `POST /report-issue`, cancelling a tool test, removing a connected account or cancelling its sign-in, and a tool created or changed the older way, with `type`. Send only the fields a route's page lists.

A write's query string is not where its settings go. Every write refuses a query parameter it does not read — by name, with a `400`, before anything is read or changed — so a typo never goes through as a setting: `DELETE /agents/{id}?bogus=1` is `400 AGENTS_QUERY_INVALID` and the agent stays as it was (it used to be archived for good). A parameter sent twice, or sent with no value, is refused the same way. Five writes read a query parameter: [`DELETE /lead-tags/{id}`](https://docs.goyappr.com/api-reference/lead-tags/delete) takes `force`, and refuses any other with `LEAD_TAG_DELETE_INVALID`; [`POST /campaigns/{id}/launch`](https://docs.goyappr.com/api-reference/campaigns/launch#query-parameters) and `POST /campaigns/{id}/resume` take `dry_run`, which checks the launch and changes nothing; [`DELETE /carrier-accounts/{id}`](https://docs.goyappr.com/api-reference/carrier-accounts/delete) takes `restore_routing`, which first moves every configured number back to the connection it was on in your Telnyx account; [`DELETE /agents/{id}/integrations/{integration_id}`](https://docs.goyappr.com/api-reference/agents/integrations-remove) takes `publish` and `expected_version`. The code is the route family's: `AGENTS_QUERY_INVALID`, `TOOLS_QUERY_INVALID`, `CALLS_QUERY_INVALID` (on `/call-requests` too), `LEADS_QUERY_INVALID`, `CAMPAIGNS_QUERY_INVALID`, `DO_NOT_CALL_REQUEST_INVALID`, `PHONE_NUMBERS_QUERY_INVALID`, `SIP_ENDPOINT_QUERY_INVALID`, `CARRIER_ACCOUNTS_QUERY_INVALID`, `BILLING_QUERY_INVALID`, `DELIVERIES_QUERY_INVALID`, `API_KEY_REQUEST_INVALID`, `REPORT_ISSUE_QUERY_INVALID`, and the codes of the shared lead-tag, disposition, shared-link and eval row below (`POST /tools/attach` and `/detach` answer `TOOL_ATTACHMENT_REQUEST_INVALID`). Three answer it their own way: connected accounts with `CONNECTION_INVALID`, the workflow's save, check, publish, rebind, restore and train (`PUT /agents/{id}/workflow`, `…/validate`, `…/publish`, `…/rebind`, `…/restore`, `…/train`) with `400 WORKFLOW_REQUEST_INVALID`, and starting a tool test with `422 WORKFLOW_TOOL_TEST_INVALID`. Send a write's settings in its body. The refusal names each parameter in `issues[]`, as a list's does. No write has a dry run but a campaign's launch and resume: `POST /tools?dry_run=true` is `400 TOOLS_QUERY_INVALID` and `POST /agents/{id}/duplicate?dry_run=true` is `400 AGENTS_QUERY_INVALID`, and nothing is created — the `422` routes in the table below answer that way for a body field only.

A body field a route does not read is refused with a `400` and the route family's request code — never a `…_QUERY_INVALID` code, which is for the query string: `LEAD_REQUEST_INVALID`, `DO_NOT_CALL_REQUEST_INVALID`, `API_KEY_REQUEST_INVALID`, `WEB_CALL_REQUEST_INVALID` (a browser session's mint), `CAMPAIGN_REQUEST_INVALID`, `WORKFLOW_AGENT_REQUEST_INVALID` (`POST /agents`), `WORKFLOW_SETTINGS_REQUEST_INVALID` (`PATCH /agents/{id}`), `WORKFLOW_REQUEST_INVALID` (the workflow's save, check, publish, rebind, restore and train), `EXTRACTION_DRY_RUN_INVALID`, `TOOL_ATTACHMENT_REQUEST_INVALID`, `RECORDING_REVOKE_INVALID`, `CALL_END_INVALID`, `SIP_ENDPOINT_REQUEST_INVALID`, `PHONE_NUMBER_REQUEST_INVALID`, `CONNECTION_INVALID`, and the `…_REQUEST_INVALID` codes of the families in the table below — except on these routes, which answer a body field they do not read (on the app catalogue, a query parameter) with `422`:

| Route | Code |
| - | - |
| `POST /tools`, `PATCH /tools/{id}`, `POST /tools/{id}/restore` | `WORKFLOW_TOOL_REQUEST_INVALID` |
| `POST /tools/{id}/test` | `WORKFLOW_TOOL_TEST_INVALID` |
| `GET /tool-apps`, `/tool-apps/{slug}`, `/tool-apps/{slug}/actions`, `/tool-apps/{slug}/actions/{action}` | `WORKFLOW_CATALOG_REQUEST_INVALID` |
| `POST /agents/{id}/duplicate` | `WORKFLOW_DUPLICATE_REQUEST_INVALID` |
| `POST /calls` to an agent that runs a workflow | `WORKFLOW_REQUEST_INVALID` |

Each field at fault is in `issues[]`, all of them in one answer: `field_unknown` for a field the route does not read, `field_required` for one it needs, `field_invalid` for a value it cannot take — with `path` the field as a pointer (`/colour`, `/expected_version`), the way query refusals carry `query_param_unknown`, `query_param_repeated`, `query_param_blank` or `query_param_invalid` with the parameter's name. A route with a word more exact than these (a workflow's `missing_input_source`, a tool's `tool_contract_invalid`) uses it. As a rule a `400` is a request whose shape is wrong — not JSON, a field it does not read, one it needs and did not get — and a `422` one whose shape is right and whose values cannot be done; the table above is the exception, kept for clients already branching on it. A `400` and a `422` ask the same of you: change the request before retrying. How a list pages — what it does with a `limit` above its maximum, and how it answers a cursor it did not issue — is in [Paging](#paging) below.

| Status | Code | What to do |
| - | - | - |
| 403 | `WORKSPACE_MISMATCH` | The `x-company-id` header names a workspace this key does not belong to. An API key works in one workspace only, so send that workspace's id or leave the header off entirely. Nothing was read or written. |
| 403 | `INSUFFICIENT_SCOPE` | The key is valid for this workspace but does not hold the scope this request needs, and the message names it. Every route answers a missing scope this way — it used to be `401` on most routes and `403` on two, and a `401` reads as a key to rotate. Add the scope under Settings → API keys (**Edit scopes**), or issue a key that holds it with [`POST /api-keys`](https://docs.goyappr.com/api-reference/api-keys/create). The request is counted against the key's rate limit like any other answer. |
| 403 | `API_KEY_AGENT_SCOPED` | The key is [limited to some agents](https://docs.goyappr.com/api-reference/introduction.md#limiting-a-key-to-some-agents), and this route belongs to the whole workspace — tools, numbers, billing status, dispositions, the Do-Not-Call list, calling hours, other keys — or would add an agent or change a lead, which the key could not then keep within its agents. It is also the answer when a call (`from` on `POST /calls`) or a campaign (`from_phone_number_id`) would call from a number none of the key's agents answers or calls from — the same answer whether the number exists or not. The message names what was refused. Use one of the key's agents' numbers, or a key without an agent limit. On a route that belongs to the whole workspace it is answered before any scope check and the same on every verb — `GET /api-keys` and `DELETE /api-keys/{id}` alike — because no scope would let such a key through. |
| 403 | `AGENT_OUTSIDE_KEY_SCOPE` | The key is limited to some agents and the request names another one — in the path, as `agent_id` in the body, or as an `agent_id` filter — or places a call without naming its agent. The answer is the same whether that agent exists or not. Name one of the key's agents; `GET /agents` lists exactly those. |
| 404 | `AGENT_NOT_FOUND` | The agent you named is not in this workspace — it does not exist, belongs to another workspace, or has been archived. Every route answers a missing agent this way, whether the agent is in the path (`/agents/{id}` and everything under it) or is the `agent_id` of `POST /calls`, `POST /call-requests`, `POST /shared-links`, `POST /tools/attach` / `detach` or an eval route — or the `agent_id` a list is filtered by: `GET /calls`, `GET /calls/export` (both answered `CALL_AGENT_UNKNOWN` until this release), `GET /shared-links` (it answered an empty list), `GET /tools` and `GET /deliveries`. Those three filters still find an archived agent: its calls and links are still its own. A `404` under `/agents/{id}` that carries any other code is about something else — the draft, a tool, a route — and the agent is there. Campaign, phone-number and carrier-number agent fields answer it too, naming the field (`agent_id`, `split.agent_id`, `inbound_agent_id`, `outbound_agent_id`); they used to answer `422 INVALID_AGENT` (`400` when adding a number to a carrier account). An agent field that is not an id at all is refused with its route's own `400`. |
| 400 | `LEAD_TAGS_QUERY_INVALID`, `LEAD_TAG_REQUEST_INVALID`, `DISPOSITIONS_QUERY_INVALID`, `DISPOSITION_REQUEST_INVALID`, `SHARED_LINKS_QUERY_INVALID`, `SHARED_LINK_REQUEST_INVALID`, `PHONE_NUMBERS_QUERY_INVALID`, `CALL_WINDOWS_QUERY_INVALID`, `CALL_WINDOWS_REQUEST_INVALID`, `BILLING_QUERY_INVALID`, `AGENT_EVAL_QUERY_INVALID`, `AGENT_EVAL_REQUEST_INVALID`, `AFFILIATES_QUERY_INVALID`, `TOOL_ATTACHMENT_REQUEST_INVALID` | A query parameter the route does not read, on every verb (deletes included), a body field a create or a change does not read, a parameter sent twice or with no value, or a `limit` / `offset` that is not a whole number — on `/lead-tags`, `/dispositions`, `/shared-links`, `GET /phone-numbers`, `/call-windows`, `GET /billing`, `GET /billing/rates` and `/agent-eval`. `DELETE /lead-tags/{id}` reads `force` and answers `LEAD_TAG_DELETE_INVALID` instead. Reads of one thing (`GET /tools/{id}`, `/tools/{id}/bindings`, `/tools/{id}/tests/{id}`, `/agents/{id}`, `/agents/{id}/settings`, `/agents/{id}/workflow`, `/do-not-call/{id}`, `/campaigns/{id}`, `/campaigns/defaults`, `/leads/{id}`, `/affiliates/downline`) take no parameters and answer with their family's code (`TOOLS_QUERY_INVALID`, `AGENTS_QUERY_INVALID`, `WORKFLOW_REQUEST_INVALID`, `DO_NOT_CALL_REQUEST_INVALID`, `CAMPAIGNS_QUERY_INVALID`, `LEADS_QUERY_INVALID`, `AFFILIATES_QUERY_INVALID`); `GET /affiliates/stats` takes `months` only. `GET /calls/{id}` and `GET /call-requests/{id}` take only the execution-history parameters — `execution_limit`, `execution_cursor`, `execution_phase`, `execution_kind` and `execution_status`, which is what `execution.history.next_url` and `refresh_url` carry — and `GET /calls/{id}` also `omit=execution`, which leaves the history out and cannot be sent beside them; anything else is `CALLS_QUERY_INVALID`. `POST /tools/attach` takes `agent_id`, `tool_id`, `execution_order` and `config_override`, and `POST /tools/detach` takes `agent_id` and `tool_id`: anything else, or a query parameter, is `TOOL_ATTACHMENT_REQUEST_INVALID`, the code of every `400` those two routes give — a missing `agent_id` or `tool_id`, an `execution_order` that is not a whole number of 0 or more, a body that is not JSON. The message names what was refused beside what the route reads; nothing was read or written. These used to answer `200`/`201` and drop what they did not read. |
| 400 | `REPORT_ISSUE_QUERY_INVALID` | [`POST /report-issue`](https://docs.goyappr.com/api-reference/report-issue) was sent a query parameter; it reads none. The message names it, and nothing was filed. |
| 400 | `AGENTS_QUERY_INVALID`, `CALLS_QUERY_INVALID`, `TOOLS_QUERY_INVALID`, `LEADS_QUERY_INVALID`, `CAMPAIGNS_QUERY_INVALID`, `AGENT_EVAL_QUERY_INVALID` | An `offset` past the end of an offset-paged list — `GET /calls`, `/agents`, `/tools`, `/leads`, `/campaigns`, `/campaigns/{id}/leads` and the `/agent-eval` lists, each with its own code. The message says how many rows match. An offset equal to `pagination.total` answers an empty page; one beyond it is this refusal, never a `500`. Stop paging when `has_more` is `false`. |
| 404 | `NOT_FOUND` | The id is well formed and names nothing in this workspace — a call, lead, lead tag, disposition, campaign, shared link, Do-Not-Call entry, persona or eval run — or it has been removed. It is the same answer on every verb. An agent is `AGENT_NOT_FOUND` and a tool or workflow is `WORKFLOW_NOT_FOUND` instead, as their sections say. |
| 404 | `ROUTE_NOT_FOUND` | The API serves no such path — a sub-path no route has (`DELETE /agents/{id}/nonsense`, `GET /calls/{id}/timeline`), a resource that does not exist (`/webhooks`), or an id left empty (`GET /calls/` could be `GET /calls/{id}` with no id, so it is refused rather than read as the list). A trailing slash that cannot be an id left empty is ignored: `POST /calls/` is `POST /calls`, `GET /agents/{id}/` is `GET /agents/{id}`, and `GET /affiliates/` is `GET /affiliates`, which is not served (the message names `/stats` and `/downline`). A doubled slash inside a path is merged into one before the request reaches the API, so `GET //calls` is `GET /calls` and `GET /agents//{id}` is `GET /agents/{id}`: do not count on one being refused. It is answered before any scope or agent check, the same for every key, and nothing is read or changed: an unknown sub-path is never answered as its parent, and an empty id never reads the list. The message names what the API serves at the deepest part of the path it recognised; the [root](https://api.goyappr.com/) lists every route. |
| 405 | `METHOD_NOT_ALLOWED` | The path is served, but not with this method — `PUT /carrier-accounts`, `GET /phone-numbers/{id}`, `PATCH /agents` without an id. The `Allow` header and the message list the methods it takes. Answered before any scope check; nothing is read or changed. `POST /campaigns/{id}/archive` is one too, and carries no `Allow` header, because no method is served at that path: the message says a campaign is archived with `DELETE /campaigns/{id}`. Only a campaign id gets that answer — `POST /campaigns/defaults/archive`, or a segment that is not an id, is `404 ROUTE_NOT_FOUND`. `/api-keys` answers its own, saying where a key is changed (below). |
| 404 | `RESOURCE_ID_INVALID` | The id in the path is not an id — `/agents/not-a-real-id`, for instance, or `/carrier-accounts/not-an-id`, `/calls/not-an-id/end`, `/call-requests/not-an-id`: every resource answers a malformed id this one way. A second id in the path is held to the same rule: `/carrier-accounts/{id}/numbers/not-an-id/configure`, `/tools/{id}/tests/not-an-id` and `DELETE /campaigns/{id}/leads/not-an-id` answer it too, never the resource's own not-found code. Ids are UUIDs, exactly as a list or a create returned them. This is a refusal, not an empty result: the request never reached the resource. |

### Paging

A list pages by `offset` or by `cursor`. A `limit` that is not a whole number, or is below 1, is refused on every list below but `/campaigns/{id}/leads` — with the answer in the last-but-one column where that column names one, and otherwise with the list's own `400` query code. Above the maximum, some lists clamp and some refuse:

| List | `limit` | Above the maximum | A cursor it did not issue |
| - | - | - | - |
| `GET /agents`, `/tools`, `/leads`, `/agent-eval/…` | 1–100 | Clamped to 100; `pagination.limit` says what was used. | — (offset paging) |
| `GET /calls` | 1–100 | Clamped to 100; `pagination.limit` says what was used. | 400 `CALLS_CURSOR_INVALID` — and so is one of its own cursors sent with other filters than the page that issued it (a different `updated_since`, or none): a cursor continues its own list only. |
| `GET /campaigns`, `/campaigns/{id}/leads` | 1–200 | Clamped to 200; `pagination.limit` says what was used. | — (offset paging) |
| `GET /agents/{id}/flow/versions` | 1–100 | Clamped to 100. | The cursor is the `created_at` its `next_cursor` gave you; anything but a timestamp is 400 `AGENTS_QUERY_INVALID`. |
| `GET /deliveries` | 1–200 | 400 `DELIVERIES_QUERY_INVALID` | 400 `DELIVERY_CURSOR_INVALID` |
| `GET /agents/{id}/workflow/versions` | 1–100 | 400 `WORKFLOW_REQUEST_INVALID`, with `limit` in `issues[0].path` | 400 `WORKFLOW_REQUEST_INVALID`, with `cursor` in `issues[0].path` |
| `GET /tools/workflow-catalog` | 1–50 | 400 `WORKFLOW_CATALOG_QUERY_INVALID` | 400 `WORKFLOW_CATALOG_QUERY_INVALID` |
| `GET /tools?workflow=true` | 1–50 | 422 `WORKFLOW_TOOL_REQUEST_INVALID` | 422 `WORKFLOW_TOOL_CURSOR_INVALID` |
| `GET /tool-apps`, `/tool-apps/{slug}/actions` | none | — | 422 `WORKFLOW_CATALOG_CURSOR_INVALID` |
| `GET /tool-connections` | none | — | 400 `CONNECTION_CURSOR_INVALID` |
| `GET /billing/transactions` | 1–500 (1,000 with `format=csv`) | 400 `TRANSACTIONS_QUERY_INVALID` | 400 `TRANSACTIONS_CURSOR_INVALID` — and so is one of its own cursors sent with another `from`, `to`, `timezone` or `limit` than the page that issued it. |

A cursor that is refused was built by hand, edited, sent to another list, or issued for another query: read the first page without one and follow the `next_cursor` it returns.

## Agents

| Status | Code | What to do |
| - | - | - |
| 400 | `AGENT_IDEMPOTENCY_REQUIRED` | Send an `Idempotency-Key` header of 16–128 letters, digits, underscores or hyphens. Reuse it only to retry the same creation. |
| 400 | `AGENT_IDEMPOTENCY_DUPLICATED` | The request carried the `Idempotency-Key` header more than once, so there is no one key to make it repeatable. Send exactly one — the usual cause is a proxy in front of the call repeating the header, not your own client. |
| 400 | `AGENTS_QUERY_INVALID` | [`GET /agents`](https://docs.goyappr.com/api-reference/agents/list) takes `limit`, `offset` and `name`, once each: `limit` and `offset` as whole numbers, `name` with 1–200 characters and no control characters. There is no status filter: `?search=`, `?status=` and anything else are refused rather than answered with every agent. |
| 400 | `WORKFLOW_AGENT_REQUEST_INVALID` | Send only `name`, optional `description`, `language`, `authoring_locale` and `greeting_message`, and `workflow.global_instructions` or a `template` (`inbound`, `qualify` or `reminder`), not both with text. Identity, routing and the initial structure are assigned by Yappr. `issues[]` names every field that is missing or wrong in one answer, each at its `path`, and `error` repeats the first. |
| 403 | `INSUFFICIENT_SCOPE` | [Duplicate agent](https://docs.goyappr.com/api-reference/agents/duplicate.md) with `"fork_tools": true`: forking creates tools, so the key needs `tools:create` as well as `agents:create`. Nothing was copied: add the scope, or duplicate without `fork_tools`. [Create agent](https://docs.goyappr.com/api-reference/agents/create.md) with `greeting_message`: the opening line is an agent setting, so the key needs `agents:update` as well as `agents:create`. Nothing was created: add the scope, or create without it and set it with `PATCH /agents/{id}`. |
| 404 | `AGENT_NOT_FOUND` | The agent is not in this workspace, or is archived. [Any resource](#any-resource) above. |
| 409 | `AGENT_IDEMPOTENCY_CONFLICT` | This key was already used with different agent details. Send the original details, or use a new key for a new agent. |
| 409 | `CALL_WINDOWS_CONFLICT` | [Update call time windows](https://docs.goyappr.com/api-reference/call-windows/update.md) only, and only when you sent `expected_updated_at`. The hours changed after you read them and nothing was written — they are workspace-wide, so the other writer may be a colleague's dashboard. Re-read [`GET /call-windows`](https://docs.goyappr.com/api-reference/call-windows/get), check your change against what is there, and send that `updated_at` back. |
| 409 | `WORKFLOW_FLOW_TEST_UNSUPPORTED` | [Test a flow](https://docs.goyappr.com/api-reference/flows/test.md) only. This agent runs a workflow, and rehearsing one needs a browser or a Web SDK client: there is no text-only rehearsal of a workflow over the API. [`POST /calls`](https://docs.goyappr.com/api-reference/calls/create) with `"type": "web"` mints a browser session your own page connects to with `@goyappr/client`, and [`POST /shared-links`](https://docs.goyappr.com/api-reference/shared-links/create) gives a person a page to call it from. When the call ends, `GET /calls/{id}` shows its analysis and follow-ups. |
| 410 | `AGENT_CREATION_GONE` | The agent this key created was archived or removed. The key cannot be reused; use a new one to create a new agent. |
| 410 | `AGENT_LEGACY_CREATION_GONE` | The body asked for a prompt or flow agent — it carries `system_prompt`, `type`, `flow_config`, `tools`, `tool_ids`, `prompt`, `webhook_url`, `webhook_events` or `webhook_headers` — which can no longer be created. Send `name` and `workflow.global_instructions` instead. Agents you already have keep running and are still updated with `PATCH /agents/{id}`. A body that merely left something out is the `400` above, not this — and so is `"type": "workflow"` alone, which asks for the one kind there is: it is refused as a field to remove (`400 WORKFLOW_AGENT_REQUEST_INVALID`, "Remove type"), not as a retired kind. |
| 422 | `WORKFLOW_DUPLICATE_REQUEST_INVALID` | [Duplicate agent](https://docs.goyappr.com/api-reference/agents/duplicate.md) only. Send an optional `name`, `description`, `language`, `model` and `fork_tools` (`true` or `false`), or no body at all. The message starts with the field at fault — `Remove voice.`, or what `name`, `description`, `language`, `model` or `fork_tools` takes. Everything else is copied from the source; change it on the copy afterwards. |
| 422 | `WORKFLOW_DUPLICATE_MODEL_INVALID` | [Duplicate agent](https://docs.goyappr.com/api-reference/agents/duplicate.md) only. The `model` is not one the source's voice belongs to — a Gemini model (or `null`) for a `gpt-live` voice, or `gpt-live` for a Gemini voice. Nothing was copied. Duplicate without `model`, then [`PATCH`](https://docs.goyappr.com/api-reference/agents/update) the copy with `model` and a voice of the other family. |
| 503 | `WORKFLOW_STORAGE_UNAVAILABLE` | Storage did not answer in time, so the request may not have gone through — or may have. Send it again. A create or a [duplicate](https://docs.goyappr.com/api-reference/agents/duplicate.md) goes with the same `Idempotency-Key`: if the first one made the agent, the retry returns that agent instead of making a second. A [delete](https://docs.goyappr.com/api-reference/agents/delete.md) that went through answers `200`, or `404 AGENT_NOT_FOUND` on the retry. |

## Agent settings

| Status | Code | What to do |
| - | - | - |
| 400 | `WORKFLOW_SETTINGS_REQUEST_INVALID` | The body is malformed, names an `engine`, `engine_voice` or `live_model` (on `PATCH /agents/{id}` too, which answered `BAD_REQUEST`), or carries a field an agent does not have — `issues[]` names each one by `path` and says where a retired field went, and every value beside it the settings cannot hold (`settings_value_invalid`) in the same answer. An unknown field was `422` here and `400` on create; it is `400` on both. Set `model` or `voice` instead. |
| 400, 422 | `WORKFLOW_SETTINGS_VOICE_INVALID` | Pick an available Yappr voice. |
| 400, 422 | `WORKFLOW_SETTINGS_MODEL_INVALID` | The `model` is not one of `gemini-3.1-flash-live`, `gemini-3.8-live`, `gpt-live` or `null`; or it would move the agent to the other voice family without a voice (`model` alone across `gpt-live` and the Gemini models); or the `voice` sent with it belongs to another family; or `gpt-live` was sent with `temperature` or `vad_*` or for a flow agent. The message lists the voices of the model's family. See [Models](https://docs.goyappr.com/api-reference/agents/models.md). |
| 403 | `WORKFLOW_ACTOR_DENIED` | This key can no longer change settings in this workspace. |
| 403 | `INSUFFICIENT_SCOPE` | The key authenticated and belongs to this workspace, but is not allowed this one write — `PUT /call-windows`, for instance, wants `call_windows:manage`, `GET /api-keys` wants `api_keys:read` or `api_keys:manage`, `GET /calls` wants `calls:read` or `calls:metrics` (and a `calls:metrics` key may not filter by `caller`, `callee`, `search` or `lead_id`), and `POST /agents/{id}/duplicate` with `"fork_tools": true` wants `tools:create` as well as `agents:create`. Two routes to a key that holds it: widen this one in Settings → API keys — under **Edit scopes**, or with the one-press **Add to this key** that a key older than the scope shows — or issue a new key with [`POST /api-keys`](https://docs.goyappr.com/api-reference/api-keys/create) using a key that holds both the scope and `api_keys:manage`. For `GET /api-keys` only the dashboard route applies: a key that could issue one would already be able to read the list. Every route answers a missing scope with this same `403`. |
| 404 | `AGENT_NOT_FOUND` | No such agent here. |
| 409 | `WORKFLOW_SETTINGS_CONFLICT` | Someone saved after you read — or you published, which moves this same token. Re-read the settings, review your change against theirs, then send the `updated_at` you just read back as `expected_updated_at`. After a publish there is no need to re-read: that response's `settings_updated_at` is the new token. |
| 422 | `WORKFLOW_SETTINGS_REQUEST_INVALID` | A value the settings cannot hold — `agent_speaks_first` that is not `true` or `false`, a `language` that is not one of the [call languages](https://docs.goyappr.com/api-reference/agents/languages.md), a number outside its range, a `background_sound` that does not exist. `issues[]` names every such field in one answer, each with what it takes, and `error` is the first; these used to answer one sentence about the workflow document, or a `400` "The settings request is invalid." that named nothing. Instructions, the graph and tool choices live in the workflow document. One unusable `extraction_parameters` entry answers here too, and the message names it by position and by name — for a `type`, with the kinds that are allowed. |
| 422 | `WORKFLOW_SETTINGS_UNSUPPORTED` | This voice manages its own turn-taking and expressiveness. Drop the temperature and speech-detection settings, or choose a voice from the other family. |
| 503 | `WORKFLOW_STORAGE_UNAVAILABLE` | Re-read the saved settings before retrying a write you are unsure about. |

## Workflow authoring

| Status | Code | What to do |
| - | - | - |
| 400 | `WORKFLOW_REQUEST_INVALID` | The body or the expected version is malformed. `issues[]` names each field by `path` — `/expected_version` when it is missing or not a positive whole number, `/<field>` for a field the request does not read, `/bindings` or `/bindings/<binding id>` on a rebind — and `error` repeats the first message. |
| 422 | `WORKFLOW_VALIDATION_FAILED` | Checking or publishing found issues, and Check answers them with this `422` exactly as Publish does. A tool wired onto a channel it cannot run on is not one of them: that is the advisory `binding_channel_unsupported` on Check's `200`, and it does not stop a publish. A tool wired into a phase it cannot run in is (`binding_phase_unsupported`), and so is an input reading a collected detail the agent does not collect, or one of a kind the input cannot take (`extracted_field_unknown`, `extracted_field_type_mismatch`) — these three used to come back from Check as `200` with `valid: false`, so a pipeline gating on the status passed them — and so is a required input whose only source is saved context, which nothing writes (`stored_context_has_no_writer`; the save keeps the draft), and a required input reading a call-request field `request_schema` does not declare, with no `fallback` (`missing_request_field`), and so is an input described to the call anywhere but in a follow-up step or on an input a description cannot fill (`extract_unavailable_phase`, `extract_type_unsupported`, `extract_missing_policy`, `extract_instruction_empty`). The answer carries `warnings[]` beside `issues[]`: `strict_off_guidance` when strict mode is off and every advisory about a binding or an input; the compiler's own graph advisories arrive once the document compiles. On every issue `label` is the step's own label; a binding issue adds `tool_name` and `field`. A part of the document that does not match the workflow schema is `field_required`, `field_unknown` or `field_invalid` at its pointer. Every issue is in the one answer: those four beside the graph's own, and every problem in the conversation graph together — a dangling transition and the step nothing reaches arrive in one Check, not one per round trip. |
| 404 | `AGENT_NOT_FOUND` | The agent is missing, archived, or not in this workspace. |
| 404 | `WORKFLOW_NOT_FOUND` | The agent is here, and its draft — or the route you asked for under it — is not. |
| 409 | `WORKFLOW_CONFLICT` | The draft, or something it pins, changed, and nothing was written: the draft is exactly what it was before the request. Reload and reconcile before retrying. Re-sending a save whose answer you never received is not this error — that returns `200` with the saved draft. The answer names the draft's version as `current_version`, beside `issues[0].path` `/expected_version`: when it is the version you sent, the draft did not move and something it pins did — a tool revision or a connected account. |
| 413 | `WORKFLOW_TOO_LARGE` | The document is over the size budget. Split or simplify it. |
| 413 | `WORKFLOW_SETTINGS_TOO_LARGE` | Validating or publishing only. The agent's saved settings are too large to snapshot, so nothing was published and the settings themselves were not changed. Shorten them, then publish again. |
| 422 | `WORKFLOW_DOCUMENT_INVALID` | The document's shape is wrong, and nothing was saved. A save with no `document` at all answers here with `issues[0].path` `/document`; a document that breaks a storage rule names `/schema_version` or `/bindings`. A save also refuses, each by path, what the [workflow schema](https://docs.goyappr.com/schemas/workflow-v1.json) requires — a step kind it does not have (`node_type_unknown` at `/conversation/nodes/<n>/type`), and a step without a member its kind needs (`field_required`, for example `/after/0/steps/0/label`) — and a change to the server-owned `id` or `name` (`server_owned`), and a `fallback` that is not `{"value": …}` (`field_invalid` at `/bindings/<n>/inputs/<field>/fallback`). A refusal about a binding names its step (`node_id`, `label`), tool (`tool_name`) and input (`field`). See [Save workflow draft](https://docs.goyappr.com/api-reference/workflows/save.md#what-a-save-refuses). |
| 422 | `WORKFLOW_VALIDATION_FAILED` | Read `issues[]`: each one names the path and the problem, and an issue about a single conversation step also carries its `node_id` and `label`. Nothing was published. [Check workflow](https://docs.goyappr.com/api-reference/workflows/validate.md) lists the fix for each issue code — sequence branching, the Before and After phase rules (`before_budget_exceeded`, `guard_phase`, `route_phase`, `before_route_target`, `decline_phase`), and the `placeholder_*` codes for a before-call result quoted in step instructions. |
| 409 | `WORKFLOW_TOOL_NOT_READY` | Rebinding only. That tool has no current revision yet; poll [Get tool](https://docs.goyappr.com/api-reference/tools/get.md) until `workflow.status` is `current`. |
| 404 | `WORKFLOW_NOT_FOUND` | Rebinding only. A tool you named is not in this workspace. The message names the tool and the binding, and `issues[]` has one entry for each binding that pointed at it, with `code` `tool_not_found` and `path` `/bindings/<binding id>`. Send a tool id from `GET /tools` — the tool's own id, not a revision id. |
| 422 | `WORKFLOW_BINDING_NOT_FOUND` | Rebinding only. The draft has no binding with that id — the message names it. Read the workflow and use one of its `bindings[].id`. |
| 422 | `WORKFLOW_REFERENCE_INVALID` | A tool or account the workflow names is not available in this workspace. `issues[]` says which binding: `path` is `/bindings/<n>/tool_revision_id` (into the document), and the code is `reference_is_tool_id` when you sent a tool's own id where its revision belongs — the message names the revision to send — `reference_unavailable` when the id is not a revision of any tool here, `reference_invalid` when it is not an id at all, `tool_archived` when the revision's tool is archived, or `connection_unavailable` when an app tool's connected account is no longer connected. `tool_archived` and `connection_unavailable` name the step that runs the binding (`node_id`, `label`) and the tool (`tool_name`), and the message names every step that shares the binding: restore the tool with [`POST /tools/{id}/restore`](https://docs.goyappr.com/api-reference/tools/restore) (the message carries the id), or remove the step — rebinding to another tool is not the fix. Save, Check, publish and the dashboard answer the same issue; a [duplicate](https://docs.goyappr.com/api-reference/agents/duplicate.md) of that agent answers it with `409`. Only a reference it cannot pin to any binding is one issue at `/bindings`. |
| 422 | `WORKFLOW_CONNECTION_UNAVAILABLE` | A connected account changed or needs reconnecting before you can publish. |
| 422 | `WORKFLOW_TOOL_IMPORT_REQUIRED` | This older tool needs an explicit contract revision before a workflow can use it. See [Add a Tool Contract Revision](https://docs.goyappr.com/api-reference/tools/create-revision.md). |
| 502 | `WORKFLOW_COMPILED_INVALID` | Nothing was published. Retry; if it persists, simplify the change and retry. |
| 503 | `WORKFLOW_COMPILER_UNAVAILABLE` | Nothing was published. Retry the same request. |
| 503 | `WORKFLOW_STORAGE_UNAVAILABLE` | Retry the same request. |

### Restoring a version

[`POST /agents/{id}/workflow/restore`](https://docs.goyappr.com/api-reference/workflows/restore) answers the codes above for a malformed body (`400 WORKFLOW_REQUEST_INVALID`), a version that is not this agent's (`404 WORKFLOW_NOT_FOUND`), a stale `expected_version` (`409 WORKFLOW_CONFLICT`) and a document that no longer passes today's checks (`422 WORKFLOW_REFERENCE_INVALID`, `WORKFLOW_VALIDATION_FAILED`; the draft is put back as it was), and three of its own:

| Status | Code | What to do |
| - | - | - |
| 409 | `WORKFLOW_DRAFT_HAS_UNPUBLISHED_CHANGES` | The saved draft differs from the published version, and a restore would lose it. The body also carries `reason: "draft_has_unpublished_changes"`. Publish the draft, or send `discard_draft: true` to replace it. |
| 409 | `WORKFLOW_VERSION_IS_CURRENT` | The version you named is the one callers reach now. Nothing to restore. |
| 409 | `WORKFLOW_CONFLICT` | `expected_version` is not the saved draft's version. Read the draft and send its version. |

A version read ([`GET /agents/{id}/workflow/versions/{version_id}`](https://docs.goyappr.com/api-reference/workflows/version)) answers `404 WORKFLOW_NOT_FOUND` for an id that is not a UUID or is not one of this agent's versions.

## Teach

[`POST /agents/{id}/workflow/train`](https://docs.goyappr.com/api-reference/workflows/train) and its `GET` answer these codes. A run that could not be applied is not an error: it is a `200` whose `status` is `held`, `failed` or `no_change` with a `reason`.

| Status | Code | What to do |
| - | - | - |
| 400 | `TEACH_REQUEST_INVALID` | The request is malformed. Send `call_id` (a UUID) and, optionally, `retry`. |
| 401 | `SESSION_REQUIRED` | Dashboard calls only: sign in again. |
| 400 | `COMPANY_REQUIRED` | Dashboard calls only: name the workspace. |
| 403 | `TEACH_FORBIDDEN_ROLE` | Only an owner or admin of the workspace can teach an agent. |
| 403 | `TEACH_ACTOR_REQUIRED` | The API key has no owner to act as. Use a key created by a person. |
| 403 | `TEACH_DISABLED` | Teaching is switched off. |
| 404 | `AGENT_NOT_FOUND` | The agent is not in this workspace. |
| 404 | `TEACH_CALL_NOT_FOUND` | The call is not in this workspace. |
| 404 | `TEACH_RUN_NOT_FOUND` | There is no run to retry or read. |
| 409 | `TEACH_AGENT_BUSY` | Another run is working on this agent. Wait for it to finish. |
| 409 | `TEACH_CALL_NOT_ON_LIVE_VERSION` | The call ran on an older version than the one live now. Make a new test call. |
| 409 | `TEACH_RETRY_NOT_ALLOWED` | Only a run that ended `held` or `failed` can be retried, up to 5 times, and only by the owner or admin who started it (`reason: not_requester` otherwise). |
| 409 | `TEACH_UNDO_UNAVAILABLE` | Dashboard only. The agent changed after the run, so it cannot be undone from there. Use [restore](https://docs.goyappr.com/api-reference/workflows/restore.md). |
| 422 | `AGENT_ENGINE_UNSUPPORTED` | Only agents that run a workflow can be taught. |
| 422 | `TEACH_AGENT_NOT_PUBLISHED` | Publish the agent first. |
| 422 | `TEACH_CALL_AGENT_MISMATCH` | The call was made to another agent than the one in the URL. |
| 422 | `TEACH_CALL_NOT_WEB` | Teach works from web test calls only, not phone calls. |
| 422 | `TEACH_CALL_TOO_OLD` | The call is more than 30 minutes old. |
| 422 | `TEACH_CALL_RUN_UNAVAILABLE` | The call has no record of the version it ran on. |
| 422 | `TEACH_ENVIRONMENT_MISMATCH` | The call ran on a different deployment than this one. |
| 429 | `TEACH_DAILY_LIMIT` | Three applied runs for this agent in the last 24 hours. Try again later. |
| 500 | `TEACH_INTERNAL` | Retry the same request; nothing was changed unless the run says `applied`. |

## Tools

| Status | Code | What to do |
| - | - | - |
| 400 | `WORKFLOW_TOOL_IDEMPOTENCY_REQUIRED` | Send an `Idempotency-Key` header of 16–128 letters, digits, underscores or hyphens. |
| 400 | `WORKFLOW_TOOL_REFERENCE_INVALID` | An `app` tool names an action or an account that does not exist — or sends something that is not an id at all, which used to be `422 WORKFLOW_TOOL_REQUEST_INVALID`: `metadata_id` is not an action from [Get app action](https://docs.goyappr.com/api-reference/tools/action.md), or `connection_id` is not a row of [List connected accounts](https://docs.goyappr.com/api-reference/tool-connections/list.md) in this workspace. `issues[]` names each field at fault (`/workflow/metadata_id`, `/workflow/connection_id`). Nothing is written - no tool, no failed record. An account that exists but is not connected yet is a different answer: `422 WORKFLOW_TOOL_NOT_BUILT`, below. |
| 400 | `WORKFLOW_REQUEST_INVALID` | Adding a contract revision: send exactly `expected_revision` and `contract`, and keep the body under 256 KiB. A field the request does not read, a `contract` that is missing or not an object, and an `expected_revision` that is neither `null` nor a positive whole number are each named in `issues[]` by `path` (`/<field>`, `/contract`, `/expected_revision`), and `error` repeats the first message. |
| 404 | `WORKFLOW_NOT_FOUND` | The tool is not in this workspace — the same answer on every verb, `GET`, `PATCH`, `DELETE` and a test alike (a legacy tool used to answer `NOT_FOUND` on some of them). An archived tool answers `WORKFLOW_TOOL_ARCHIVED` instead, below. Reading one is not refused: `GET /tools/{id}` answers an archived tool's short form with `archived_at`, `GET /tools?status=archived` lists them, and [`POST /tools/{id}/restore`](https://docs.goyappr.com/api-reference/tools/restore) puts one back. Archiving is the exception: `DELETE /tools/{id}` answers `200` for a tool that is already archived. |
| 422 | `WORKFLOW_TOOL_NOT_BUILT` | Creating or changing a tool: the change was saved but could not be built (on a change, the tool's previous revision stays in use). The body is the tool's own document — its `id` is the tool to fix — with `error` saying why and what to do, and `issues[0]` naming the field: `/workflow/connection_id` when the account is not connected, needs reconnecting or did not grant the action's permissions, `/workflow/fixed_inputs`, `/workflow/metadata_id`, or `/workflow` for an address, schema or header the build could not use. `issues[0].code` is the build's own reason, the same as `workflow.error_code`. This answer used to carry only `workflow.error_code` and the fallback code `UNPROCESSABLE_REQUEST`. Fix it and send the whole tool again with [`PATCH /tools/{id}`](https://docs.goyappr.com/api-reference/tools/update#a-tool-whose-creation-failed). |
| 409 | `WORKFLOW_TOOL_CONFLICT` | Saving a tool change: the tool moved on since you read it, and nothing was saved. Re-read `GET /tools/{id}` and send back its `workflow.head_revision_id` and `workflow.head_generation` as the request's `expected_head_revision_id` and `expected_head_generation`. |
| 409 | `INTEGRATION_ACTION_MANAGED` | Changing or archiving a tool an integration runs (its `GET /tools/{id}` carries `integration`): it belongs to the integration, and nothing was changed. Choose an agent's actions with `PATCH /agents/{id}/integrations/{integration_id}`; to archive it, first remove it from every agent that uses it. |
| 400 | `TOOLS_QUERY_INVALID` | [`GET /tools`](https://docs.goyappr.com/api-reference/tools/list) takes `name`, `agent_id`, `limit`, `offset` and `status=archived` (without `agent_id`); with `workflow=true` it takes `limit`, `cursor` and `status` instead — `name` there is taken only with `status=archived` (the archived list is searched by name) and refused otherwise: leave `workflow=true` out to find a tool by name. `name` is sent once, with 1–200 characters and no control characters. Anything else — `search`, `q`, or a parameter that belongs to the other list — is refused rather than answered with every tool. |
| 409 | `WORKFLOW_TOOL_IDEMPOTENCY_CONFLICT` | This `Idempotency-Key` was already used for a tool change with different content. Send the original body, or use a new key. |
| 409 | `WORKFLOW_CONFLICT` | Adding a contract revision: the tool already has a revision newer than the `expected_revision` you sent, and nothing was written. Re-read the revision list and send its highest `revision`. |
| 409 | `WORKFLOW_TOOL_OWNER_REQUIRED` | This tool or agent is workflow-owned. On `POST /tools/attach` / `detach`: bind the tool in the agent's workflow with `PUT /agents/{id}/workflow` and publish with `POST /agents/{id}/workflow/publish`; `GET /tools/{id}/bindings` lists the agents already using it. On a tool route the workflow tool does not have, the message lists the ones it does. |
| 409 | `WORKFLOW_TOOL_NOT_READY` | The tool was saved but its current version is still being prepared. Poll `GET /tools/{id}` until `workflow.current` is set. Never guess the schema. Testing a tool whose creation failed answers this too, with the failure in `error`: fix it with `PATCH /tools/{id}` (see [Update Tool](https://docs.goyappr.com/api-reference/tools/update.md#a-tool-whose-creation-failed)), then test it. So does restoring one ([`POST /tools/{id}/restore`](https://docs.goyappr.com/api-reference/tools/restore)): it was never archived, so fix it with `PATCH /tools/{id}` or remove it with `DELETE /tools/{id}`. |
| 409 | `WORKFLOW_AGENT_BUSY` | The agent is being changed right now. Reload it and retry. |
| 409 | `WORKFLOW_BINDINGS_REQUIRED` | The agent now picks its tools inside the workflow. Edit the workflow. |
| 422 | `WORKFLOW_TOOL_REQUEST_INVALID` | Send `name`, optional `description`, and `workflow` with a `kind` of `http`, `app` or `transfer`. On an update, include both expected-head fields; on a create, include neither. A tool change over 256 KiB lands here too — shorten it. The response carries an `issues[]` with one entry per field at fault: each `path` is a JSON pointer at that field (`/name`, `/workflow/kind`, `/workflow/configuration/url`, `/workflow/effect`, `/expected_head_revision_id`) and `error` repeats the first one's `message`, then says how many more `issues[]` holds. Every field at fault is named in one answer — a stray top-level field, a stray field under `workflow` and one under `workflow.configuration` each get their own entry. The contract itself is read here, so a URL that is not a URL, an unknown `effect`, an `input_schema` whose root is not an object or a field that variant does not take is named before any tool is created. Every field at fault is in the one answer; it used to stop at the first. An HTTP tool whose `configuration.url` is on `localhost`, a private network (10.x, 172.16–31.x, 192.168.x), a link-local, a cloud-metadata or another reserved address is refused here too, with `issues[0].code` `url_not_public` — and so is a hostname whose DNS answers include such an address (`127.0.0.1.nip.io`): our servers can never reach it, and it used to be created and then fail to build with nothing pointing at the URL. A host written as a shortened, octal or hexadecimal number (`1.2.3`) is refused with `url_host_form`: write it as a hostname or four plain decimal numbers. |
| 422 | `WORKFLOW_TOOL_CURSOR_INVALID` | The cursor was not cut for this list: another `status`, `name`, page size, workspace or environment, or it was edited. Drop it and list from the start. `issues[0].path` is `cursor`. On the same list (`GET /tools?workflow=true`), a `status` other than `failed`, `archived` or `all`, or a `limit` outside 1–50, is `422 WORKFLOW_TOOL_REQUEST_INVALID` with the parameter in `issues[0].path`. |
| 503 | `WORKFLOW_STORAGE_UNAVAILABLE` | Reading one tool, archiving one, or working with contract revisions. Temporary — retry the same request. |
| 503 | `WORKFLOW_TOOL_STORAGE_UNAVAILABLE` | Saving a tool, or listing tools. Temporary — retry the same request without changing its `Idempotency-Key`. |

### Transfer events on a call

A transfer that is requested but not carried out is not an HTTP error: the call's
events record a `transfer_failed` whose `data.error_code` is one of these. For all
but `REFER_FAILED` and `REFER_NO_RESULT` the caller stays with the agent. The
address is always shown without a password or `?` headers.

| `error_code` | Meaning | What to do |
| - | - | - |
| `INVALID_DESTINATION` | The tool's destination is neither a dialable number nor a well-formed SIP address (`sip:extension@pbx.example.com`: an extension, a host, no password, no `?headers`). Nothing was sent. | Fix the destination with `PATCH /tools/{id}`. A malformed address is refused when the tool is saved, so this appears only on a tool saved before then. |
| `UNAVAILABLE_ON_SIP_TRUNK` | The destination is a phone number and the call arrived over a [SIP trunk](https://docs.goyappr.com/concepts/sip-trunks.md#transfers), which cannot be transferred to a number. Nothing was dialled. | Use a SIP address of your phone system as the destination. |
| `REFER_ONLY_ON_SIP_TRUNK` | The destination is a SIP address and the call did not arrive over a SIP trunk, so there is no phone system to hand it back to. Nothing was sent. | Use a phone number for calls that do not come through your trunk. |
| `REFER_FAILED` | Your phone system was asked to take the call and reported that it couldn't place the new call (busy, not found or declined). **The call ends:** once the request has been sent Yappr cannot take the caller back. It is `completed` with no `transferred_at`, and its disconnect reason reads "Transfer refused by the phone system". | Check that your phone system accepts hand-offs and that the extension exists and is free. |
| `REFER_NO_RESULT` | The request went out and nothing came back: your phone system refused or ignored it, or the new call was not answered within about nine seconds. **The call ends**, and its disconnect reason reads "Transfer failed". | Point the transfer at something that answers quickly, and test it with a real call first. |

## Tool tests

| Status | Code | What to do |
| - | - | - |
| 403 | `WORKFLOW_TOOL_TEST_DENIED` | This key is not authorized for the workspace that owns the test. |
| 404 | `WORKFLOW_TOOL_TEST_NOT_FOUND` | That tool and test pair is not in this workspace. Check both ids. |
| 404 | `WORKFLOW_TOOL_ARCHIVED` | An archived tool, on every act but reading, archiving and restoring it: `POST /tools/{id}/test`, a test's cancel, `PATCH /tools/{id}`, `GET /tools/{id}/schema` and `GET` or `POST /tools/{id}/workflow-revisions`, each answered before the body is read. It cannot be tested or changed; a test it already ran still reads with `GET /tools/{id}/tests/{test_id}`. Restore it with [`POST /tools/{id}/restore`](https://docs.goyappr.com/api-reference/tools/restore) first; `GET /tools?workflow=true&status=archived` lists the archived tools. |
| 409 | `WORKFLOW_TOOL_TEST_CONFLICT` | Starting a test only: this `Idempotency-Key` belongs to a test with different details. Send the original body, or use a new key. |
| 400 | `WORKFLOW_TOOL_TEST_INVALID` | Starting a mock test (the default policy) with no `mock_output` when the tool's output schema has `required` members: a mock makes no request and cannot invent them. `issues[0]` is `field_required` at `/mock_output` and names them; send `mock_output` with them. With no required members no `mock_output` is needed: the mock answers the schema's minimal value (`{}` for `{"type": "object"}`). Beside another problem with the body, it is one more entry in that `422`. |
| 422 | `WORKFLOW_TOOL_TEST_INVALID` | Starting a test only: re-read the tool's schemas and correct the inputs, or pick a phase and channel the tool allows. `policy: "real"` is never accepted here. A missing `Idempotency-Key` (or two of them, which is not one), an unreadable body, a body that is not a JSON object, and a query parameter (a test reads none; `?bogus=1` used to start the test) each say so in the `error` and in `issues[0].message`. Everything else wrong with the body is named at once, one `issues[]` entry each — a stray field, `phase`, `channel`, and every input that breaks the schema — and `error` is the first, saying how many more follow. `inputs` and `mock_output` are read against the tool's current schemas before the test is accepted: a missing required input, a field the schema does not have, a value of the wrong type or outside its `enum` is refused here, with `issues[0].path` at the input (`/inputs/order_id`). It used to be accepted with `202` and settle later as `tool_test_validation_failed`, naming nothing. `policy: "allowlist"` with an empty `allowed_binding_ids` is refused too (`/allowed_binding_ids`): it grants nothing, so the test could only be blocked. So is a field a test does not take (`/<field>`; a test takes `phase`, `channel`, `inputs`, `policy`, `allowed_binding_ids`, `mock_output` and `revision_id`), a missing or unknown `phase` (`/phase`) or `channel` (`/channel`), `inputs` that is missing or not an object (`/inputs` — send `{}` when the tool takes none) and a `revision_id` that is not an id (`/revision_id`); each used to answer "The tool test request is invalid." and nothing else. |
| 429 | `WORKFLOW_TOOL_TEST_BUSY` | Starting a test only: too many tests are running in this workspace. Wait for one to finish. |
| 503 | `WORKFLOW_TOOL_TEST_UNAVAILABLE` | Tool testing is off or temporarily unavailable. Retry later. |

Reading a test and cancelling one answer only `403`, `404` and `503` — plus the account-wide `401`, like every route here. The three codes above belong to starting a test.

## Tool and app catalogs

| Status | Code | What to do |
| - | - | - |
| 400 | `WORKFLOW_CATALOG_QUERY_INVALID` | Use only `limit` (1–50), `cursor` and up to ten comma-separated `revision_ids`, once each. `issues[0].path` names the parameter, and the message what it takes — `tool_id` is not one: read one tool with [`GET /tools/{id}`](https://docs.goyappr.com/api-reference/tools/get). |
| 404 | `WORKFLOW_NOT_FOUND` | No such app or action. |
| 405 | `METHOD_NOT_ALLOWED` | The catalogs are read-only. |
| 413 | `WORKFLOW_CATALOG_ITEM_TOO_LARGE` | One tool version is over the limit. Simplify its schema. |
| 413 | `WORKFLOW_CATALOG_TOO_LARGE` | The page is over 1 MiB. Ask for fewer `revision_ids` or a smaller `limit`. |
| 422 | `WORKFLOW_CATALOG_REQUEST_INVALID` | Only `version` and `cursor` are accepted, and `search` on the app list or an app's action list, each once. The message names what was refused, and so does `issues[0].path`; the catalog refusals below carry the same `issues[]`. |
| 422 | `WORKFLOW_CATALOG_SEARCH_INVALID` | `search` is one line of 1-100 characters: part of an app's name (`calendly`) or an action's name (`free slots`). |
| 422 | `WORKFLOW_CATALOG_CURSOR_INVALID` | The cursor does not match this workspace, path or version, or is empty. Drop it and page from the start. |
| 422 | `WORKFLOW_DATED_VERSION_REQUIRED_INVALID` | Reading a single action needs an explicit `version` in `YYYYMMDD_NN` form. |
| 422 | `WORKFLOW_DATED_VERSION_REQUIRED` | The app has no dated version yet, so Yappr cannot use its actions and there is nothing to pin an action to. `GET /tool-apps` lists such an app with `version: null`; pick a different app. Connected accounts of such an app, and its action list, answer this too. Discovery itself never returns this. |
| 422 | `WORKFLOW_METADATA_VERSIONS_UNAVAILABLE` | The app published no usable version list. Pick a different app; retrying the same request will not change it. |
| 422 | `WORKFLOW_METADATA_IDENTITY_MISMATCH` | The metadata came back for a different app, action or version than the one asked for. Retry the same request unchanged. |
| 422 | `WORKFLOW_METADATA_PAGE_INVALID` | The catalog answered with a page we could not read. Retry the same request unchanged. |
| 422 | `WORKFLOW_CATALOG_RESPONSE_INVALID` | The catalog answered with a page we could not read. Retry the same request unchanged. |
| 503 | `WORKFLOW_CATALOG_UNAVAILABLE` | Retry the same request. |
| 503 | `WORKFLOW_TOOL_CONTROL_UNAVAILABLE` | The app catalog is not configured or is temporarily unreachable. Retry the same request. |

The last four `422`s above are the ones that are not your request's fault, and the three
`WORKFLOW_METADATA_*` ones reach you through the republish rule in [Forwarded
service codes](#forwarded-service-codes): the app catalog raises
`metadata_page_invalid`, `metadata_identity_mismatch` or
`metadata_versions_unavailable`, and the API hands it back as that name in
capitals behind `WORKFLOW_`. They are documented here because they are the ones
you will actually meet; an unfamiliar `WORKFLOW_*` code from these routes
arrived the same way and means what its status means.

## Connected accounts

| Status | Code | What to do |
| - | - | - |
| 400 | `CONNECTION_INVALID` | The body is missing `toolkit` or `label`, carries a field the endpoint does not accept, or a `locale` other than `en` or `he` — on connecting and on reconnecting. Send exactly `{"toolkit": "...", "label": "...", "locale": "en"}`, or `{"mode": "replace"}` to reconnect. `issues[]` names every field at fault in one answer, each with what it takes. A connected-account or sign-in-attempt segment that is not an id at all is `404 RESOURCE_ID_INVALID`, as on every other resource. On [`GET /tool-connections`](https://docs.goyappr.com/api-reference/tool-connections/list): a parameter other than `cursor`, `state` and `toolkit`, one sent twice or with no value, a `state` outside `disconnected`, `connecting`, `verifying`, `ready`, `reconnect_required`, `degraded`, `removed`, or a `toolkit` that is not an app slug — the message and `issues[0].path` name it. A query parameter on any other connection route is refused the same way. [`POST /tool-connections/cleanup`](https://docs.goyappr.com/api-reference/tool-connections/cleanup) takes no input at all: send no body or `{}`, since it always covers the whole workspace. |
| 400 | `CONNECTION_CURSOR_INVALID` | The `cursor` was not issued by this list for this workspace. Read the first page without one and follow `next_cursor`. `issues[0].path` is `cursor`. |
| 409 | `CONNECTION_APP_UNAVAILABLE` | That app is not open for connection in this workspace. Send a `slug` exactly as [`GET /tool-apps/connection-options`](https://docs.goyappr.com/api-reference/tool-connections/apps) returns it — a slug from `GET /tool-apps` is a different list and will fail here. If connection options is empty, nothing can be connected yet. |
| 409 | `CONNECTION_CREDENTIALS_REQUIRED` | The app takes credentials and none were sent. The message lists the fields. |
| 409 | `CONNECTION_CREDENTIALS_NEED_PERSON` | Credentials are entered by a person in the dashboard, never sent with an API key. |
| 422 | `CONNECTION_CREDENTIALS_REJECTED` | The app refused the credentials. Nothing was saved. |
| 409 | `CONNECTION_APP_NEEDS_CREDENTIALS` | The app is OAuth-only and needs a registered OAuth app that Yappr has not set up. Apps in [`GET /tool-apps/connection-options`](https://docs.goyappr.com/api-reference/tool-connections/apps) connect without setup. |
| 409 | `CONNECTION_APP_NO_DATED_VERSION` | The app has no dated version yet (its publisher has released only the undated build), so Yappr cannot use its actions and the app cannot be connected. [`GET /tool-apps/connection-options`](https://docs.goyappr.com/api-reference/tool-connections/apps) does not list such an app. Nothing was created; pick another app. |
| 409 | `CONNECTION_ATTEMPT_CLOSED` | The sign-in attempt expired or was already used. Start a new connection. |
| 400 | `CONNECTION_REPLACEMENT_REQUIRED` | Reconnecting needs `{"mode": "replace"}`, and `mode` is the only thing wrong: `issues[0].path` is `/mode`. (It is a `400`; this page said `409`.) |
| 409 | `CONNECTION_STILL_CONNECTED` | `POST /tool-connections/{id}/remove` was sent for a connection that has not been disconnected. Send `DELETE /tool-connections/{id}` first; only a disconnected record can leave the list. |
| 409 | `CONNECTION_ATTEMPT_OPEN` | A person is signing in to that connection right now. On [`POST /tool-connections/{id}/reconnect`](https://docs.goyappr.com/api-reference/tool-connections/reconnect) the body's `attempt` names the sign-in and the message names its cancel path; a sign-in nobody has opened yet is replaced without this refusal. On `POST /tool-connections/{id}/remove`, `GET /tool-connections/{id}` shows it as `open_attempt`. Wait for it to finish or expire (ten minutes), or cancel it with `POST /tool-connections/attempts/{id}/cancel`, then send the request again. It is never an outage to retry. If a sign-in finishes, the connection is working again and stays on the list. |
| 429 | `CONNECTION_RATE_LIMIT` | Ten authorizations started by this API key are already open. Finish one, cancel one with `POST /tool-connections/attempts/{id}/cancel`, or wait for one to expire. Other callers’ attempts, and attempts that already ended, do not count — except against the workspace ceiling of 120 starts in ten minutes, which counts every start whatever became of it. |
| 503 | `CONNECTION_UNAVAILABLE` | Connection management is temporarily unreachable. Retry the same request. |

Connection errors use two families. `CONNECTION_INVALID`, `CONNECTION_CURSOR_INVALID`, `CONNECTION_BODY_TOO_LARGE` and `CONNECTION_REPLACEMENT_REQUIRED` mean the request is wrong — fix it and retry. `CONNECTION_NOT_FOUND` and `CONNECTION_ATTEMPT_CLOSED` mean the connection or the sign-in attempt is gone — start a new one. `CONNECTION_STILL_CONNECTED` means the record has to be disconnected before it can be taken off the list — send the `DELETE` first. `CONNECTION_ATTEMPT_OPEN` means somebody is connecting it again right now — wait for that authorization to end, or cancel it, before reconnecting or removing it. `CONNECTION_RATE_LIMIT` means this caller already has ten authorizations open — finish one, or cancel one with `POST /tool-connections/attempts/{id}/cancel`, rather than retrying — or that the workspace started more than 120 in the last ten minutes, which only a loop reaches. `CONNECTION_CONFIG_UNAVAILABLE`, `CONNECTION_STORAGE_UNAVAILABLE` and `CONNECTION_UNAVAILABLE` are temporary — wait and retry. `AUTH_LINK_UNKNOWN` and `AUTH_REDEMPTION_UNKNOWN` mean the sign-in did not complete; start a fresh connection rather than reusing the handoff. Errors never echo credentials.

## API keys

| Status | Code | What to do |
| - | - | - |
| 400 | `API_KEY_REQUEST_INVALID` | `name` is missing or over 100 characters, `scopes` is missing, empty, or not an array of strings, `expires_at` is not a date-time with a time zone or has already passed, a scope a key limited by `agent_ids` could never use (`agents:create`, `tools:create` and the other workspace-wide ones [Create API key](https://docs.goyappr.com/api-reference/api-keys/create.md) lists — each is named), or the body carries a field `POST /api-keys` does not take — the message names it and no key is issued. `scopes` has no default — a key gets exactly what you ask for. So is a query parameter on `GET /api-keys` other than `limit` (1–100), `offset`, `revoked` (`true` / `false`), `revoked_since`, `revoked_until` (real dates, in order, with `revoked=true`; a time of day needs a time zone) and `cursor` (one this list handed out for the same workspace and range, not with `offset`), and any query parameter on `GET /api-keys/{id}`. |
| 400 | `API_KEY_SCOPE_UNKNOWN` | A requested scope does not exist. The message names it; check it against the [scope list](https://docs.goyappr.com/api-reference/introduction.md). |
| 400 | `API_KEY_AGENT_UNKNOWN` | An id in `agent_ids` is not a live agent in this workspace. The message names each one; `GET /agents` lists the ids a key can be limited to. No key was issued. |
| 403 | `API_KEY_SCOPE_ESCALATION` | You asked for a scope the calling key does not hold, and the message names each one. Ask for a subset of what this key has, or widen this key in the dashboard first. A key holding `api_keys:manage` holds `api_keys:read` for this rule, since it already reads the list. |
| 403 | `INSUFFICIENT_SCOPE` | On `GET /api-keys`, the key holds neither `api_keys:read` nor `api_keys:manage`. `api_keys:read` reads the inventory and nothing else. A workspace owner or admin adds it to this key in the dashboard, under Settings → API keys → **Edit scopes**; a key that could issue one would already be able to read the list. |
| 403 | `API_KEY_MANAGE_NOT_DELEGABLE` | `api_keys:manage` was in `scopes`. A key issued through the API never receives it. Leave it out, or create that key in the dashboard under Settings → API keys. |
| 409 | `API_KEY_NAME_TAKEN` | An active key of that name already exists here — compared without regard to case, and named in the message as it is spelled. Choose another name, or revoke that one first. |
| 405 | `METHOD_NOT_ALLOWED` | `PATCH` or `PUT` on `/api-keys`, whatever scopes the key holds — the answer comes before any scope check. There is no update: a key's scopes, agents and end date are changed in the dashboard, under Settings → API keys → **Edit scopes**, and **Rotate** there gives a key a new secret. The `Allow` header names what the path takes: `GET, POST` on `/api-keys`, `GET, DELETE` on `/api-keys/{id}`, and the message names the path that was sent — `/api-keys/{id}` for a key's own path. From code, a key holding `api_keys:manage` issues the replacement under a new name with `POST /api-keys`, moves over, and revokes the old key; the message offers that route only to such a key. |
| 409 | `API_KEY_SELF_REVOKE` | The id you are revoking is the key making the request. Revoking it here would leave nothing able to issue or revoke keys — do it from the dashboard. |
| 503 | `API_KEY_STORAGE_UNAVAILABLE` | Nothing was created, changed or revoked. Retry the same request. |

## Retired endpoints

`GET /integrations` and `DELETE /integrations/{id}` listed and revoked the native Google Calendar and Gmail credentials. Both now answer **`410`** with `code: ENDPOINT_RETIRED` (it was the lowercase `endpoint_retired`, the one code not in capitals), and they will stop answering at all in the release after this one. The [root](https://api.goyappr.com/) lists them apart, under `retired` (`status`, `code` and `endpoints`), in the same `METHOD /path` form as every route in its `endpoints` — for example `GET /agents/{id}`.

| Status | Code | What to do |
| - | - | - |
| 410 | `ENDPOINT_RETIRED` | Connect calendars and mailboxes as connected apps instead. [`GET /tool-apps`](https://docs.goyappr.com/api-reference/tool-connections/apps) lists what you can connect, [`POST /tool-connections`](https://docs.goyappr.com/api-reference/tool-connections/connect) starts the connection, and [`GET /tool-connections`](https://docs.goyappr.com/api-reference/tool-connections/list) replaces the old list call. Do not retry — a `410` means permanently gone, and the same request fails identically forever. |

The native Google Calendar and Gmail integrations are retired, so `GET` and `DELETE /integrations` return `410 ENDPOINT_RETIRED`. Connect Google Calendar or Gmail as a connected app (Tool connections) and use their actions in a workflow. An agent that still has a native step keeps it until the end of its 30-day notice period; Yappr moves it to the connected app once you connect it.

A flow you send can't contain an `integration_call` node: saving one is rejected as `FLOW_INVALID`. So while an agent still has its native step, `PATCH /agents/{id}` can't replace its `flow_config`; every other setting updates as usual, and the step keeps running until Yappr moves it.

## Leads

| Status | Code | What to do |
| - | - | - |
| 400 | `LEAD_REQUEST_INVALID` | A create or an edit carried a field it does not read, and the message names it. A create takes `phone_number`, `name`, `email`, `metadata`, `long_term_context`, `source`, and `tags` or `tag_ids`; an edit takes the same without `phone_number` and `source`, which are fixed at creation. Also: `metadata.extracted` sent with a value other than the one stored — it is what calls collected, and only a call writes it. Sending it back exactly as you read it is fine. Also an `email` that is not an email address, and an edit that sets none of its fields (`{}`): `issues[]` then holds one `field_required` at path `""`. Nothing was written. |
| 400 | `INVALID_PHONE_NUMBER` | `phone_number` is not a number the lead could be called on. Send E.164 (`+972501234567`) or the local form (`0501234567`), which is normalised for you. |
| 400 | `INVALID_LEAD_SOURCE` | `source` must be `api`, `manual` or `csv_import`, or omitted for `api`. Leads Yappr creates from a call are `call`, which a request cannot claim. |
| 400 | `INVALID_TAG_IDS` | One or more `tag_ids` are not lead tags in this workspace. [`GET /lead-tags`](https://docs.goyappr.com/api-reference/lead-tags/list) lists them. |
| 400 | `INVALID_TAG_NAMES` | One or more of the `tags` names are not lead tags in this workspace, or are not names at all. Names match exactly — the same list, with the same spelling, that [`GET /lead-tags`](https://docs.goyappr.com/api-reference/lead-tags/list) returns. Nothing was written: the whole `tags` list is applied or none of it is. |
| 400 | `LEADS_QUERY_INVALID` | Listing leads takes `limit`, `offset`, `search`, and one of `tag` or `tag_id`, each once and with a value; `limit` and `offset` are whole numbers. Anything else is refused rather than ignored — `search=` with nothing in it used to answer every lead. |
| 404 | `LEAD_TAG_UNKNOWN` | The `tag` name or `tag_id` you filtered by is not a lead tag in this workspace — an empty page would have read as "no leads carry it". |
| 409 | `DUPLICATE_PHONE` | A lead with this number already exists here. Read it and `PATCH` it instead. |
| 400 | `LEAD_TAG_DELETE_INVALID` | [Deleting a lead tag](https://docs.goyappr.com/api-reference/lead-tags/delete.md) takes one query parameter, `force=true` or `force=false`. Any other value, and any other parameter, is refused rather than read as "no", each in `issues[]`: another parameter `query_param_unknown`, `force` sent twice `query_param_repeated`, with no value `query_param_blank`, or with another value `query_param_invalid`. |
| 409 | `LEAD_TAG_IN_USE` | Leads still carry the tag you asked to delete, and the body's `leads_tagged` says how many. Deleting it takes it off all of them and breaks any filter or campaign enrolment built on that segment, so retag them first — or repeat the call with `?force=true`. Nothing was deleted. |
| 503 | `LEAD_TAG_COUNT_UNAVAILABLE` | Deleting a lead tag counts the leads carrying it first, and that count failed — so the tag was **not** deleted rather than deleted as if none carried it. Retry the same call, or send `?force=true` to delete it without the count. |
| 409 | `DUPLICATE_NAME` | A lead tag with this name already exists in this workspace. Tag names are unique; [list them](https://docs.goyappr.com/api-reference/lead-tags/list.md) and reuse the one that is there. |

An agent tags a lead during a call the same way anything else changes one: through [`PATCH /leads/{id}`](https://docs.goyappr.com/api-reference/leads/update) with `tags` (names) or `tag_ids`. Either list replaces every tag the lead carries, and either is applied whole — one unknown name or id refuses the request rather than writing the rest, so a typo cannot quietly take a tag off the lead. The agent's own extraction parameters do not write tags: they are extracted into the call's `extracted_data` and the `call.analyzed` payload, which your own service reads before deciding which tag to apply.

## Do Not Call

| Status | Code | What to do |
| - | - | - |
| 400 | `DO_NOT_CALL_REQUEST_INVALID` | The request carried something the endpoint does not read, and the message names it. Adding takes `phone_number`, `reason`, `expires_at` and `agent_ids`; editing takes `reason`, `expires_at` and `agent_ids`; listing takes `phone` and nothing else; reading one entry takes no parameters. A misspelt `expire_at` beside a valid `reason` used to save the reason and drop the expiry without a word. The same code refuses an `expires_at` that is not a timestamp or is in the past, on an edit as on an add: a past expiry lifts the block the moment it is saved, so to take a number off the list, `DELETE` the entry. It is the code of every `400` from `/do-not-call` — a `phone_number` or `phone` that is missing or not a phone number, a `reason` that is not a string, `agent_ids` naming an agent that is not in this workspace, an edit that tries to change `phone_number` or changes nothing, a body that is not a JSON object — and the message says which. Nothing was written. |

## SIP endpoints

| Status | Code | What to do |
| - | - | - |
| 400 | `SIP_ENDPOINT_REQUEST_INVALID` | The body of [`POST /sip-endpoints`](https://docs.goyappr.com/api-reference/sip-endpoints/create), [`PATCH /sip-endpoints/{id}`](https://docs.goyappr.com/api-reference/sip-endpoints/update) or [`POST /sip-endpoints/{id}/rotate-password`](https://docs.goyappr.com/api-reference/sip-endpoints/rotate-password) was refused, and the message names the field: one the endpoint does not read (a create takes `name`, `inbound_agent_id`, `auth_mode`, `max_concurrent_calls`, `slug` and `allowed_source_ips`; an edit takes `name`, `inbound_agent_id`, `is_active`, and `max_concurrent_calls` on a username-and-password trunk or `allowed_source_ips` on a SIP address endpoint; rotate-password takes no body), a value for a field of the other kind of endpoint, a missing `name` or `inbound_agent_id`, an `inbound_agent_id` that is not an agent in this workspace, an `auth_mode` other than `credentials` or `uri`, a `max_concurrent_calls` outside 1–8 or `null` (every trunk has a limit), a `slug` that is not 2–12 letters, digits and single hyphens or is a reserved word (alone or followed by a hyphen), an `allowed_source_ips` entry that is not an IPv4 or IPv6 address, or an edit with nothing in it. `sip_username` and `sip_password` are refused too: Yappr issues a trunk's username and password, and a SIP address endpoint has neither. `transport` is not a setting. An edit that sends `slug` or `auth_mode` lands here because neither can change: create a new endpoint, point your phone system at it, and delete the old one. Every fault is in `issues[]`, all at once, each at its pointer (`/name`, `/allowed_source_ips/2`) with `field_unknown`, `field_required` or `field_invalid`; `error` says the first. A create's `Idempotency-Key` that can't be one is refused here too, as `header_invalid` at `Idempotency-Key`. Nothing was saved. |
| 400 | `SIP_ENDPOINT_QUERY_INVALID` | [`GET /sip-endpoints`](https://docs.goyappr.com/api-reference/sip-endpoints/list) takes `limit` (at least 1) and `offset`, as whole numbers, and `name`, each once and with a value; [`GET /sip-endpoints/status`](https://docs.goyappr.com/api-reference/sip-endpoints/status), [`GET /sip-endpoints/{id}`](https://docs.goyappr.com/api-reference/sip-endpoints/get) and every SIP endpoint write take no query parameter. Anything else is refused rather than answered with every endpoint, or read as a setting, and `issues[]` names each parameter: `query_param_unknown`, `query_param_repeated`, `query_param_blank` or `query_param_invalid`. |
| 400 | `SIP_REGISTER_HOST_INVALID` | An extension endpoint's `register.server`, on a [create](https://docs.goyappr.com/api-reference/sip-endpoints/create.md) or an [edit](https://docs.goyappr.com/api-reference/sip-endpoints/update.md), is not an address Yappr can register to: it must be the host name or IP address of your phone system with an optional `:port`, and nothing else (no `sip:` prefix, path, user name or spaces). It is refused too when it does not point at a public address, for example a private, loopback or Yappr or carrier address, or when Yappr's carrier does not accept it. Check the address and the port, then send the request again. Nothing was saved. |
| 400 | `SIP_REGISTER_PASSWORD_REQUIRED` | An edit changed an extension endpoint's `register.username` or `register.auth_username` without `register.password`. Yappr does not keep the password, so it cannot reuse it: send `register.password` in the same request. Nothing was saved. |
| 403 | `FORBIDDEN_ROLE` | Dashboard sessions only: just workspace owners and admins can create, change or delete a username-and-password trunk, or issue it a new password. An API key with `sip_endpoints:manage` can. Nothing was saved. |
| 403 | `SIP_TRUNKS_NOT_ENABLED` | A create with `"auth_mode": "credentials"` in a workspace where username-and-password trunks aren't switched on. Nothing was created. Ask Yappr support to switch them on; SIP address endpoints, and trunks that already exist, are not affected. [`GET /sip-endpoints/status`](https://docs.goyappr.com/api-reference/sip-endpoints/status) says whether you can create one. |
| 403 | `SIP_REGISTER_NOT_ENABLED` | A create with `"auth_mode": "register"` in a workspace where extension endpoints aren't switched on. Nothing was created. Ask Yappr support to switch them on; SIP address endpoints and trunks are not affected. [`GET /sip-endpoints/status`](https://docs.goyappr.com/api-reference/sip-endpoints/status) says whether you can create one. |
| 403 | `SIP_REGISTER_OUTBOUND_NOT_ENABLED` | `register.outbound.enabled: true` on a create or an edit, where calling out through an extension isn't switched on for the workspace. Nothing was saved. Ask Yappr support; switching outbound off always works. |
| 404 | `SIP_ENDPOINT_NOT_FOUND` | No SIP endpoint with this id in this workspace. An id that is not a UUID at all is `404 RESOURCE_ID_INVALID`, as on every other resource. |
| 409 | `VOICE_NOT_READY` | Yappr can't answer calls on username-and-password trunks right now, for example during an update. Nothing was created; try again in a few minutes. |
| 409 | `IDEMPOTENCY_KEY_REUSED` | [`POST /sip-endpoints`](https://docs.goyappr.com/api-reference/sip-endpoints/create#retrying-a-create): this `Idempotency-Key` already created an endpoint in the last 24 hours, from a different body. Nothing was created. Send the original body (the answer is that endpoint, `200` with `"replayed": true`, never a trunk's password), or use a new key. |
| 409 | `CONFLICT` | A SIP address endpoint's create drew an address that is already taken (rare). Nothing was created; send the request again for a new random address. |
| 409 | `SIP_ENDPOINT_NOT_CREDENTIALS` | Rotate-password on a SIP address endpoint, which has no password. To move it to a new address, create a new endpoint, point your phone system at it, then delete this one. |
| 409 | `SIP_TRUNK_NOT_PROVISIONED` | The trunk's username and password were never finished, or are no longer set up at Yappr's carrier, so it can't be switched on or get a new password. Delete it and create a new one. |
| 409 | `SIP_REGISTER_LIMIT_REACHED` | A create of an extension endpoint when the workspace already holds its limit (5 unless Yappr support raised it), or when Yappr has no room for another registration right now. Nothing was created. Delete an extension endpoint you don't use, or ask Yappr support. |
| 409 | `SIP_REGISTER_SETUP_IN_PROGRESS` | A create of an extension endpoint with an `Idempotency-Key` that already started one whose setup has not finished, so there is no endpoint to hand back yet. Wait a minute and list your endpoints: if it is still switched off, delete it and create it again. |
| 409 | `SIP_REGISTER_EXTENSION_IN_USE` | The extension username (`register.username`) on a create or an edit is already used by another endpoint on Yappr. Extension usernames are unique across Yappr, first come first served, so a short one such as `101` often clashes. Create a dedicated extension on your phone system with a distinctive name (letters, digits, `-` or `_`) and use that one, or edit the endpoint that has the name rather than deleting and re-creating it. Nothing was saved. |
| 409 | `PHONE_NUMBER_IN_USE` | `register.outbound.caller_number` is already a phone number in Yappr. Use another number, or remove it where it is. Nothing was saved. |
| 409 | `SIP_REGISTER_NOT_PROVISIONED` | An edit of an extension endpoint whose registration was never finished, or is no longer set up at Yappr's carrier, so nothing can be changed or switched on. Delete it and create a new one. |
| 409 | `SIP_REGISTER_PROVIDER_ERROR` | An edit of an extension endpoint while Yappr's carrier is still applying the last change to it. Nothing was changed; wait a few minutes and send the edit again. The same code is `502` when the carrier could not be reached (below). |
| 429 | `RATE_LIMITED` | 20 create attempts per workspace in 24 hours, or 10 new-password attempts per trunk in an hour, each counted from the first attempt. A failed attempt can count too. Nothing changed; try again once the window is up. A SIP address endpoint's create answers this `429` with the code `RATE_LIMIT`. |
| 502 | `SIP_TRUNK_PROVISIONING_FAILED` | Yappr's carrier could not set up, change or remove the trunk's username and password. Nothing was created or deleted; on a new password, `error` says whether the current password still works. Try again in a minute. |
| 502 | `SIP_REGISTER_PROVIDER_ERROR` | Yappr's carrier could not set up, change or remove an extension endpoint's registration. On a create, Yappr undoes the attempt and nothing is created; if it could not confirm the undo, the endpoint stays in your list, switched off, and `error` says so: delete it, then create it again. On an edit the endpoint keeps its old settings, and on a delete it is not deleted. Try again in a minute. |

## Shared browser-call links

| Status | Code | What to do |
| - | - | - |
| 400 | `SHARED_LINKS_QUERY_INVALID` | [`GET /shared-links`](https://docs.goyappr.com/api-reference/shared-links/list): `agent_id` is not an id. Send an agent's id as `GET /agents` returns it, or leave the filter out. |
| 400 | `SHARED_LINK_EXPIRY_INVALID` | `expires_at` could not be read as a timestamp, or is already in the past — a link created that way could never be opened. Nothing was created. Send a future ISO 8601 timestamp — `2026-10-01T00:00:00Z` — or omit the field for a link that never expires. |

## Reading calls

| Status | Code | What to do |
| - | - | - |
| 400 | `CALLS_QUERY_INVALID` | Listing calls takes `limit`, `offset` or `cursor`, `agent_id`, `status`, `direction`, `callee`, `caller`, `ab_variant`, one of `disposition` or `disposition_id`, `from`/`to`, `updated_since`, `source`, `search`, `lead_id`, `carrier_account_id` and `provider` (`external`, `telnyx` or `none`). Anything else is refused rather than ignored, as is a parameter sent twice (`status=completed&status=no_answer` used to answer the first value only) — an ignored filter returns the whole workspace's calls and reads as a filtered answer. The same code also refuses a `status` outside `pending_connection`, `ringing`, `in_progress`, `completed`, `failed`, `no_answer`, `transferred`, `dnc_blocked` and a `direction` outside `inbound`, `outbound`, `web_call`; both used to reach the database and answer `500`. On [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) and [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export) alike it also refuses an `agent_id` that is not an id, and a `from` or `to` that is not a real ISO 8601 timestamp — a shape like `2026` or `Sep 1`, or a month-end its month does not have (`2026-09-31`). Both refuse a `from` after `to`, which used to answer an empty page. `GET /calls` refuses an `updated_since` the same way, and `cursor` together with `offset`; `GET /calls/export` refuses `limit`, `offset`, `cursor` and `updated_since` outright, because a file is one whole window, not a page of it or what changed since. Every one of those used to reach the database: most answered `500`, and `?from=yesterday` was parsed by the database as a relative date and answered `200` with a window nobody asked for. (`GET /deliveries` refuses its own bad filters as `DELIVERIES_QUERY_INVALID`, below.) |
| 400 | `INVALID_AB_VARIANT` | `ab_variant` is `a` or `b`. Refused the same way on [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export), where an accepted typo would answer an empty file that reads as *no call ran that variant*. |
| 400 | `CALLS_EXPORT_TOO_LARGE` | [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export) only. The window you asked for holds more than 10000 calls and the message names how many. Nothing was written — a file cut off at the limit would carry totals that are wrong and say nothing about it. Split the window with `from` and `to`; a call's start time never changes, so consecutive windows skip nothing. `to` is inclusive, so de-duplicate on `Started` before adding two files' `X-Total-Cost-USD` values up. |
| 400 | `CALLS_CURSOR_INVALID` | The `cursor` was not issued by [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) — cursors are signed, so one built by hand, edited, or taken from another list is refused. Read the first page without one and follow `pagination.next_cursor` — a page-one answer to a corrupted cursor would re-read the newest calls for ever. |
| 400 | `CALLS_QUERY_INVALID` | On [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) and [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export) alike, a `lead_id` or `carrier_account_id` that is not an id, a `search` under 2 or over 100 characters, or a `search` more than 300 agents and leads share by name (leads count only for a key with `leads:read`; for any other key, more than 300 agents) — send more of the name, or filter by `agent_id` or `lead_id`. |
| 404 | `NOT_FOUND` | The `lead_id` you filtered [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) or [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export) by is not a lead in this workspace, or was deleted. [`GET /leads`](https://docs.goyappr.com/api-reference/leads/list) lists them — an empty page would have read as *no calls with this lead*. |
| 403 | `INSUFFICIENT_SCOPE` | `carrier_account_id` on [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) or [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export) from a key without `carrier_accounts:read` — the scope that shows `carrier_account` on each call. Without it, `provider: "external"` still marks the calls on your own Telnyx account. |
| 404 | `CARRIER_ACCOUNT_NOT_FOUND` | The `carrier_account_id` you filtered [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) or [`GET /calls/export`](https://docs.goyappr.com/api-reference/calls/export) by is not a carrier account in this workspace. [`GET /carrier-accounts`](https://docs.goyappr.com/api-reference/carrier-accounts/list) lists them — an empty page would have read as *no calls ran on it*. |
| 404 | `CALL_DISPOSITION_UNKNOWN` | The `disposition` label or `disposition_id` you filtered by is not a disposition in this workspace. [`GET /dispositions`](https://docs.goyappr.com/api-reference/dispositions/list) lists them; labels match exactly. |
| 410 | `EXECUTION_RETENTION_EXPIRED` | [`GET /calls/{id}`](https://docs.goyappr.com/api-reference/calls/get) and [`GET /call-requests/{id}`](https://docs.goyappr.com/api-reference/calls/request-get) only. The `execution_cursor` points at execution history that is no longer retained. Read the call again without it. |
| 422 | `EXECUTION_CURSOR_INVALID` | The same two reads. The `execution_cursor` was not issued by this read, or was sent with other filters than the ones it was issued for, or `execution_limit` is not a whole number from 1 to 200, or `execution_phase`, `execution_kind` or `execution_status` is not a value the history has. Follow `execution.history.next_url` instead of building one. |
| 503 | `EXECUTION_READ_UNAVAILABLE` | The same two reads, when an `execution_` parameter was sent and the history could not be read. Temporary — retry the same request. |
| 503 | `CALLS_LIST_TIMEOUT` | [`GET /calls`](https://docs.goyappr.com/api-reference/calls/list) only. The list could not be read inside its own budget of about 15 seconds. Nothing was changed. Send the same request again after the `Retry-After` seconds, or narrow it with `from` and `to` or a smaller `limit`. |
| 403 | `RECORDING_LINK_EXPIRED` | [A recording link](https://docs.goyappr.com/api-reference/calls/recording.md) past its `exp`. Links last 7 to 8 days: read the call again for a current `recording_url`. |
| 403 | `RECORDING_LINK_REVOKED` | The call's recording links were [revoked](https://docs.goyappr.com/api-reference/calls/recording-revoke.md) after this one was issued. Read the call again for a current `recording_url`. |
| 403 | `RECORDING_LINK_INVALID` | The recording link was not issued by Yappr, or its `exp` or `sig` was changed - or it was sent without its `sig`, which an API key does not replace. Use `recording_url` exactly as the API returned it, or **Copy recording link** on the call in Call Logs. |
| 400 | `RECORDING_REVOKE_INVALID` | [Revoking a call's recording links](https://docs.goyappr.com/api-reference/calls/recording-revoke.md) takes no body and no query parameters; the message names what to remove, and `issues[]` names each one: a body field as `field_unknown` at `/<field>`, a query parameter at its name. Nothing was revoked. |
| 503 | `RECORDING_LINK_UNAVAILABLE` | A recording link could not be checked or its audio fetched, or a call's links could not be revoked, just now. Nothing changed. Try again in a moment. |

## Webhook deliveries

| Status | Code | What to do |
| - | - | - |
| 400 | `DELIVERIES_QUERY_INVALID` | [`GET /deliveries`](https://docs.goyappr.com/api-reference/deliveries/list) takes `tool_id`, `agent_id`, `call_id`, `status`, `source`, `retried`, `from`, `to`, `cursor` and `limit`. Anything else is refused rather than ignored, as is a filter sent twice or with no value, a `status` outside `delivered`, `failed`, `pending`, `unknown`, a `source` other than `live` or `test`, a `retried` other than `true` or `false`, a `limit` outside 1–200, a `from` or `to` that is not a real timestamp, and a `from` after `to`. |
| 400 | `DELIVERY_CURSOR_INVALID` | The `cursor` was not issued by this endpoint — cursors are signed, so one built by hand, edited, or taken from `GET /calls` does not decode — or it was cut for a list with other filters (`issues[0].code` `cursor_invalid`; send it with exactly the filters of the page that returned it). Read the first page without one and follow `pagination.next_cursor` — a page-one answer to a corrupted cursor would re-read the newest rows for ever. |
| 400 | `DELIVERIES_QUERY_INVALID` | On [`GET /deliveries/{id}`](https://docs.goyappr.com/api-reference/deliveries/get): a query parameter was sent. One delivery is read by its id alone; filter the list instead. |
| 404 | `AGENT_NOT_FOUND`, `NOT_FOUND`, `WORKFLOW_NOT_FOUND` | [`GET /deliveries`](https://docs.goyappr.com/api-reference/deliveries/list) filtered by an `agent_id`, `call_id` or `tool_id` that names nothing in this workspace. The message names the filter; nothing was read. It used to answer an empty page. |
| 404 | `WORKFLOW_TOOL_ARCHIVED` | On [`POST /deliveries/{id}/retry`](https://docs.goyappr.com/api-reference/deliveries/retry): the tool that sent the delivery is archived — the same status a test of an archived tool answers. Restore it with [`POST /tools/{id}/restore`](https://docs.goyappr.com/api-reference/tools/restore), then retry. Nothing was sent. |
| 404 | `DELIVERY_NOT_FOUND` | No delivery with that id in this workspace. Ids come from [`GET /deliveries`](https://docs.goyappr.com/api-reference/deliveries/list) or a call's timeline. A second segment that is not an id at all is `404 RESOURCE_ID_INVALID`. |
| 409 | `DELIVERY_NOT_RETRYABLE` | [`POST /deliveries/{id}/retry`](https://docs.goyappr.com/api-reference/deliveries/retry) on a delivery that was accepted (sending it again would deliver it twice) — including a workflow tool's delivery answered with a 2xx the tool could not use — or has not settled yet. Nothing was sent. |
| 409 | `DELIVERY_OUTCOME_UNKNOWN` | [`POST /deliveries/{id}/retry`](https://docs.goyappr.com/api-reference/deliveries/retry) on an `unknown` delivery: your endpoint did not answer in time, so it may already have acted on it. Check there; send `{"acknowledge_unknown": true}` to send it again anyway. Nothing was sent. |
| 400 | `DELIVERY_RETRY_INVALID` | [`POST /deliveries/{id}/retry`](https://docs.goyappr.com/api-reference/deliveries/retry) with a body other than none, `{}` or `{"acknowledge_unknown": true\|false}`. The message names what to change. Nothing was sent. |
| 409 | `DELIVERY_ALREADY_RETRIED` | The delivery was already retried; the body's `retried_by` is that attempt. Read it, and retry it instead if it failed too. Nothing was sent. |
| 409 | `DELIVERY_SENDER_UNAVAILABLE` | The delivery's sender is gone, is not a webhook, or has no usable address. Fix the tool's address, then retry. Nothing was sent. |
| 503 | `WEBHOOK_DELIVERY_UNAVAILABLE` | The delivery's request and response, or the retry, could not be read or recorded. Nothing was sent; try again in a moment. |

## Billing

| Status | Code | What to do |
| - | - | - |
| 400 | `CONSUMPTION_QUERY_INVALID` | [`GET /billing/consumption`](https://docs.goyappr.com/api-reference/billing/consumption) takes `from`, `to`, `group_by`, `product`, `include_topups`, `timezone` and `sort`, once each. `timezone` is an IANA timezone name (`Asia/Jerusalem`, `UTC`); an offset such as `+03:00` is refused. `sort` is `amount`, `period` (day and month rows only) or `name` (not on day or month rows). There is no agent filter — `?agent_id=` is refused rather than answered with the whole workspace's spend; use `group_by=agent`. `include_topups` is `true` or `false`; `product` is one of `voice_call`, `eval_run`, `phone_number`, `topup`, `refund`, `adjustment`; `group_by` is one of the documented groupings; `from` and `to` are real ISO 8601 timestamps, and `from` is not after `to`. A product the report does not know, and a date like `2026-02-30` or `Aug 2026`, used to answer `500`; a reversed window answered `200` with nothing in it, which read as a month that cost \$0. |
| 400 | `TRANSACTIONS_QUERY_INVALID` | [`GET /billing/transactions`](https://docs.goyappr.com/api-reference/billing/transactions) takes `from`, `to`, `limit`, `timezone`, `format` and `cursor` (not with `format=csv`), once each, and [`GET /billing/transactions/{id}`](https://docs.goyappr.com/api-reference/billing/transaction) takes `timezone`; anything else is refused by name rather than ignored. `limit` is a whole number of at least 1 and at most 500 (1,000 with `format=csv`) — a higher one is refused, not read as the maximum; `format` is `json` or `csv`; `timezone` is an IANA timezone name (`Asia/Jerusalem`, `UTC`), and an offset such as `+03:00` is refused; `from` and `to` are real ISO 8601 timestamps, and `from` is not after `to` on the statement's clock, where a date-only `to` ends that day (or after now, when `to` is left out). Nothing reached the database. |
| 400 | `TRANSACTIONS_CURSOR_INVALID` | The `cursor` sent to [`GET /billing/transactions`](https://docs.goyappr.com/api-reference/billing/transactions) was not issued for this query: it came from a page read with another `from`, `to`, `timezone` or `limit`, or from another workspace, or it was edited or built by hand. Read the first page without `cursor` and follow its `next_cursor` with the same parameters. |
| 404 | `NOT_FOUND` | [`GET /billing/transactions/{id}`](https://docs.goyappr.com/api-reference/billing/transaction): no row with that id in this workspace, the id is one charge, which a day's usage row folds, or it is a call's id, which the message says (a call's cost is on `GET /calls/{id}`). Transaction ids come from the rows of `GET /billing/transactions`. An id that is not a UUID is `404 RESOURCE_ID_INVALID`. |
| 400 | `SPEND_BUDGET_INVALID` | [`PATCH /billing`](https://docs.goyappr.com/api-reference/billing/spending-limit) only. Send `monthly_budget_cents` as a whole number of cents between 0 and 2147483647, or `null` to turn the limit off. Nothing was saved, so the limit is exactly what it was. |

## Campaigns

| Status | Code | What to do |
| - | - | - |
| 400 | `CAMPAIGN_REQUEST_INVALID` | On [enrolment](https://docs.goyappr.com/api-reference/campaigns/enroll.md) (`POST /campaigns/{id}/leads`): a field the request or one of its `phone_numbers` entries does not read, each named in `issues[]` with `code: "field_unknown"`, its `path` and the field it was likely meant to be (`emial` → `email`); nothing was enrolled. Otherwise: the body of [`POST /campaigns`](https://docs.goyappr.com/api-reference/campaigns/create) or [`PATCH /campaigns/{id}`](https://docs.goyappr.com/api-reference/campaigns/update) was refused: an unknown or read-only field (each at its own `path` as `field_unknown`, with the field it was likely meant to be: `stop_dispositions` → `stop_disposition_ids`; [`POST /campaigns/{id}/restore`](https://docs.goyappr.com/api-reference/campaigns/restore) names each field it was sent the same way), a value out of range, a `regulatory_basis` outside the five, a `stop_disposition_ids` entry that is a label such as `"Not Interested"` rather than an id (look it up in `GET /dispositions`), an id that is no outcome here — deleted, or another workspace's (`outcome_not_found`, at `/stop_disposition_ids/<n>`, every one named beside the other problems), or one of the outcomes the platform sets by itself (`No Answer`, `Voicemail`, `Unclassified`, `Failed` — use the `stop_on_*` switches), a `budget_cents` below one call's hold, a `calling_window` without a `tz` or one that can never open (a `tz` that is not a time zone, `days` empty, repeated or outside `0`–`6`, a `start`/`end` that is not `HH:MM` or sent without the other, an `end` not later than `start`), a `starts_at` or `ends_at` that is not an ISO-8601 timestamp, an `ends_at` that has already passed or is not later than `starts_at`, a `calling_window` that never opens between `starts_at` and `ends_at`, an edit with no writable field, or a body that is not JSON. The message names the field. Every problem is named in the one answer — `issues[]` has an entry per field at fault (`/calling_window/days` and `/calling_window/start` both, not just the first), and `error` is the first with a count of the rest; a field the route does not take is named first, and the values beside it are still named (it used to be answered alone, hiding them). The references are named in the same answer: each platform outcome in the stop set at its place (`platform_stop_outcome`, `/stop_disposition_ids/1`), a `from_phone_number_id` that is not an id or not a number in this workspace (`invalid_from_number`), and an `agent_id` or `split.agent_id` that is not an agent here (`agent_not_found`, archived agents included). They used to arrive one per round trip, as `400 INVALID_FROM_NUMBER` and then `404 AGENT_NOT_FOUND`. Nothing was saved. |
| 400 | `CAMPAIGNS_QUERY_INVALID` | [`GET /campaigns`](https://docs.goyappr.com/api-reference/campaigns/list) or [`GET /campaigns/{id}/leads`](https://docs.goyappr.com/api-reference/campaigns/list-leads) was filtered by a `status` that does not exist. The message names it and lists the real ones. It used to answer `500` with the database's enum error. Also: `GET /campaigns/{id}/leads?phone=` was given text that is not a phone number. |
| 409 | `CAMPAIGN_NOT_STOPPABLE` | [Stopping](https://docs.goyappr.com/api-reference/campaigns/stop.md) a draft whose settings are not complete. The message ends with the settings that are not set. It never dialled anyone, so there is nothing to stop: archive it with `DELETE /campaigns/{id}`, or complete it with `PATCH` and launch it. Nothing changed. |
| 409 | `DISPOSITION_IN_USE` | [Deleting an outcome](https://docs.goyappr.com/api-reference/dispositions/delete.md) that is the only way a launched campaign can stop (no other stop outcome, `stop_on_no_answer` and `stop_on_voicemail` off). The message names the campaigns. Add another outcome to their `stop_disposition_ids`, or archive a finished one, then repeat. Drafts and archived campaigns never block it: the outcome just leaves their Stop list. Nothing was deleted. |
| 409 | `CAMPAIGN_NOT_ARCHIVED` | [Restoring](https://docs.goyappr.com/api-reference/campaigns/restore.md) a campaign that is not archived — the message names its status. Nothing changed. |
| 409 | `CAMPAIGN_STOP_RULE_REQUIRED` | [Restoring](https://docs.goyappr.com/api-reference/campaigns/restore.md) a campaign that had launched and whose last stop outcome was deleted while it was archived: a stopped campaign needs a stop rule, so it cannot come back. Create a new campaign with `POST /campaigns` and enrol its contacts there. Nothing changed. |
| 404 | `CAMPAIGN_ARCHIVED` | Reading, changing, enrolling into or launching an archived campaign by its id (`GET`, `PATCH` and `DELETE /campaigns/{id}`, its `leads`, `stats`, `launch`, `pause`, `resume` and `stop`). The message names `POST /campaigns/{id}/restore`, which brings it back; `GET /campaigns?status=archived` lists it as it is. An id that is no campaign here is `NOT_FOUND`. |
| 422 | `CAMPAIGN_NOT_READY` | Launching or resuming a campaign whose settings are incomplete, that has no stop rule, whose stored `calling_window` can never open, never opens before `ends_at`, whose `ends_at` has passed, or whose `budget_cents` is below one call's hold, or whose agent is switched off or has not been published — the message says which. `?dry_run=true` on launch or resume answers the same way and changes nothing. Nothing changed. |

## Phone numbers

[Releasing a number](https://docs.goyappr.com/api-reference/phone-numbers/release.md) keeps it until the end of the period already paid for, then releases it; [keep](https://docs.goyappr.com/api-reference/phone-numbers/keep.md) undoes that until then.

| Status | Code | What to do |
| - | - | - |
| 400 | `PHONE_NUMBER_REQUEST_INVALID` | `POST /phone-numbers/{id}/release` or `POST /phone-numbers/{id}/keep` was sent a body field or a query parameter. They take neither; `issues[]` names each one. Nothing was changed. |
| 409 | `PHONE_SYSTEM_NUMBER` | Releasing a number that calls out through your phone system (`provider: phone_system`). Yappr does not hold it: switch outbound calls off on its SIP endpoint with [`PATCH /sip-endpoints/{id}`](https://docs.goyappr.com/api-reference/sip-endpoints/update) (`register.outbound.enabled: false`), or delete that endpoint. Nothing changed. |
| 409 | `NUMBER_FROM_OWN_CARRIER` | Releasing a number in your own Telnyx account (`provider: external`). Yappr never releases it: [remove it from this workspace](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md) with `DELETE /carrier-accounts/{id}/numbers/{phone_number_id}`. Nothing changed. |
| 409 | `NUMBER_IN_CAMPAIGN`, `NUMBER_ON_LIVE_CALL` | Releasing a number a campaign that has not ended still calls from, or one with a call in progress: the same answers as removing a number from a carrier account (below). Nothing changed. |
| 409 | `RELEASE_NOT_SCHEDULED` | Keeping a number that has no subscription to keep. Nothing changed. |
| 409 | `SUBSCRIPTION_ENDED` | Keeping a number whose subscription has already ended. It can no longer be kept: buy a new number. |
| 500 | `PHONE_RELEASE_FAILED` | A release that runs now (payment overdue, or no subscription) could not run. Try again in a minute. |
| 500 | `PHONE_RELEASE_INCOMPLETE` | A release that runs now did not finish at the carrier, or the number is still listed. Yappr has been notified; contact support if it stays listed. |
| 503 | `BILLING_UNAVAILABLE` | Releasing or keeping a number while billing, or the number's checks, could not be reached. Nothing changed. Try again in a minute. |

## Carrier accounts (your own Telnyx account)

| Status | Code | What to do |
| - | - | - |
| 400 | `INVALID_API_KEY` | `api_key` is not a Telnyx API key. Paste the whole key from Account Settings → API Keys. Nothing was saved, and the key is not echoed back. |
| 400 | `INVALID_PUBLIC_KEY` | `public_key` is your account's public key: 44 characters of base64, from Keys & Credentials → Public Key. |
| 400 | `INVALID_NAME` | `name` is 1–100 characters; `friendly_name` on a number is at most 100. |
| 400 | `INVALID_JSON` | The request body is not a JSON object. Nothing was saved. |
| 400 | `INVALID_CONNECTION_REQUEST` | [`POST /carrier-accounts/{id}/connection`](https://docs.goyappr.com/api-reference/carrier-accounts/connection) takes exactly one of `create.outbound_voice_profile_id` or `connection_id`. |
| 400 | `INVALID_NUMBER` | [`POST /carrier-accounts/{id}/numbers`](https://docs.goyappr.com/api-reference/carrier-accounts/add-number) takes E.164 — `+972` followed by 8 or 9 digits for Israel. |
| 400 | `INVALID_AGENT` | `outbound_agent_id` is not an id. One that names no agent in this workspace is `404 AGENT_NOT_FOUND`, naming the field, as on every other route. |
| 400 | `CARRIER_ACCOUNTS_QUERY_INVALID` | A write under `/carrier-accounts` was sent a query parameter it does not read. Only [`DELETE /carrier-accounts/{id}`](https://docs.goyappr.com/api-reference/carrier-accounts/delete) reads one, `restore_routing`. The message names it; nothing reached Telnyx and nothing was saved. |
| 400 | `NOTHING_TO_UPDATE` | [`PATCH /carrier-accounts/{id}`](https://docs.goyappr.com/api-reference/carrier-accounts/update) needs at least one of `name`, `api_key`, `public_key`. |
| 400 | `CONFIRM_REQUIRED` | `POST /carrier-accounts/{id}/numbers/{phone_number_id}/configure` moves the number's connection in your Telnyx account, so it takes `{"confirm": true}`. Sent without it, it is the ask-first answer: it carries `warnings`, read live from your Telnyx account (`connection_change` and the settings that stay on, voicemail included), and `current_connection_name`, where the number's calls go today. Show them, then send `{"confirm": true}`. Nothing changed. |
| 403 | `CARRIER_ACCOUNTS_NOT_ENABLED` | Carrier accounts are available in every workspace; this is the answer only where Yappr has switched them off for yours. Every carrier-accounts route answers it then, before anything reaches Telnyx. [`GET /carrier-accounts/status`](https://docs.goyappr.com/api-reference/carrier-accounts/status) says which. Contact Yappr support. |
| 404 | `CARRIER_ACCOUNT_NOT_FOUND` | No carrier account with that id in this workspace. One in another workspace answers this too. A segment after `/carrier-accounts/` that is not an id at all is `404 RESOURCE_ID_INVALID`, as on every resource (it used to be this code). |
| 404 | `NUMBER_NOT_FOUND` | The number is not on this carrier account — when removing it, or configuring it to answer here or stopping that. A number segment that is not an id at all is `404 RESOURCE_ID_INVALID`. |
| 409 | `CARRIER_ACCOUNT_HAS_NUMBERS` | Retired: disconnecting no longer asks you to remove the numbers first. Its refusals are the three below. |
| 409 | `CARRIER_ACCOUNT_HAS_CONFIGURED_NUMBERS` | Disconnecting while a number still answers here. Send [`DELETE /carrier-accounts/{id}?restore_routing=true`](https://docs.goyappr.com/api-reference/carrier-accounts/delete) to move every such number back to the connection it was on in Telnyx first, or stop answering on each one. Nothing changed. |
| 409 | `CARRIER_NUMBERS_USED_BY_CAMPAIGNS` | Disconnecting while a campaign calls from one of the account's numbers. Give the campaign another number, then try again. Nothing changed. |
| 409 | `CARRIER_ACCOUNT_HAS_LIVE_CALLS` | Disconnecting while a call on the account is still running. Try again when it ends. Nothing changed. |
| 409 | `CONNECTION_ALREADY_CONNECTED` | The account already has its Call Control App. Disconnect and connect again to change it. |
| 409 | `CONNECTION_REQUIRED` | Choose the Call Control App before syncing, adding or configuring numbers. |
| 409 | `NUMBER_STILL_CONFIGURED` | [Removing a number from this workspace](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md) while it still answers its calls in Yappr. Stop answering here first (`DELETE /carrier-accounts/{id}/numbers/{phone_number_id}/configure`), so its calls go back where they went before, then remove it. Nothing changed. |
| 409 | `NUMBER_IN_CAMPAIGN` | [Removing a number from this workspace](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md) while a campaign that has not finished (a draft, scheduled, running or paused one) calls from it. Give the campaign another number, stop it, or delete a draft, first. Nothing changed. |
| 409 | `NUMBER_ON_LIVE_CALL` | [Removing a number from this workspace](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md) while a call on it is in progress. Try again when it ends. Nothing changed. |
| 409 | `NUMBER_REMOVED_FROM_TELNYX` | Configuring a number Telnyx no longer lists in your account. Nothing changed. |
| 409 | `NUMBER_NOT_READY` | Configuring a number whose status in Telnyx is not `active` (its `carrier_state.telnyx_status` says which). Try again once Telnyx shows it active, then sync. |
| 409 | `CARRIER_ACCOUNT_PAUSED` | Configuring a number while its account is paused because Telnyx refused the key or the app stopped working. Fix it in Telnyx, then [turn the account back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md). A pause for refused calls does not block configuring. |
| 409 | `NUMBER_ON_YAPPR_PLATFORM` | The number is on one of Yappr's own connections in Telnyx. Yappr does not move it. |
| 409 | `VOICE_NOT_READY` | Yappr cannot answer calls on numbers from your own Telnyx account right now, so the number was not moved. Try again later. |
| 409 | `PREVIOUS_ROUTING_GONE` | Stopping answering here, but the connection the number was on before is no longer in your Telnyx account. Choose a connection for the number in Telnyx. Nothing changed. |
| 409 | `NUMBER_ALREADY_REGISTERED` | The number is already live in this workspace, or it is in Yappr elsewhere and its holder still owns it, or holds a lapsed claim that a campaign or past calls still use there (that claim is switched off, not removed). The answer does not say which workspace. A number this workspace removed is added back with `POST /carrier-accounts/{id}/numbers`: `200` with the same record when the workspace still holds it as removed (a sync found it gone from Telnyx, or a disconnect kept it), `201` when it was removed with [Remove a number](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md), unless another workspace has taken it since: then this code, until that workspace removes it. Contact Yappr support to move a number that is yours in Telnyx. |
| 422 | `TELNYX_KEY_REJECTED` | Telnyx refused the API key. Check it is switched on in Telnyx and pasted in full. Nothing was saved. On a sync, a configure or a stop answering here, the account also pauses; [turn it back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md) once the key works. |
| 422 | `TELNYX_REFUSED_REQUEST` | Telnyx accepted the API key but refused this one request. Check the key's permissions in Telnyx, then try again. The account does not pause. Nothing changed. |
| 422 | `KEY_IS_YAPPR_ACCOUNT` | The key belongs to Yappr's own Telnyx account. Use a key from yours. |
| 422 | `KEY_ACCOUNT_MISMATCH` | The new key is from a different Telnyx account than the one connected. Nothing changed. |
| 422 | `OUTBOUND_PROFILE_NOT_FOUND` | That outbound voice profile is not in your Telnyx account. |
| 422 | `CONNECTION_CREATE_REJECTED` | Telnyx refused to create the Call Control App. Check your account's limits in Telnyx. |
| 422 | `CONNECTION_NOT_FOUND` | No Call Control App with that id in your Telnyx account. |
| 422 | `CONNECTION_WEBHOOK_MISMATCH` | The app's webhook URL is not the account's. The error body carries `webhook_url`; set it exactly, then try again. |
| 422 | `CONNECTION_HAS_NO_OUTBOUND_PROFILE` | Attach an outbound voice profile to the app (its Outbound tab). |
| 422 | `CONNECTION_INACTIVE` | The app is switched off in Telnyx. |
| 422 | `NUMBER_NOT_IN_YOUR_TELNYX_ACCOUNT` | Telnyx does not list the number as active in your account. Nothing was added. |
| 422 | `NUMBER_FORWARDS_ALL_CALLS` | Telnyx forwards every call to this number elsewhere, so Yappr would never get them. Turn off call forwarding for the number in Telnyx, then sync. Nothing changed. |
| 422 | `NUMBER_HAS_TRANSLATED_NUMBER` | The number has a translated number in Telnyx, so its calls arrive as another number. Remove it in Telnyx, then sync. Nothing changed. |
| 422 | `NUMBER_HAS_TECH_PREFIX` | Telnyx adds a tech prefix to the dialled number before the call arrives, so Yappr could not match it. Turn off the tech prefix for this number in Telnyx, then sync. Nothing changed. |
| 422 | `TELNYX_REFUSED_CHANGE` | Telnyx refused to move the number's connection. The message carries Telnyx's reason. Nothing changed. |
| 422 | `TOO_MANY_NUMBERS` | The account holds more than 10,000 numbers, more than Yappr syncs. A smaller account that takes more than one sync is read in parts (`complete: false`). Contact Yappr support. |
| 422 | `CARRIER_TEST_FAILED` | [`POST /carrier-accounts/{id}/reactivate`](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate) only: the test did not pass. The body carries `checks`; fix what they show in Telnyx. Nothing changed. |
| 422 | `INBOUND_NOT_AVAILABLE_ON_EXTERNAL_NUMBER` | Retired: no route answers it any more. [`PATCH /phone-numbers/{id}`](https://docs.goyappr.com/api-reference/phone-numbers/update) and [`POST /phone-numbers/configure`](https://docs.goyappr.com/api-reference/phone-numbers/configure) accept an `inbound_agent_id` and an `inbound_split` on a number from your own Telnyx account, as on any number; the agent answers once the number is configured (its `carrier_state.state` is `ready`). |
| 422 | `CARRIER_NUMBER_NOT_CALLABLE` | Switching on a number from your own Telnyx account that is not verified, or whose account is paused. Run the [test](https://docs.goyappr.com/api-reference/carrier-accounts/test.md), or [turn the account back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md). |
| 429 | `RATE_LIMITED` | The workspace's daily cap on carrier-account changes — not the per-key request limit, which is `RATE_LIMIT` on every route. Per workspace per day: 10 accounts connected, 20 updates, 10 app connections, 60 tests and reactivations, 48 sync runs (continuing a run is free), 200 numbers configured, 50 numbers added. `Retry-After` is the whole seconds until that cap's window resets. |
| 502 | `CONFIGURE_NOT_APPLIED` | Telnyx accepted the change to the number's connection but does not show it. Try again; configuring is safe to repeat. |
| 502 | `RESTORE_NOT_APPLIED` | Stop answering here: Telnyx accepted the change, but the number still reads back on the app, so its calls still reach Yappr. Nothing was recorded; try again in a minute. |
| 503 | `TELNYX_UNAVAILABLE`, `OWNERSHIP_CHECK_UNAVAILABLE` | Telnyx did not answer. Nothing changed; try again in a minute. |
| 503 | `SYNC_NOT_READY` | Sync: Yappr has not switched number syncing on yet. Nothing changed; it starts by itself. Read it without syncing: `sync.ready` on [`GET /carrier-accounts/status`](https://docs.goyappr.com/api-reference/carrier-accounts/status), or an account's `sync_status`. |

A call from one of these numbers that Telnyx refuses **before it rings** (the dial turned down, the key refused, the app gone) is recorded as `failed`: if [`POST /calls`](https://docs.goyappr.com/api-reference/calls/create) was placing it right away, it answers `422` with the reason in `error` and no webhook is sent; a queued or campaign call sends `call.failed` with the reason in `data.error_reason`. One Telnyx refuses **while it rings** ends as `failed`, and the agent's `call.failed` webhook carries `data.hangup_cause` `carrier_rejected` (SIP 401, 403 or 407) or `carrier_number_invalid` (404, 484 or 604). The SIP code is on the account, in `last_error.sip_code` — see [Bring your own carrier](https://docs.goyappr.com/concepts/bring-your-own-carrier.md). For an agent that runs a published workflow, `POST /calls` accepts a [call request](https://docs.goyappr.com/api-reference/calls/request-get.md) (`202`) and the call is placed afterwards. Pausing an account switches its numbers off, so a new request from one of them answers `400 INVALID_FROM_NUMBER`; `422` with `code` `carrier_account_paused` or `carrier_account_unavailable` is answered only while the number is still switched on although its account is paused or no longer connected, and nothing is accepted. A request already accepted waits while its number's account is paused: it is placed if the account is [turned back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md) before its `expires_at`, and otherwise ends `expired` with `error_code` `request_expired`. When the call is placed and your Telnyx account refuses it before it rings, the request ends `failed` with `error_code` `request_failed`, once, and its call is `failed`.

## Outbound calls and call requests

| Status | Code | What to do |
| - | - | - |
| 400 | `invalid_destination` | `to` cannot be dialled, and this is the only code that says so — it covers a number that is malformed (not E.164, or an Israeli number with a leading `0` after the country code or the wrong digit count), one that is well-formed but unreachable (a mobile prefix no longer in service, or a service number such as 1-800), and a number outside Israel: calls can only be placed to Israeli numbers (`+972`). Nothing was placed or charged; fix the number, since the same one fails identically every time. |
| 400 | `INVALID_FROM_NUMBER` | `from` is not a number calls can be placed from. Same format rule as `to`, and it has to be a number this workspace owns — list them with [`GET /phone-numbers`](https://docs.goyappr.com/api-reference/phone-numbers/list). A number from [your own Telnyx account](https://docs.goyappr.com/concepts/bring-your-own-carrier.md) answers this too while it is not verified, or while its account is `paused`, until the account is [turned back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md). |
| 422 | `PHONE_SYSTEM_OUTBOUND_OFF` | `from` is a `phone_system` number whose outbound calls are switched off on its SIP endpoint. Switch them on with `PATCH /sip-endpoints/{id}` `register.outbound.enabled: true`. Nothing was reserved or dialled. |
| 422 | `PHONE_SYSTEM_OUTBOUND_PAUSED` | `from` is a `phone_system` number whose outbound calls paused after your phone system refused the last calls. Fix it with your phone system provider, then send `register.outbound.enabled: true`. Nothing was reserved or dialled. |
| 422 | `PHONE_SYSTEM_NOT_CONNECTED` | `from` is a `phone_system` number whose SIP endpoint is switched off or not registered. Nothing was reserved or dialled. |
| 422 | `DESTINATION_OUTSIDE_PHONE_SYSTEM_COUNTRY` | `to` is outside Israel, and `from` is a `phone_system` number whose endpoint dials in `national` format. Call an Israeli number, or set `register.outbound.dial_format` to `e164` if your phone system allows other countries. |
| 400 | `SELF_CALL_NOT_ALLOWED` | `to` and `from` are the same number, so the agent would be calling itself. Give a different number to call. |
| 402 | `SPEND_BUDGET_REACHED` | This workspace set itself a monthly spending limit and this month's charges have reached it, so outbound phone calls asked for through the API or by a campaign are paused. Nothing is wrong with the account and nothing was charged. Read the limit and the month's spend on [`GET /billing`](https://docs.goyappr.com/api-reference/billing/get-status); raise it or turn it off with [`PATCH /billing`](https://docs.goyappr.com/api-reference/billing/spending-limit). It also lifts by itself at the start of the next calendar month. Every outbound PHONE call is covered, including a workflow agent's call request and one already accepted and waiting for its call window. Three things are not, and keep working while the limit is reached: calls coming in, browser rehearsals (`POST /calls {"type":"web"}`, which is what the dashboard's Test Call and a shared link both place) and the calls a shared link places. Say so to your users before they assume a paused workspace is a silent one. The workspace owner is emailed the first time the limit refuses a call in a month, once, so a stopped campaign does not become a hundred messages. |
| 404 | `WORKFLOW_AGENT_UNAVAILABLE` | The agent is here but cannot take the call — it is archived or switched off — or the `workflow_revision_id` you pinned is not one of that agent's own published versions. Pin an id from `GET /agents/{id}/workflow/versions`. An `agent_id` that names no agent in this workspace at all is `404 AGENT_NOT_FOUND`, as on every route. |
| 404 | `WORKFLOW_REQUEST_NOT_FOUND` | No such call request here. An id that is not an id at all is `404 RESOURCE_ID_INVALID`, as on every resource. |
| 400 | `EXTRACTION_DRY_RUN_INVALID` | [`POST /agents/{id}/extraction/dry-run`](https://docs.goyappr.com/api-reference/agents/extraction-dry-run) only. No `transcript`, an empty one, a turn with no `text`, a transcript over 400 turns or 40,000 characters, an `extraction_parameters` entry [`PATCH /agents/{id}`](https://docs.goyappr.com/api-reference/agents/update) would refuse (no `name`, no `description`, a `type` that is not `text`, `number`, `yes_no` or `date`) — in the words PATCH uses — an empty `extraction_parameters`, a `reference_time` that is neither a date nor a timestamp with its zone, or a field the endpoint does not take. The message names it. |
| 400 | `EXTRACTION_DRY_RUN_TRANSCRIPT_UNLABELLED` | [`POST /agents/{id}/extraction/dry-run`](https://docs.goyappr.com/api-reference/agents/extraction-dry-run) only. A `transcript` sent as text has a line that does not open with a speaker — `Agent:`, `User:`, `Caller:`, `Customer:`, `Voicemail:`, `סוכן:`, `משתמש:`, `מתקשר:`, `לקוח:` or `תא קולי:`. The message gives the line number. Put one turn on each line behind its speaker, or send the turns as an array. |
| 422 | `EXTRACTION_NOT_CONFIGURED` | The agent has no extraction parameters and the request sent no `extraction_parameters` either, so there is nothing to read the transcript for. Add them with [`PATCH /agents/{id}`](https://docs.goyappr.com/api-reference/agents/update), or send `extraction_parameters` on the request to try a set before saving it. A malformed entry in the `extraction_parameters` you sent is `400 EXTRACTION_DRY_RUN_INVALID` instead — that is a fact about the request, not about the agent. |
| 503 | `EXTRACTION_DRY_RUN_UNAVAILABLE` | The reader behind a dry run could not be reached. Nothing was read and nothing was changed — send the same request again. |
| 400 | `WEB_CALL_REQUEST_INVALID` | `POST /calls` with `"type": "web"` only. The body carried a field a browser session does not read — it takes `type`, `agent_id`, `metadata`, `variables`, `allowed_origins` and `lead_id`. `to`, `from` and `workflow_revision_id` belong to a phone call. Also a field of the wrong type: `metadata` and `variables` are objects and `allowed_origins` is an array of origins, never a single string. Nothing was minted. |
| 409 | `WORKFLOW_AGENT_INACTIVE` | The agent exists and may well be published — it is switched off. Send `PATCH /agents/{id}` with `{"is_active": true}` and ask again. A copy made with `POST /agents/{id}/duplicate` starts switched off, so this is the usual answer on the duplicate → publish → call path. A browser mint, `POST /calls {"type":"web"}`, answers the same way rather than a bare `400`. |
| 409 | `WORKFLOW_UNPUBLISHED` | Publish the agent, then place the call — or mint the browser session. A mint on a workflow agent that has never been published used to succeed and hand back a token that could only fail once a browser spent it. |
| 409 | `workflow_preparation_required` | The browser connection only, not `POST /calls`. The agent is a published workflow agent, which a one-shot browser connection cannot run: it opens no workflow run, so the call would have none of the agent's tools, before-call steps or follow-ups. Nothing was spent — the session token is still unused. Send the browser the exchange the mint's `protocol` field names — create a call request, poll it, then start it. |
| 409 | `WORKFLOW_IDEMPOTENCY_CONFLICT` | This `Idempotency-Key` was used with different call details. Send the original details, or use a new key. |
| 400 | `CALL_END_INVALID` | [`POST /calls/{id}/end`](https://docs.goyappr.com/api-reference/calls/end) only. The request carried a body with something in it; ending takes none (send no body, or `{}`), and the message names what to remove. Nothing was changed. |
| 409 | `CALL_NOT_PENDING` | [`POST /calls/{id}/end`](https://docs.goyappr.com/api-reference/calls/end) only. The call is not a browser session waiting to be opened: a browser opened it, it is a phone call, or it has settled. `status` in the body names its state. Nothing was changed. Ending is not a hang-up. |
| 503 | `CALL_END_UNAVAILABLE` | [`POST /calls/{id}/end`](https://docs.goyappr.com/api-reference/calls/end) only. The call could not be read or written just then. Nothing was changed; send the same request again. |
| 400 | `WEB_SESSION_CANCEL_INVALID` | A browser session's `cancel_url` only. The request carried a body with something in it, or one that is not JSON; cancelling takes none (send no body, or `{}` — both are the same request). Nothing was changed. |
| 409 | `WEB_SESSION_ALREADY_USED` | A browser session's `cancel_url` only. A browser already spent the token on a one-shot offer, so there is no unused session to cancel: end the call it started. A token that created a call request is not refused this way — the `cancel_url` cancels that request. Nothing was changed. |
| 403 | `WEB_SESSION_CANCELLED` | The browser connection, the browser's call request and its TURN credentials, with a session token. The token was taken back with its `cancel_url`, so it can no longer start a call. Mint a new session. A token that simply ran out is still `403` "This session token has expired" on the browser connection and the call request; TURN credentials answer a token that ran out, or was already used, `401` `UNAUTHORIZED`. |
| 401 | `UNAUTHORIZED` | The browser data plane only (`/web-call/…`, TURN credentials): no session token, share link or sign-in was sent, or the one sent is not one of ours. TURN credentials also answer it for a session token that ran out or was already used. The secret-key API answers `MISSING_KEY` / `INVALID_KEY` instead. |
| 401 | `CALL_REQUEST_KEY_REQUIRED` | A browser call request's read, cancel or start (and `POST /call-requests/{id}/start`) was sent with no `x-yappr-call-request-key`. Send the `start_capability` the create answered with. One that is sent and is not this request's is `403 WORKFLOW_START_DENIED`. |
| 400 | `CALL_REQUEST_FIELD_NOT_ALLOWED` | A browser call request made with a session token or share link carried `variables` or `metadata`. The session carries the values it was minted with: set them on `POST /calls {"type":"web"}` and send `{}`. Nothing was created. |
| 409 | `WEB_SESSION_PROTOCOL_OFFER` | A session minted for `protocol: "offer"` was used to create a call request. Send the browser's SDP offer to the browser connection with that token instead; call requests are for an agent whose mint answers `protocol: "call_request"`. Nothing was spent. |
| 409 | `WORKFLOW_DISPATCH_ALREADY_CLAIMED` | Placement has started, so the request can no longer be cancelled. Cancelling is not a hang-up — read the call instead. |
| 409 | `CALL_REQUEST_FINAL` | A cancel (`POST /call-requests/{id}/cancel`, the browser's `cancel_url`, or a session's `cancel_url` once its token created a call request) reached a request that already failed, expired or became a call. (The browser's own cancel of a started browser request whose call has not connected yet ends that call instead and answers `200`.) Nothing was written: the body carries its `status`, `error_code` and `call_id` (and, from a session's `cancel_url`, `request_id`). |
| 422 | `WORKFLOW_REQUEST_INVALID` | Send only `agent_id`, `to`, `from`, `variables`, `metadata`, `workflow_revision_id` and — if you send it at all — `type: "phone"` (any other `type` but `"web"` is named in the message, before `to` and `from` are asked for), with `variables` and `metadata` as objects, and an `Idempotency-Key` of 1–200 visible ASCII characters (`!` through `~`; a space is rejected). The message names what was refused — `Remove webhook_url.`, `variables is an object…`, the key — where it used to say "The call request is invalid." |
| 422 | `WORKFLOW_PIN_INVALID` | `workflow_revision_id` was sent for an agent that is not a workflow agent. Omit it — only workflow agents have versions to pin. A version that is not this agent's is the `404` above, not this. |
| 422 | `WORKFLOW_DEADLINE_INVALID` | The next calling window is further out than scheduling allows. Widen the window. |
| 422 | `OUTSIDE_CALL_WINDOW` | No future outbound calling window is configured. Configure one, then call. |
| 422 | `WEB_LEAD_UNSUPPORTED` | A browser mint (`POST /calls {"type":"web"}`) named a `lead_id` for a workflow agent whose browser call is created by a call request. That call is created by the [call request](https://docs.goyappr.com/api-reference/calls/request-create.md), which does not take a lead, so the lead would have been dropped. Nothing was minted — mint again without `lead_id`. |
| 503 | `WORKFLOW_ADMISSION_UNAVAILABLE` | **No call was placed.** Retry the same request with the same `Idempotency-Key`. One cause does not clear on retry: a pinned version that belongs to the agent but has no usable build behind it. If one `workflow_revision_id` fails every time while an unpinned call succeeds, pin a different version or drop the pin. |
| 502 | `VOICE_CONNECTION_REFUSED` | The browser connection only — the SDP offer a browser sends with its session token. The voice server answered the offer and refused it, so no call started. The call is recorded `failed` with `failure.code` `voice_connection_failed`, and the token is spent: mint a new session. Sending the same offer again gets the same answer; if it keeps happening, contact support with the call id. |
| 503 | `VOICE_UNAVAILABLE` | The browser connection only. The voice server did not answer the offer, or answered that it is busy or restarting. The call is recorded `failed` with `failure.code` `voice_unavailable` and the token is spent; mint a new session and try again in a moment. |
| 503 | `WEB_CALL_UNAVAILABLE` | The browser connection only (`type: "web"`). This deployment's data-plane key is not one a browser may hold, so the session was refused rather than minted with it — nothing was spent and no token was issued. A retry will not clear it on its own; contact support. A deployment with no data-plane key at all is not this: the session is minted and `connection.api_key` comes back `null`. |

## Test calls

[`POST /agents/{id}/test-call`](https://docs.goyappr.com/api-reference/agents/test-call) rings your own phone with an agent. It answers the outbound-call codes above where they apply (`invalid_destination`, `SELF_CALL_NOT_ALLOWED`, `BILLING_ERROR`, `SPEND_BUDGET_REACHED`, `WORKFLOW_UNPUBLISHED`, `WORKFLOW_ADMISSION_UNAVAILABLE`), and these of its own:

| Status | Code | What to do |
| - | - | - |
| 400 | `TEST_CALL_INVALID` | The body carried a field other than `to` and `variables`. There is no `from`: the number that calls is chosen for you. Nothing was placed. |
| 422 | `TEST_CALL_INVALID` | `to` is missing or not text, or `variables` is not an object of text values. Nothing was placed. |
| 409 | `AGENT_INACTIVE` | The agent is switched off. Switch it on, then test it. |
| 422 | `NO_CALLER_NUMBER` | The workspace has no phone number and no Yappr test line is available, so there is nothing to call from. Add a number with [`POST /phone-numbers/purchase`](https://docs.goyappr.com/api-reference/phone-numbers/purchase), or test in the browser. |
| 422 | `DESTINATION_ON_DNC` | The number is on your Do-Not-Call list. Remove it from the list to test with it. Nothing was placed. |
| 422 | `OUTSIDE_CALL_WINDOW` | It is outside your workspace's outbound call window. A test is refused rather than scheduled, because someone is waiting on the phone. Test in the browser, or call during the window. |
| 503 | `AT_CAPACITY` | Every line is busy. A test is refused rather than queued; try again in a minute. |
| 503 | `TEST_CALL_UNAVAILABLE` | The workspace's numbers or the agent could not be read just now. Nothing was placed; send the same request again. |

## The browser data plane

A page that runs a call — the Web SDK, a shared link's page, the dashboard's test tab — talks to a
handful of routes on the same host as this API, `https://api.goyappr.com`, that never take the
secret key: `POST /web-call` (the browser's offer), `POST /turn-credentials`, `POST /web-call/cancel`
and the browser's call request (`/web-call/call-requests…`). They take a session token from
[`POST /calls {"type":"web"}`](https://docs.goyappr.com/api-reference/calls/create) as `x-yappr-web-token`, a call request's
capability as `x-yappr-call-request-key`, a shared link, or a dashboard sign-in. `GET /` lists them
under `browser`, and each is an operation in the OpenAPI file with that host as its server. Their
refusals have the same shape as every other here; a credential that is missing or not ours is
`401 UNAUTHORIZED` rather than `MISSING_KEY` / `INVALID_KEY`. The offer's `VOICE_CONNECTION_REFUSED`
and `VOICE_UNAVAILABLE` (in the table above) spend the token: mint a new session before connecting
again.

## Forwarded service codes

Two routes pass a failure through from a service behind the API instead of translating it, so they can answer with a code that is not in any table above. Treat these by HTTP status, not by code — the codes are not part of the published contract and can change without notice.

| Route | What can arrive | What to do |
| - | - | - |
| The connected-account routes (`/tool-connections`, `/tool-connection-auth-attempts`, `GET /tool-apps/connection-options`) | The connections service's own body and status, unchanged — so besides the `CONNECTION_*` codes above, a code this page does not list can arrive. Its status is always one these routes already use. | Branch on the status, never on the code: it means what that status means for the documented codes above. `503` is the common case — retry the same request, and if it keeps failing, reconnect the account rather than looping. |
| The app catalog (`GET /tool-apps…`) | A code the catalog service raised, republished as `WORKFLOW_` followed by that code in capitals — so a `WORKFLOW_*` code outside the *Tool and app catalogs* table. It arrives with `422` or `503`. | `503`: retry the same request unchanged. `422`: the catalog rejected the request itself — re-read the app or action you asked for and correct the query. |

Neither carries customer data, and neither is worth branching on. Report the code if you need support to trace it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.