> ## 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.

# Duplicate Agent

> Requires agents:create. Copies the source agent's ordinary settings (voice, model, VAD, timeouts, background sound, extraction parameters, and the rest) and its current draft workflow document — bindings, positions, everything — into one new agent, created switched off and unpublished. Editing the source afterwards never changes the copy and editing the copy never changes the source: the two agents are independent from the moment this call returns, though the tools behind them are shared (below). What is not copied is the phone side and everything that names the source specifically: no phone number or SIP endpoint is repointed, no shared web-call link is minted, and history (call logs, workflow revisions, eval suites, in-flight promotions) starts empty on the copy. By default the copy's workflow bindings keep the source's exact tool_revision_id pins, so it shares its source's tools rather than getting new ones. One live tool serves both agents: a later PATCH /tools/{id} — the natural first move for giving the second client its own webhook — changes it for the first agent too, and archiving a shared tool affects both. Send fork_tools true to give the copy tools of its own in the same call: every tool the copy would share becomes a new tool named "<tool> (copy)", then "(copy 2)", "(copy 3)" for later forks of the same tool, and the copy's bindings (and the step labels that still carry the source tool's name) are repointed at them. The fork runs on the server to the end even if you disconnect. What it cannot carry: header values and the private part of a URL are never readable, so each forked HTTP tool keeps its header names with empty values and its address without the private query — tool_fork lists which ones need a value entered (PATCH /tools/{id}) before the copy takes calls. fork_tools also needs tools:create on the key. Publishing the copy, and pointing any number at it, are separate calls you make afterwards.


Copy an agent with `agents:create`. The copy gets the source's ordinary settings and its current
draft workflow — bindings, positions, everything — as one new agent, created switched off and
unpublished. From the moment this call returns, the two **agents** are independent: editing one
agent never touches the other. Their **tools are not**, unless you send `"fork_tools": true` — by
default the copy's bindings point at the source's exact tool revisions, so one tool serves both
agents. See [giving the copy its own tools](#giving-the-copy-its-own-tools) before you repoint a
copied agent's webhook.

```bash theme={null}
curl --request POST "$YAPPR_API_URL/agents/$SOURCE_AGENT_ID/duplicate" \
  --header "Authorization: Bearer $YAPPR_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: duplicate-agent-request-2026-0001" \
  --data '{}'
```

| Field | Duplicate |
| - | - |
| `name` | Optional. Defaults to `"<source name> (copy)"`, or the Hebrew equivalent when the copy's language is `he`. The name is not checked against other agents: a second copy of the same agent without a `name` is a second agent called `"<source name> (copy)"`. Send a name to tell copies apart. |
| `description` | Optional, at most 2,000 characters. Omit to copy the source's; send `null` to clear it on the copy. |
| `language` | Optional: any of the [languages](https://docs.goyappr.com/api-reference/agents/languages.md), or `multi`. Omit to copy the source's. |
| `model` | Optional. Omit to copy the source's [model](https://docs.goyappr.com/api-reference/agents/models.md). Send `gemini-3.1-flash-live` or `gemini-3.8-live` to give the copy that model (the way to run one agent on both side by side), `null` to make it automatic, or `gpt-live` for a source that already speaks with a `gpt-live` voice. The copy keeps the source's voice, so the model must be one that voice belongs to; otherwise `422 WORKFLOW_DUPLICATE_MODEL_INVALID` and nothing is copied — duplicate without `model`, then `PATCH` the copy with `model` and a voice of the other family. |
| `fork_tools` | Optional, `true` or `false` (default). `true` gives the copy a tool of its own for every tool it would share, in this same call — see [below](#giving-the-copy-its-own-tools). Needs `tools:create` on the key as well. |
| `Idempotency-Key` header | Required; 16–128 letters, digits, `_` or `-`. |

The body — or no body at all — is optional. "Copy this agent" is the whole request in the common
case; `{}` and an empty body mean the same thing.

The response is the copy in the same body shape [Create agent](https://docs.goyappr.com/api-reference/agents/create.md)
returns, plus `idempotency_key`: the `Idempotency-Key` you sent, echoed back so the response
confirms which key made this copy — and, on a `200` replay, that the same key made the same one.

## What a copy does and does not carry

**Copied:** every ordinary setting (voice and model together, VAD, timeouts,
background sound, extraction parameters, and the rest), and the source's current draft workflow
document, including its tool bindings.

**Shared, not copied — the tools.** A binding keeps the exact `tool_revision_id` the source uses,
so the copy points at the same tools rather than getting new ones. There is one live tool behind
both agents: a later `PATCH /tools/{id}` — the natural first move for "give the second client their
own webhook" — changes the tool for the first client too, and archiving a tool affects both agents.

Until you send `fork_tools` (below), the two agents call the same endpoint with the same
credentials.

## Giving the copy its own tools

Send `"fork_tools": true` and the copy gets a separate tool for every tool it would otherwise share
with another agent, in the same call:

```bash theme={null}
curl --request POST "$YAPPR_API_URL/agents/$SOURCE_AGENT_ID/duplicate" \
  --header "Authorization: Bearer $YAPPR_API_KEY" \
  --header "Content-Type: application/json" \
  --header "Idempotency-Key: duplicate-agent-request-2026-0002" \
  --data '{"name": "Store Two", "fork_tools": true}'
```

```json theme={null}
{
  "id": "5d9703df-689f-4cf3-b556-ed185969932d",
  "name": "Store Two",
  "is_active": false,
  "published_workflow_revision_id": null,
  "idempotency_key": "duplicate-agent-request-2026-0002",
  "tool_fork": {
    "status": "complete",
    "forked": [
      {
        "tool_id": "d6b53a3b-0f7e-4c52-9d8e-1a2b3c4d5e6f",
        "name": "Store orders (copy)",
        "source_tool_id": "8c1a2678-3b4d-4e5f-8a9b-0c1d2e3f4a5b",
        "source_name": "Store orders",
        "header_names": ["Authorization"],
        "url_private_part_removed": false,
        "needs_values": true
      }
    ],
    "kept": [],
    "shared": []
  }
}
```

(Other agent fields are left out above.)

* **Names.** Each new tool is named `"<tool> (copy)"`; when that name is already taken — a second
  copy of the same agent — the next is `"(copy 2)"`, then `"(copy 3)"`. Names follow the copy's
  language (`"(עותק)"` for `he`).
* **What is carried.** Everything the tool does: its kind, address, method, schemas, effect,
  timeout, call-details setting, connected account or transfer number. The copy's bindings, and any
  step label that still reads the source tool's name, are repointed at the new tools.
* **What is not.** Header **values** and the **private part of a URL** are never readable, so they
  cannot be copied — they are the credentials the second client is meant to have its own of. Each
  forked HTTP tool keeps its header **names** with empty values, and its query parameter **names**
  each written `name=`. `header_names` and `url_private_part_removed` say what to enter with
  [`PATCH /tools/{id}`](https://docs.goyappr.com/api-reference/tools/update) before the copy takes calls; `needs_values` is
  `true` when there is anything to enter. The copy is switched off and unpublished, so nothing calls
  a half-filled tool meanwhile.
* **It stays said.** After this answer, [`GET /tools/{id}`](https://docs.goyappr.com/api-reference/tools/get) on the new
  tool lists what is still empty in `empty_header_names` and `empty_query_names`, and checking or
  publishing the copy's workflow raises a `tool_values_missing` warning naming the tool, until the
  values are sent.
* **It finishes on the server.** The fork runs to the end even if you disconnect. `status` is
  `complete` when the copy shares nothing any more, `partial` when some tools are still shared
  (listed in `shared`), and `failed` when none could be forked. Repeat the **same request with the
  same `Idempotency-Key`** to finish a partial or failed fork: the copy is replayed, tools the first
  request already made are replayed rather than made twice, and tools the copy already owns are
  listed in `kept`.
* **Scopes.** Forking creates tools, so the key needs `tools:create` as well as `agents:create`.
  Without it the request is refused with `403 INSUFFICIENT_SCOPE` and nothing is copied.

To give a copy made without `fork_tools` its own endpoint for one tool by hand: create a tool with
[`POST /tools`](https://docs.goyappr.com/api-reference/tools/create), then point the copy's binding at it with
[`POST /agents/{id}/workflow/rebind`](https://docs.goyappr.com/api-reference/workflows/rebind).

**Not copied — the phone side:** no phone number or SIP endpoint is repointed at the copy, and no
shared web-call link is minted for it. A copy answers nothing until you configure that yourself.

**Not copied — the legacy webhook settings:** an agent that still has the older per-agent webhook
configuration keeps it to itself. The webhook address, the events it fires on and its custom
headers are **not** carried over, so a shared secret in a header never lands in a second agent by
accident. Set them again on the copy if it needs them.

**Not copied — history:** call logs, workflow revisions, eval suites and any in-flight settings
promotion all start empty on the copy. It has zero revisions and no published revision.

**The result:** a copy is created both **unpublished** (`published_workflow_revision_id: null`) and
**switched off** (`is_active: false`) — two independent reasons it takes no calls the moment it
exists. Publish it with the workflow endpoints, and point a number or a split at it, as separate
calls afterwards. See [Get workflow](https://docs.goyappr.com/api-reference/workflows/get.md) and
[Publish workflow](https://docs.goyappr.com/api-reference/workflows/publish.md).

Publishing does not switch it on. Until you send `PATCH /agents/{id}` with `{"is_active": true}` the
copy answers nothing: [`POST /call-requests`](https://docs.goyappr.com/api-reference/calls/request-create) refuses it with
`409 WORKFLOW_AGENT_INACTIVE`, and a phone call refuses it too. Duplicate, publish, **switch on**,
then call.

## If the source's workflow uses a tool that no longer resolves

The source's bindings are re-validated before the copy is written. A tool that has been archived
since the source last saved, or an app tool whose connected account is no longer connected, makes
the duplicate fail loudly instead of producing a copy nobody can publish. The refusal names the
step and the tool, and `issues[]` carries one entry per binding, as a [save](https://docs.goyappr.com/api-reference/workflows/save.md#refusals-name-the-field)
does — `tool_archived` (or `connection_unavailable`) at `/bindings/<n>/tool_revision_id`, with
`node_id`, `label` and `tool_name`:

```json theme={null}
{
  "error": "The step \"Confirm the branch\" uses \"Branch lookup\", which is archived, so this agent cannot be copied as it stands. Restore the tool, or remove the step from the original, then copy again.",
  "code": "WORKFLOW_REFERENCE_INVALID",
  "issues": [
    {
      "code": "tool_archived",
      "path": "/bindings/0/tool_revision_id",
      "message": "Binding \"branch-lookup\": the tool \"Branch lookup\" is archived, so the step \"Confirm the branch\" cannot run it. Restore the tool, or remove the step. POST /tools/7c9e6679-7425-40de-944b-e07fc1f90ae7/restore brings it back as it was.",
      "node_id": "confirm_branch",
      "label": "Confirm the branch",
      "tool_name": "Branch lookup"
    }
  ]
}
```

with HTTP `409`. Nothing is written. [Restore the tool](https://docs.goyappr.com/api-reference/tools/restore.md) or remove the step on
the **source**, then duplicate again.

## Idempotency

The `Idempotency-Key` is scoped to this company, this endpoint, **and the source agent id**: the
same key replayed against the same source returns the original copy with `200`. The same key aimed
at a different source — or one already spent on `POST /agents` — is `409 AGENT_IDEMPOTENCY_CONFLICT`,
not a silent replay of the wrong copy. If the copy a key made has since been archived or removed, the
key cannot be reused: that answers `410 AGENT_CREATION_GONE`. Use a new key to make another copy.


## OpenAPI

````yaml POST /agents/{id}/duplicate
openapi: 3.1.0
info:
  title: Yappr API
  description: >
    Create and manage AI voice agents, purchase phone numbers, configure tools,
    and initiate calls — all via REST.
  version: 1.0.0
  contact:
    url: https://goyappr.com
servers:
  - url: https://api.goyappr.com
    description: Production
security:
  - apiKey: []
paths:
  /agents/{id}/duplicate:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Agents
      summary: Duplicate agent
      description: >
        Requires agents:create. Copies the source agent's ordinary settings
        (voice, model, VAD, timeouts, background sound, extraction parameters,
        and the rest) and its current draft workflow document — bindings,
        positions, everything — into one new agent, created switched off and
        unpublished. Editing the source afterwards never changes the copy and
        editing the copy never changes the source: the two agents are
        independent from the moment this call returns, though the tools behind
        them are shared (below). What is not copied is the phone side and
        everything that names the source specifically: no phone number or SIP
        endpoint is repointed, no shared web-call link is minted, and history
        (call logs, workflow revisions, eval suites, in-flight promotions)
        starts empty on the copy. By default the copy's workflow bindings keep
        the source's exact tool_revision_id pins, so it shares its source's
        tools rather than getting new ones. One live tool serves both agents: a
        later PATCH /tools/{id} — the natural first move for giving the second
        client its own webhook — changes it for the first agent too, and
        archiving a shared tool affects both. Send fork_tools true to give the
        copy tools of its own in the same call: every tool the copy would share
        becomes a new tool named "<tool> (copy)", then "(copy 2)", "(copy 3)"
        for later forks of the same tool, and the copy's bindings (and the step
        labels that still carry the source tool's name) are repointed at them.
        The fork runs on the server to the end even if you disconnect. What it
        cannot carry: header values and the private part of a URL are never
        readable, so each forked HTTP tool keeps its header names with empty
        values and its address without the private query — tool_fork lists which
        ones need a value entered (PATCH /tools/{id}) before the copy takes
        calls. fork_tools also needs tools:create on the key. Publishing the
        copy, and pointing any number at it, are separate calls you make
        afterwards.
      operationId: duplicateAgent
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            type: string
            pattern: ^[A-Za-z0-9_-]{16,128}$
          description: >-
            Scoped to this company and this endpoint, and keyed together with
            the source agent id — the same key replayed against the same source
            returns the same copy with 200; the same key aimed at a different
            source, or already spent on POST /agents, is a 409. Retry a lost
            response with the same key.
      requestBody:
        required: false
        description: >-
          The body, or no body at all, is optional — "copy this agent" is the
          whole request in the common case.
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: >-
                    Defaults to "<source name> (copy)", or the Hebrew equivalent
                    when the copy's language is he.
                description:
                  type: string
                  nullable: true
                  maxLength: 2000
                  description: >-
                    Omit to copy the source's description verbatim; send null to
                    clear it on the copy.
                language:
                  type: string
                  enum:
                    - he
                    - en
                    - ar
                    - ru
                    - fr
                    - es
                    - de
                    - it
                    - pt
                    - nl
                    - tr
                    - pl
                    - uk
                    - hi
                    - ja
                    - ko
                    - zh
                    - multi
                    - he-IL
                    - iw
                    - en-US
                    - en-GB
                  description: >-
                    Omit to copy the source's language. Any of the call
                    languages, or multi; he-IL and iw are stored as he, en-US
                    and en-GB as en.
                model:
                  type: string
                  nullable: true
                  enum:
                    - gemini-3.1-flash-live
                    - gemini-3.8-live
                    - gpt-live
                  description: >
                    Omit to copy the source's `model`. Send one to give the copy
                    a different model of the source's own voice family — the way
                    to run the same agent on both Gemini models side by side —
                    or null to make the copy automatic. The copy keeps the
                    source's voice, so the model has to be one that voice
                    belongs to: a Gemini model (or null) for a Gemini voice,
                    `gpt-live` for a GPT Live voice. To move the copy to the
                    other family, duplicate it and then PATCH /agents/{id} with
                    `model` and a voice of that family.
                fork_tools:
                  type: boolean
                  default: false
                  description: >
                    true gives the copy its own copy of every tool it would
                    otherwise share with the source, in this same call, and adds
                    tool_fork to the response. Not part of the copy's identity:
                    repeating the request with the same Idempotency-Key and
                    fork_tools true returns the same copy and finishes a fork
                    that was partial — tools it already made are replayed, never
                    made twice. Forked tools are named in the copy's language.
                    Requires tools:create as well as agents:create.
      responses:
        '200':
          description: >-
            Idempotent replay of the same key with the same request; the
            original copy is returned unchanged, with idempotency_key echoing
            the key that made it. With fork_tools true the fork runs again and
            finishes whatever the first request left shared.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicatedAgent'
        '201':
          description: >-
            The copy, in the same body shape POST /agents returns, plus
            idempotency_key echoing the Idempotency-Key you sent.
            published_workflow_revision_id is null and is_active is false. With
            fork_tools true, tool_fork says what the fork did.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DuplicatedAgent'
        '400':
          description: >
            AGENT_IDEMPOTENCY_REQUIRED — the Idempotency-Key header is missing
            or outside 16–128 letters, digits, underscores or hyphens.
            AGENT_IDEMPOTENCY_DUPLICATED — it arrived more than once; send
            exactly one.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            INSUFFICIENT_SCOPE — fork_tools true was sent with a key that lacks
            tools:create. Nothing was copied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            AGENT_NOT_FOUND — the source agent is absent, archived, or belongs
            to another company. WORKFLOW_NOT_FOUND — it is there but is not a
            workflow agent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >
            AGENT_IDEMPOTENCY_CONFLICT — the Idempotency-Key was already used
            for a different copy (a different source, or a different accepted
            body). WORKFLOW_REFERENCE_INVALID — the source's workflow binds a
            tool that is archived, or an app tool whose account is no longer
            connected; nothing is written. The error names the step and the
            tool, and issues[] has one entry per binding (tool_archived or
            connection_unavailable at /bindings/<n>/tool_revision_id, with
            node_id, label and tool_name). Restore the tool, or remove the step
            on the source, then duplicate again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '410':
          description: >-
            AGENT_CREATION_GONE — the copy this key made has since been archived
            or removed. The key cannot be reused; use a new key to make another
            copy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >
            WORKFLOW_DUPLICATE_REQUEST_INVALID — the body is not JSON, or
            carries a field other than name, description, language, model or
            fork_tools, or one of them out of range (fork_tools is true or
            false; model is one of the three ids or null); the message starts
            with the field at fault. WORKFLOW_DUPLICATE_MODEL_INVALID — the
            model is not one the source's voice belongs to (a Gemini model or
            null on a GPT Live source, or `gpt-live` on a Gemini-voice source);
            nothing was copied. WORKFLOW_DOCUMENT_INVALID — the source's own
            workflow document fails its shape check; open it, save it once, and
            duplicate again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            WORKFLOW_STORAGE_UNAVAILABLE — copying is unavailable. Retry the
            exact request with the same Idempotency-Key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DuplicatedAgent:
      description: >-
        The copy, as POST /agents answers with it; tool_fork is present only
        when fork_tools was true.
      allOf:
        - $ref: '#/components/schemas/Agent'
        - type: object
          properties:
            tool_fork:
              $ref: '#/components/schemas/ToolFork'
    Error:
      type: object
      required:
        - error
        - code
      description: >
        Every error response - the secret-key API and the browser data plane
        alike - carries a

        human-readable `error` and a stable machine `code`, and a refusal that
        names what is

        wrong with the request carries `issues[]` too. Branch on `code`, never
        on the `error`

        text. A refusal that names nothing more specific carries the code its
        status means:

        `BAD_REQUEST` (400), `UNAUTHORIZED` (401, the browser data plane; the
        secret-key API

        answers `MISSING_KEY`, `INVALID_KEY` or `EXPIRED_KEY`), `BILLING_ERROR`
        (402),

        `FORBIDDEN` (403), `NOT_FOUND` (404), `METHOD_NOT_ALLOWED` (405),
        `CONFLICT` (409),

        `GONE` (410), `PAYLOAD_TOO_LARGE` (413), `UNSUPPORTED_MEDIA_TYPE` (415),

        `UNPROCESSABLE_REQUEST` (422), `RATE_LIMIT` (429), `INTERNAL_ERROR`
        (500),

        `UPSTREAM_ERROR` (502), `SERVICE_UNAVAILABLE` (503), `UPSTREAM_TIMEOUT`
        (504). Some

        refusals add members of their own beside these (a call request's
        `status`, a workflow's

        `current_version`); the operation says which.
      properties:
        error:
          type: string
          description: The refusal, in one sentence for a person. Its wording may change.
        code:
          type: string
          description: The stable code to branch on.
        issues:
          type: array
          description: >
            Each thing at fault, on a 400 or 422 that names them: every query
            parameter or body field, not just the first. `path` is the
            parameter's name or the field's location.
          items:
            type: object
            required:
              - code
              - message
            properties:
              code:
                type: string
                description: >-
                  query_param_unknown, query_param_repeated, query_param_blank,
                  query_param_invalid, field_unknown, field_required,
                  field_invalid, or the route's own word.
              path:
                type: string
              message:
                type: string
    Agent:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        execution_version:
          type: string
          enum:
            - legacy
            - workflow_v1
          readOnly: true
          description: >-
            Authoring ownership assigned by Yappr. workflow_v1 can be an
            unpublished draft; this field does not prove call readiness.
        published_workflow_revision_id:
          type: string
          format: uuid
          nullable: true
          readOnly: true
          description: >-
            Null until explicit workflow publication. Cannot be set by agent
            create or PATCH.
        live:
          type: boolean
          readOnly: true
          description: >
            On GET /agents and GET /agents/{id}: whether callers reach this
            agent right now. A workflow_v1 agent is live when it is active and a
            version of its workflow is published; a saved draft that was never
            published is not live. A legacy agent (type prompt or flow) has
            nothing to publish and is live whenever it is active, with
            published_workflow_revision_id null. A deactivated agent is never
            live. For a workflow_v1 agent the dashboard's "Live · version N"
            badge is the same fact; N is published.version on GET
            /agents/{id}/workflow.
        inbound:
          type: object
          readOnly: true
          description: >
            On GET /agents and GET /agents/{id}: what routes inbound calls to
            this agent - active phone numbers that answer with it (as the
            number's agent or the other half of its A/B split) and active SIP
            endpoints. Empty lists mean no inbound route reaches it; the member
            is absent when the routes could not be read. A key reads each route
            as its scopes allow: without `phone_numbers:search` a number's
            `number` and `friendly_name` are null, and without
            `sip_endpoints:read` an endpoint's `name` is null.
          properties:
            phone_numbers:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  number:
                    type: string
                    nullable: true
                    example: '+972501234567'
                  friendly_name:
                    type: string
                    nullable: true
            sip_endpoints:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  name:
                    type: string
                    nullable: true
        type:
          type: string
          enum:
            - workflow
            - prompt
            - flow
          description: >
            `workflow` on every agent with `execution_version: workflow_v1` —
            the only kind that can be created. Such an agent also **omits**
            `system_prompt`, `flow_config`, `webhook_url`, `webhook_events`,
            `webhook_headers` and `tools`: it has no such things, and returning
            them as nulls read as the retired kind. Its instructions, graph and
            tool bindings are its workflow document — `GET
            /agents/{id}/workflow`.

            `prompt` and `flow` appear only on agents created before the
            workflow engine, which keep their old response shape unchanged.
            `prompt` (legacy): a single `system_prompt` drives the call; the LLM
            decides when to call attached tools. `flow`: the call is driven by a
            `flow_config` graph. `type` is **immutable** post-create.
        flow_config:
          oneOf:
            - $ref: '#/components/schemas/FlowConfig'
            - type: 'null'
          description: >
            Legacy agents only, and absent from a `workflow` agent's response.
            The flow graph. Required when `type='flow'`, must be omitted/null
            when `type='prompt'`.
        system_prompt:
          type: string
          nullable: true
          description: >-
            Legacy agents only, and absent from a `workflow` agent's response —
            read its workflow document instead. {{VariableName}} is filled in
            from the call's variables. Random variations: {{Hi|Hello|Hey}} (two
            or more options separated by |) says one option, picked once per
            call; see [Random
            variations](/api-reference/agents/create#random-variations).
        description:
          type: string
          nullable: true
        voice:
          type: string
          enum:
            - Michal
            - Yonatan
            - David
            - Rachel
            - Gil
            - Noa
            - Maya
            - Adam
            - Shira
            - Avigail
            - Amir
            - Liat
            - Omer
            - Tamar
            - Tom
            - Benny
            - Nir
            - Natan
            - Yael
            - Dvora
            - Yosef
            - Shir
            - Anat
            - Ariel
            - Roi
            - Shlomo
            - Dana
            - Alon
            - Ruth
            - Yuval
            - Keren
            - Eitan
            - Hila
            - Ido
            - Boaz
            - Tali
            - Erez
            - Efrat
          description: >
            The persona the agent speaks in. A voice belongs to one of Yappr's
            two voice families, so naming a voice on its own still chooses the
            family — and with it the model family (`model` below) — and no
            existing client has to change. There is no separate engine field,
            and `engine` / `engine_voice` are rejected if you send them.

            `Keren, Eitan, Hila, Ido, Boaz, Tali, Erez, Efrat` are the voices of
            `gpt-live`, available to every workspace. Agents on these voices
            handle their own turn-taking and expressiveness, so `temperature`,
            `vad_stop_secs`, `vad_start_secs` and `vad_confidence` are rejected
            on them, and they cannot be used on a `type='flow'` agent. The other
            thirty are the voices of both Gemini models. Any other name returns
            `400` listing every voice you may use.

            Always the name the agent actually speaks in, whichever family it is
            on.
        model:
          type: string
          nullable: true
          enum:
            - gemini-3.1-flash-live
            - gemini-3.8-live
            - gpt-live
          description: >
            The voice model the agent runs on, as you chose it; null means
            **automatic**, where Yappr picks by the agent's language (see
            `resolved_model`). See the models page for what each model is and
            how to choose.

            A `gpt-live` agent always reads `gpt-live`: GPT Live is chosen
            through its voices, never automatically.
        resolved_model:
          type: string
          readOnly: true
          enum:
            - gemini-3.1-flash-live
            - gemini-3.8-live
            - gpt-live
          description: >
            The model the agent's calls run on: `model` when it is set, and
            otherwise what automatic chooses today for the agent's language
            (Hebrew and multilingual run `gemini-3.1-flash-live`, every other
            language `gemini-3.8-live`). Read-only, and it can change for an
            automatic agent when Yappr moves a language to a better model; a
            pinned `model` never moves.
        background_sound:
          type: string
          nullable: true
          enum:
            - call_center
            - open_office
            - cafe
            - outdoor
          description: >-
            Ambient background sound mixed under the agent's voice during calls.
            Null means silent (default).
        background_sound_volume:
          type: number
          minimum: 0
          maximum: 0.6
          default: 0.3
          description: >-
            Volume of the background sound, 0.0–0.6. Capped to protect
            turn-taking.
        language:
          type: string
          enum:
            - he
            - en
            - ar
            - ru
            - fr
            - es
            - de
            - it
            - pt
            - nl
            - tr
            - pl
            - uk
            - hi
            - ja
            - ko
            - zh
            - multi
          description: >
            The language the agent speaks and listens for on calls, as its short
            code, or `multi` for a multilingual agent that answers in the
            caller's language and switches when they do. Each language gets its
            own speaking rules (politeness, gender, how numbers, dates and
            prices are said). See the Languages page.
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: >-
            How varied the agent's wording is. On the Gemini voices a value
            below 0.3 is stored and returned as you sent it, and the agent
            speaks as if it were 0.3: lower values sometimes made a call open on
            a word or two and a pause. The expressive voices do not take it.
        greeting_message:
          type: string
          nullable: true
          description: >-
            The line the agent opens the call with when agent_speaks_first is
            true, said word for word in the agent's language (a second-family
            voice can still word it slightly differently). On the standard
            voices a caller's brief hello in the first few seconds of the line
            does not interrupt it; a caller who keeps talking over it does.
            {{FirstName}} is filled in from the call's variables or the lead's
            name, or left out with the space before it when there is none. Send
            null to clear it and let the agent open in its own words. Editable
            here and on PATCH /agents/{id}; on a flow agent the start node's own
            opening overrides it. Random variations: {{Hi|Hello|Hey}} (two or
            more options separated by |) says one option, picked once per call;
            see [Random
            variations](/api-reference/agents/create#random-variations). On a
            workflow agent it may read a Before-call step's result,
            {{before.<step_id>.<field>|<fallback>}}, said word for word: the
            value, else the fallback, else the rest of the line; Check and
            Publish refuse a step the workflow does not have. See [Opening line
            from a Before step](/api-reference/workflows/greeting-from-before).
        agent_speaks_first:
          type: boolean
        vad_stop_secs:
          type: number
          minimum: 0.05
          maximum: 5
          default: 0.5
          description: >
            Seconds of silence that end the caller's turn. Lower answers sooner
            and cuts a caller who pauses mid-thought; higher waits longer before
            replying. Below 0.5 s the agent may start answering half a sentence.
        vad_start_secs:
          type: number
          minimum: 0.05
          maximum: 2
          default: 0.2
          description: >
            Seconds of speech that count as the caller starting to talk. It also
            sets how much of the moment before that is kept, so an interruption
            does not lose the caller's first word.
        vad_confidence:
          type: number
          minimum: 0
          maximum: 1
          default: 0.7
          description: >
            How sure the agent must be that it is hearing speech. Below the 0.7
            default the agent reacts more eagerly — useful for quiet callers,
            and more likely to react to background noise on a noisy line. Two
            things read it, and they read it differently. How readily the caller
            can cut the agent off mid-sentence follows the number continuously,
            so any change moves it. Where the caller's turn begins and ends is a
            two-position switch either side of the 0.7 default: at or above it
            the agent is deliberate about deciding the caller has started or
            stopped, below it eager. For that half, 0.05 and 0.69 behave
            identically, and so do 0.70 and 1.00 — tune it by moving across the
            default, not by nudging it.
        silence_timeout_secs:
          type: number
          minimum: 10
          maximum: 900
          default: 60
          description: >-
            Seconds of caller silence before auto-hangup. Prevents idle calls
            wasting credits.
        idle_reminder_count:
          type: integer
          minimum: 0
          maximum: 3
          default: 0
          description: >
            How many times the agent asks a silent caller whether they are still
            there before `silence_timeout_secs` hangs up. Each reminder is said
            when the silence timeout runs out, and the timer starts again after
            it; the caller speaking resets the count. 0 (the default) hangs up
            at the first timeout without asking. See [Idle
            reminders](/api-reference/agents/idle-reminders).
        idle_reminder_text:
          type: string
          nullable: true
          maxLength: 200
          description: >
            What the agent says as each reminder, word for word. Null (the
            default) is a short line in the call's language ("Hello, are you
            still there?" in English); for a language without a fixed line, the
            agent asks in its own words in the call's language. A blank string
            is stored as null.
        max_continuous_speech_secs:
          type: number
          minimum: 0
          maximum: 300
          default: 120
          description: >-
            Max seconds one party can speak non-stop before auto-hangup. Catches
            answering machines. 0 = disabled.
        max_call_duration_secs:
          type: number
          minimum: 0
          maximum: 3600
          default: 600
          description: >-
            Hard cap on total call duration regardless of activity. 0 = no cap
            of the agent's own; the platform still ends the call after 65
            minutes (3900 s), with the disconnect reason `Platform call limit
            reached`. A call is never billed for more than this plus 60 seconds;
            with 0, or once a call is transferred to a person, billing stops at
            4 hours.
        lead_memory_enabled:
          type: boolean
          default: true
          description: >-
            When true, the matched lead's long-term memory context is injected
            into the system prompt at call time.
        noise_cancellation_enabled:
          type: boolean
        is_active:
          type: boolean
        webhook_url:
          type: string
          format: uri
          nullable: true
          description: >
            Legacy agents only. Read whole by a key with `tools:read` (or
            `tools:update`), the rule GET /deliveries/{id} applies to the same
            destination; for any other key, and in a campaign or eval-case
            embed, it is `scheme://host[:port]` and `webhook_url_path_withheld`
            is true. Send the whole URL to change it.
        webhook_url_path_withheld:
          type: boolean
          readOnly: true
          description: >
            Legacy agents only. True when `webhook_url` is shortened to
            `scheme://host[:port]` because the reading key holds neither
            `tools:read` nor `tools:update`.
        webhook_events:
          type: array
          description: >
            Events posted to `webhook_url` as `{event, timestamp, agent_id,
            company_id, call_id, data}`.

            `data` on every call event carries `direction`, `status`,
            `from_number`, `to_number`,

            `duration_seconds`, `started_at` (when the call was placed),
            `answered_at` (when its audio

            came up; absent until it did) and `recording_started_at` (when its
            recording began - a

            transcript's `start` and `end` are milliseconds from here; null
            until the recording is saved,

            on a browser call, and on older calls recorded before the field was
            added), all ISO 8601 with a `+00:00`

            offset as GET /calls/{id} writes them; plus `disposition`,
            `summary`, `transcript` and

            `extracted_data` once they exist. `transcript.ready` and
            `call.analyzed` are sent after the

            recording is saved, so they carry `recording_started_at` on a phone
            call. No event carries the

            conversation while the call is still going.

            `call.failed` and `call.no_answer` carry `data.hangup_cause` when
            the cause is known. For a call

            from a number in [your own Telnyx
            account](/concepts/bring-your-own-carrier) that Telnyx

            refused while it rang, `call.failed` has `data.hangup_cause`:


            - `carrier_rejected` — Telnyx refused the call (SIP 401, 403 or
            407).

            - `carrier_number_invalid` — Telnyx could not route the number
            called (SIP 404, 484 or 604).


            The SIP code is not in the webhook; the carrier account keeps the
            last one in `last_error.sip_code`.

            One Telnyx refused before it rang sends no webhook when `POST
            /calls` was placing it (the

            request answers `422`); from the queue it sends `call.failed` with
            `data.error_reason` instead.
          items:
            type: string
            enum:
              - call.started
              - call.answered
              - call.ended
              - call.failed
              - call.no_answer
              - call.dnc_blocked
              - transcript.ready
              - call.analyzed
        webhook_headers:
          type: object
          nullable: true
          writeOnly: true
          additionalProperties:
            type: string
          description: >
            Legacy agents only. Write-only: set it on PATCH /agents/{id}; no
            response carries it —

            every read answers `configured_webhook_header_names` instead, and a
            PATCH that leaves

            it out keeps the stored headers.

            Custom HTTP headers sent with every webhook delivery for this agent
            (e.g. an auth token).

            Flat name → string-value map, or null to clear. Headers that would
            override request routing

            or HTTP framing (Host, Content-Length, Transfer-Encoding,
            Connection, Expect, Keep-Alive,

            TE, Trailer, Upgrade, Proxy-*) are rejected with 400.
          example:
            Authorization: Bearer sk_live_…
            X-Source: yappr
        configured_webhook_header_names:
          type: array
          readOnly: true
          items:
            type: string
          example:
            - Authorization
            - X-Source
          description: >
            Legacy agents only, and absent from a `workflow` agent's response.
            The names of the stored `webhook_headers`, sorted; the values are
            never returned, to any key.
        tools:
          type: array
          readOnly: true
          description: >
            Legacy agents only, and absent from a `workflow` agent's response.
            The agent's tools in execution order, each as GET /tools/{id}
            answers it plus `execution_order`, for a key that holds
            `tools:read`; without it each is `{id, name}` only.
          items:
            type: object
        extraction_parameters:
          type: array
          description: >
            AI extraction parameters — after each call, values are extracted
            from the transcript, stored on the call log and included in the
            call.analyzed webhook payload. Read them back on a call as
            `extracted_data` in GET /calls/{id}.
          items:
            type: object
            required:
              - name
              - description
            properties:
              name:
                type: string
                example: customerName
                description: Parameter key in the extracted_data output
              description:
                type: string
                example: The caller's full name as mentioned during the conversation
                description: Instructions for the AI on what to extract
              type:
                type: string
                enum:
                  - text
                  - number
                  - yes_no
                  - date
                default: text
                example: number
                description: >
                  The kind of value this parameter asks for, which decides what
                  the stored value is: `text` a string, `number` a JSON number,
                  `yes_no` a JSON boolean, `date` a `YYYY-MM-DD` string, read
                  from the day the call started in the workspace's time zone - a
                  day and month with no year is the next time it comes round,
                  "tomorrow" and "next Sunday" are counted from the call day,
                  something the caller says already happened ("three months
                  ago", "it ended in June") is counted back from it, never
                  forward, and a year the caller said is kept. Optional — a
                  parameter saved without one behaves exactly as it always has,
                  as `text`. A value the conversation never supplied is `null`
                  whatever the kind, and a value that cannot be read as the
                  declared kind is `null` rather than a string that only looks
                  like one. Any other value is rejected: `422
                  WORKFLOW_SETTINGS_REQUEST_INVALID` for a workflow agent, `400
                  BAD_REQUEST` for a prompt or flow agent.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ToolFork:
      type: object
      description: >
        What fork_tools did. status complete — the copy shares no tool with
        another agent any more; partial — some tools are still shared (listed in
        shared); failed — none could be forked. Repeat the same request with the
        same Idempotency-Key to finish a partial or failed fork.
      required:
        - status
        - forked
        - kept
        - shared
      properties:
        status:
          type: string
          enum:
            - complete
            - partial
            - failed
        forked:
          type: array
          description: >-
            Tools made for the copy by this request, each already bound in the
            copy's draft.
          items:
            type: object
            required:
              - tool_id
              - name
              - source_tool_id
              - source_name
              - header_names
              - url_private_part_removed
              - needs_values
            properties:
              tool_id:
                type: string
                format: uuid
              name:
                type: string
                description: >-
                  The source name plus " (copy)", or " (copy N)" when that name
                  is taken.
              source_tool_id:
                type: string
                format: uuid
              source_name:
                type: string
              header_names:
                type: array
                items:
                  type: string
                description: >-
                  Headers carried over by name with an empty value. Enter each
                  value with PATCH /tools/{id} before the copy takes calls.
              url_private_part_removed:
                type: boolean
                description: >-
                  true when the source's address had a private query, which is
                  not carried: send the full configuration.url with PATCH
                  /tools/{id}.
              needs_values:
                type: boolean
                description: >-
                  true when header_names is not empty or
                  url_private_part_removed is true.
        kept:
          type: array
          description: >-
            Tools the copy already had of its own (an earlier fork), left as
            they are.
          items:
            $ref: '#/components/schemas/ToolForkRef'
        shared:
          type: array
          description: >-
            Tools still shared with another agent because they could not be
            forked. tool_id and name are null when the tool could not be
            identified.
          items:
            $ref: '#/components/schemas/ToolForkRef'
    FlowConfig:
      type: object
      required:
        - nodes
      description: >
        The full flow definition stored in `agents.flow_config`. Constraints
        enforced at validate-time

        (any failure returns 400 `FLOW_INVALID` with one issue per problem — see
        `FlowInvalidError`):


        - Exactly one node of `type=start` (`no_start` / `multiple_starts`).

        - Start node has a `next_step_id` (`start_unwired`).

        - All `next_step_id` references resolve to a real node id
        (`unknown_target_node`).

        - Node ids are unique.

        - Every conversation node has non-empty `instructions`
        (`instructions_missing`).

        - Every conversation transition has a non-empty `description`
        (`transition_description_missing`).
          The description is the natural-language trigger the voice agent reads at runtime to pick a path —
          a bare `label` is not sufficient.
        - Every tool_call node has a `tool_id` (`tool_id_missing`).

        - At most 127 unique typed extraction contracts may be exposed in one
        flow
          (`too_many_extraction_contracts`). Nodes with identical effective tool/config schemas
          deduplicate.
        - tool_call nodes have a wired `success_next_step_id`
        (`success_not_wired`).

        - transfer nodes have a `transfer_to` (`transfer_to_missing`): a phone
        number or a SIP address. A value starting `sip:` or `sips:` that is not
        a valid SIP address is rejected on save (`transfer_to_invalid_sip`).

        - **Only `end` and `transfer` nodes may be terminal.** conversation and
        tool_call nodes must
          have at least one outgoing edge (a transition for conversation; `success` for tool_call).
          Violations: `terminal_not_allowed` per offending node, `no_terminal` if the flow has none at all.
        - A flow may no longer contain an `integration_call` node. The native
        calendar/mailbox step
          is retired; a stored flow that still has one is rejected here and refused by the call
          runtime. Delete the step and rebuild it as a tool step on a connected app.
        - Every node must be reachable from start (`unreachable_node`).
      properties:
        nodes:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/FlowNode'
        flow_config_version:
          type: string
          default: '1'
        metadata:
          type: object
          additionalProperties: true
          description: >-
            Optional metadata surfaced to the eval LLM context (e.g. agent
            purpose, customer name conventions).
          properties:
            custom_metadata_keys:
              type: array
              items:
                type: string
              description: >
                User-declared keys that this flow's `args_template` token
                interpolation expects to

                find under the `{{metadata.<key>}}` namespace at dispatch time.
                Surfaced in the

                dashboard so callers know which keys to pass in `POST /calls
                body.metadata`.

                Keys not listed here still resolve at runtime if passed (and to
                empty string if

                not) — this list is purely a hint for the UI / API consumers.
    ToolForkRef:
      type: object
      properties:
        tool_id:
          type: string
          format: uuid
          nullable: true
        name:
          type: string
          nullable: true
    FlowNode:
      description: Discriminated by `type`.
      oneOf:
        - $ref: '#/components/schemas/StartNode'
        - $ref: '#/components/schemas/ConversationNode'
        - $ref: '#/components/schemas/ToolCallNode'
        - $ref: '#/components/schemas/TransferNode'
        - $ref: '#/components/schemas/EndNode'
      discriminator:
        propertyName: type
        mapping:
          start: '#/components/schemas/StartNode'
          conversation: '#/components/schemas/ConversationNode'
          tool_call: '#/components/schemas/ToolCallNode'
          transfer: '#/components/schemas/TransferNode'
          end: '#/components/schemas/EndNode'
    StartNode:
      type: object
      required:
        - id
        - type
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - start
        name:
          type: string
        position:
          $ref: '#/components/schemas/FlowNodePosition'
        agent_speaks_first:
          type: boolean
          default: true
          description: >
            Whether the bot speaks first on call connect. When false, the bot
            waits silently for the caller to speak first (silence_timeout_secs
            on the agent still applies). For flow agents this OVERRIDES the
            agent-level agent.agent_speaks_first / agent.greeting_message
            fields.
        greeting:
          type: string
          nullable: true
          description: >-
            Spoken greeting (only used when agent_speaks_first is true). Random
            variations: {{Hi|Hello|Hey}} (two or more options separated by |)
            says one option, picked once per call; see [Random
            variations](/api-reference/agents/create#random-variations).
        is_literal:
          type: boolean
          default: false
          description: >-
            When true, speak `greeting` verbatim. When false, treat it as an LLM
            instruction.
        next_step_id:
          type: string
          nullable: true
        auto_advance:
          type: boolean
          default: true
          description: >
            Whether to enter the first conversation node immediately on session
            start (default `true`). When `false`, the bot's greeting is
            delivered in start-node context only; the first conversation node is
            entered only after the user's first reply (via internal
            advancement).
    ConversationNode:
      type: object
      required:
        - id
        - type
        - instructions
        - transitions
      allOf:
        - $ref: '#/components/schemas/GlobalNodeFields'
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - conversation
        name:
          type: string
        position:
          $ref: '#/components/schemas/FlowNodePosition'
        instructions:
          type: string
          description: >-
            Layered on top of agent.system_prompt as a system message at step
            entry. Random variations: {{Hi|Hello|Hey}} (two or more options
            separated by |) says one option, picked once per call; see [Random
            variations](/api-reference/agents/create#random-variations).
        transitions:
          type: array
          items:
            $ref: '#/components/schemas/Transition'
    ToolCallNode:
      type: object
      required:
        - id
        - type
        - transitions
      description: >
        Deterministic tool dispatch. Tool args are owned by the tool itself

        (`payload_config.static_parameters` for literals plus

        `payload_config.extraction_parameters` for runtime-extracted values) —

        a `tool_call` node carries no per-node `args_template`. The same tool

        used by N flow nodes always sends the same shape; if you need a

        different shape per step, create a separate tool or supply a

        `config_override`. At call start, the effective referenced-tool config
        is

        registered as a flat argument-submission schema: one named string field

        per `extraction_parameters` entry, with `required` (default `true`)

        controlling which fields must be collected. The model never submits a

        `node_id` or nested `args` object. The runtime assembles standard call

        metadata and static parameters; the submitter exposes only extraction

        fields. Payload merge order is standard metadata, then static
        parameters,

        then extracted values, so extracted values win deliberate name

        collisions. Keep names unique unless that override is intentional.

        Schemas remain fixed for that live call; tool/config-override edits
        apply

        on the next call. Stale

        `args_template` payloads on this node type are silently dropped at parse

        time.
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - tool_call
        name:
          type: string
        position:
          $ref: '#/components/schemas/FlowNodePosition'
        tool_id:
          type: string
          format: uuid
          nullable: true
          description: References an existing row in the company's tools table
        config_override:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            Per-node override merged shallow over the referenced tool's config
            (array replacement). Open-shape — each tool type has its own valid
            keys. For a transfer tool it may set `transfer_method`,
            `pbx_feature_code` and `pbx_feature_code_hangup_after_secs` (see
            TransferNode); the merged result is checked when you save, with the
            same codes.
        transitions:
          $ref: '#/components/schemas/ToolCallTransitions'
        pre_fire_announcement:
          type: boolean
          nullable: true
          description: >
            When true, the platform plays a short hold tone the moment this node
            fires so the caller

            doesn't sit in silence while the action runs. The tone is
            platform-controlled (not

            configurable) and stops automatically when the action returns. Use
            it for actions you

            expect to take more than ~500 ms (webhook to a slow CRM, complex DB
            lookup); skip it for

            fast actions to avoid making the call feel chatty.
        timeout_secs:
          type: number
          nullable: true
          minimum: 1
          maximum: 600
          description: >
            Per-node hard cap on execution time. When the action doesn't return
            in this many seconds,

            the runtime cancels it and routes to `error_next_step_id` with a
            `tool_timeout_after_Ns`

            error. When null/omitted on a webhook tool, the controller uses the
            effective tool

            `config.timeout_seconds` plus one second of dispatch overhead. Other
            tool nodes use the

            platform default (30s). Set this only when the flow needs a
            different node-level limit.
    TransferNode:
      type: object
      required:
        - id
        - type
      allOf:
        - $ref: '#/components/schemas/GlobalNodeFields'
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - transfer
        name:
          type: string
        position:
          $ref: '#/components/schemas/FlowNodePosition'
        transfer_to:
          type: string
          nullable: true
          example: '+972501234567'
          description: >
            Where to send the caller: either a phone number or a SIP address.


            - A **phone number** (for example `+972501234567`) is dialled as a
            second call. It
              can't be used on a call that arrived over a SIP trunk or an extension endpoint.
            - A **SIP address** (`sip:` or `sips:`, for example
            `sip:reception@pbx.example.com`)
              hands the caller back to your own phone system, which places the new call
              (a SIP REFER). It works on calls that arrived over a
              [username-and-password SIP trunk](/concepts/sip-trunks#transfers). On a call
              that arrived over an [extension endpoint](/concepts/sip-trunks#register-as-an-extension)
              it works differently: no REFER is sent, and Yappr places a new call through
              your extension to the extension or queue in the address (only the part before
              the `@` is used). On any other call the transfer is refused and the agent
              keeps helping the caller.
              On a trunk, your phone system has about nine seconds to have the new call
              answered, and if the transfer fails the call ends. On an extension call the
              new call has about 25 seconds to be answered, and if it fails or isn't
              answered the call also ends. The address must be
              `sip:user@host[:port]`, at most 256 characters, with a user part, and no
              password or `?headers`. A value that starts with `sip:` or `sips:` but is
              malformed is rejected when you save the flow.
          examples:
            - '+972501234567'
            - sip:reception@pbx.example.com
        transfer_message:
          type: string
          nullable: true
          description: >-
            Spoken before transferring. Random variations: {{Hi|Hello|Hey}} (two
            or more options separated by |) says one option, picked once per
            call; see [Random
            variations](/api-reference/agents/create#random-variations).
        transfer_method:
          type: string
          nullable: true
          enum:
            - auto
            - pbx_feature_code
          default: auto
          description: >
            How a call that arrived through an

            [extension
            endpoint](/concepts/sip-trunks#hand-the-call-to-your-phone-system-with-its-transfer-code)

            is transferred. `auto` (or leaving it out) uses the transfer code
            set on the

            extension endpoint (`register.pbx_feature_code`), or the usual
            dial-back when it

            has none. `pbx_feature_code` uses this node's own code and hang-up
            time instead,

            as a pair, with nothing taken from the endpoint: it first sends your
            phone system

            the in-call transfer code (`pbx_feature_code`) followed by the
            extension, so the

            phone system moves the

            caller itself and Yappr leaves the call; without a hang-up time

            (`pbx_feature_code_hangup_after_secs`), if it doesn't within about
            12 seconds,

            Yappr falls back to the dial-back. Ignored on every other call. With

            `pbx_feature_code`, `transfer_to` must name an extension a keypad
            can dial: up

            to 32 digits, `*` or `#`, as `sip:400@pbx.example.com` or `400`.
            Anything else

            is rejected when you save (`transfer_method_invalid`,

            `transfer_extension_not_dialable`).
        pbx_feature_code:
          type: string
          nullable: true
          maxLength: 32
          pattern: ^[0-9A-Da-d*#wW]*(\{extension\})?[0-9A-Da-d*#wW]*$
          examples:
            - '##'
            - '*2'
            - '#1'
            - '*2{extension}#'
          description: >
            Your phone system's own in-call transfer code (blind or attended),
            sent as key presses. Required

            when `transfer_method` is `pbx_feature_code`
            (`pbx_feature_code_missing`),

            ignored otherwise. 1 to 32 characters: `0`-`9`, `*`, `#`, `A`-`D`,
            and the

            pauses `w` (half a second) and `W` (one second), with at least one
            key.

            `{extension}` may appear once and is replaced by the extension;
            without it

            the extension is sent right after the code (`##` + `400` sends
            `##400`).

            Anything else is rejected when you save
            (`pbx_feature_code_invalid`).
        pbx_feature_code_hangup_after_secs:
          type: integer
          nullable: true
          minimum: 1
          maximum: 10
          examples:
            - 4
          description: >
            Set it when your phone system's code starts an attended transfer
            that

            completes when the transferring extension hangs up. Yappr hangs up
            this many

            seconds after the code (counted once its key presses have played);
            until

            then the agent is off the line, silent and not listening. Because
            that

            hang-up is the hand-off there is no fallback dial-back, so

            test it once. 4 is a good start. Leave it out (or null) to wait for
            your

            phone system to end the call, with the dial-back as the fallback. A
            whole

            number from 1 to 10, only with `transfer_method` `pbx_feature_code`;
            anything

            else is rejected when you save
            (`pbx_feature_code_hangup_after_secs_invalid`,

            `pbx_feature_code_hangup_after_secs_without_code`).
    EndNode:
      type: object
      required:
        - id
        - type
      allOf:
        - $ref: '#/components/schemas/GlobalNodeFields'
      description: >
        Terminal. Reaching an End node hangs up the call. For per-call data
        extraction or webhook delivery, use the agent-level
        `extraction_parameters` and `webhook_url` / `webhook_events` fields on
        the agent (those apply uniformly to prompt + flow agents).
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - end
        name:
          type: string
        position:
          $ref: '#/components/schemas/FlowNodePosition'
        farewell:
          type: string
          nullable: true
          description: >-
            Spoken before the call ends. Random variations: {{Hi|Hello|Hey}}
            (two or more options separated by |) says one option, picked once
            per call; see [Random
            variations](/api-reference/agents/create#random-variations).
        is_literal:
          type: boolean
          default: false
    FlowNodePosition:
      type: object
      description: >-
        UI-only persisted x/y on the React Flow canvas. The runtime ignores
        this.
      properties:
        x:
          type: number
        'y':
          type: number
    GlobalNodeFields:
      type: object
      description: >
        Optional fields available on every node EXCEPT start and tool_call. When
        `is_global`

        is true, the node is reachable from any conversation node without an
        explicit edge —

        the eval LLM gets it as an additional candidate transition with a strong
        "prefer

        labeled transitions" bias. Use sparingly (recommended ≤3 globals per
        flow). Good for

        misclassification recovery and universal escape hatches; bad for
        happy-path shortcuts.
      properties:
        is_global:
          type: boolean
          default: false
          description: >-
            Mark this node as globally reachable. Only valid on
            conversation/end/transfer nodes.
        global_jump_description:
          type: string
          nullable: true
          description: >
            REQUIRED when is_global=true. Natural-language condition the eval
            LLM uses to decide whether

            to jump here. Describe a clear user-side signal, not an agent
            intent.

            Example: "User reveals they're actually an owner, not a tenant".
    Transition:
      type: object
      required:
        - id
        - label
        - description
        - next_step_id
      description: >
        A labeled outgoing branch from a conversation node. The voice agent
        picks one

        (or stays) at each user-turn boundary by calling the `pick_transition`
        tool.
      properties:
        id:
          type: string
          description: Stable transition id (used in the flow graph and traces)
        label:
          type: string
          description: >-
            Short human-readable label, also surfaced in the dashboard and call
            traces
        description:
          type: string
          minLength: 1
          description: >
            REQUIRED, non-empty. The natural-language trigger the voice agent
            reads at runtime

            to decide whether to take this path. Describe a user-side signal
            (what the caller

            said or implied), not an agent intent. Example: "Caller confirmed
            they want a demo

            scheduled" — not "agent books the demo". An empty description is
            rejected with

            error code `transition_description_missing`.
        next_step_id:
          type: string
          description: Destination node id
    ToolCallTransitions:
      type: object
      description: >
        Routing for a tool_call node. Routing is deterministic, no LLM. error
        fires on hard failures

        (timeout, 4xx/5xx, integration disconnected). Otherwise custom[] is
        evaluated in declaration order

        and the first match wins; success fires only if no custom matched.
        Exactly one out-edge per fire.
      properties:
        success_next_step_id:
          type: string
          nullable: true
        error_next_step_id:
          type: string
          nullable: true
        custom:
          type: array
          default: []
          items:
            $ref: '#/components/schemas/CustomTransition'
    CustomTransition:
      type: object
      required:
        - id
        - label
        - jsonpath
        - equals
        - next_step_id
      description: >
        Deterministic branch for a tool-call node, matched by JSONPath equality
        against the tool's parsed response body.

        Custom branches are evaluated top-to-bottom, first match wins; mutually
        exclusive with success/error (only one

        out-edge fires per tool fire). See
        /docs/api-reference/agents/flow-config-schema for the full runtime
        semantics.
      properties:
        id:
          type: string
        label:
          type: string
        jsonpath:
          type: string
          example: $.status
          description: >
            Dotted path into the tool's parsed response body (root `$`).
            Supported: `$.foo.bar`, `$.list[0].name`,

            `$.items[2]`. NOT supported: recursive descent (`$..`), wildcards
            (`$.*`), filter expressions.
        equals:
          type: string
          example: no_availability
          description: >
            Compared via string equality after JSON-style stringification of the
            extracted value:

            booleans become "true"/"false" (lowercase), null becomes "null",
            numbers via str(). Match the

            stringified form exactly or the branch never fires.
        next_step_id:
          type: string
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        Your Yappr API key (e.g. `ypr_live_...`). Generate one in the dashboard
        under **Settings → API Keys**. No key is `401 MISSING_KEY`; a key that
        is not one of ours, or is revoked, is `401 INVALID_KEY`; an expired one
        is `401 EXPIRED_KEY`. A valid key without the scope an operation needs
        is `403 INSUFFICIENT_SCOPE` on every operation, and the message names
        the scope. Every response, a 401 included, carries X-RateLimit-Limit,
        X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a
        minute per API key. Every 429, whatever its code, carries Retry-After
        (whole seconds, never zero): the per-key budget's `RATE_LIMIT` asks for
        what is left of the minute, a route's daily cap (`RATE_LIMITED`) for the
        time until that cap resets. All four headers are listed in
        Access-Control-Expose-Headers, so a browser can read them. A path the
        API does not serve (an unknown sub-path, an id left empty) is `404
        ROUTE_NOT_FOUND`, and a method a served path does not take is `405
        METHOD_NOT_ALLOWED` with an `Allow` header; both are answered before any
        scope check, and nothing is read or changed. A trailing slash is ignored
        where it cannot be an id left empty (`POST /calls/` is `POST /calls`)
        and refused where it can (`GET /calls/`). A doubled slash inside a path
        is merged into one before the request reaches the API (`GET //calls` is
        `GET /calls`).

````

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