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

# Restore a campaign

> Brings an archived campaign back. One that never launched (`started_at` null) is a
`draft` again, and every contact the archive retired (`excluded`, `stop_reason:
campaign_archived`) is `pending` again; one excluded by hand stays excluded. One that
had launched comes back `stopped`, its contacts as they are. Archived campaigns are
listed with `GET /campaigns?status=archived`. Required scope `campaigns:manage`.


Brings an [archived](https://docs.goyappr.com/api-reference/campaigns/archive.md) campaign back onto the list. What it comes back as depends on whether it ever launched:

| It was | It comes back as | Its contacts |
| - | - | - |
| Never launched (`started_at` is `null`) | `draft` — edit it, enroll more contacts and launch it as before | Every contact the archive retired (`excluded` with `stop_reason: "campaign_archived"`) is `pending` again. A contact you excluded yourself stays excluded. |
| Launched before | `stopped` — readable and reported again, never dialled | Left exactly as they are. To call them again, create a new campaign. |

Archived campaigns are listed with [`GET /campaigns?status=archived`](https://docs.goyappr.com/api-reference/campaigns/list); that is where to find the `id`.

Required scope: `campaigns:manage`.

## Path parameters

| Parameter | Type | Notes |
| - | - | - |
| `id` | uuid | Campaign ID. Must belong to the API key's workspace. |

There is no query parameter, and no request body: send none, or `{}`. A field in the body is refused by name (`400 CAMPAIGN_REQUEST_INVALID`, each field in `issues[]` as `field_unknown` at its own `path`, `/status` for `{"status": "draft"}`) rather than ignored.

## Example request

```bash theme={null}
curl -X POST "https://api.goyappr.com/campaigns/CAMPAIGN_ID/restore" \
  -H "Authorization: Bearer $YAPPR_API_KEY"
```

## Response

`200` with the campaign as [`GET /campaigns/{id}`](https://docs.goyappr.com/api-reference/campaigns/get) returns it, now `draft` or `stopped`.

## Errors

| HTTP | Code | When |
| - | - | - |
| 400 | `CAMPAIGN_REQUEST_INVALID` | The request carried a body field, or a body that is not a JSON object. Restoring takes none. Nothing was changed. |
| 403 | `INSUFFICIENT_SCOPE` | API key lacks `campaigns:manage`. |
| 404 | `NOT_FOUND` | No campaign with that ID in this workspace. |
| 404 | `RESOURCE_ID_INVALID` | The id in the path is not an id at all. |
| 409 | `CAMPAIGN_NOT_ARCHIVED` | The campaign is not archived — the message names its status — so there is nothing to restore. Nothing was changed. |
| 409 | `CAMPAIGN_STOP_RULE_REQUIRED` | A launched campaign whose last stop outcome was [deleted](https://docs.goyappr.com/api-reference/dispositions/delete.md) while it was archived: it comes back as `stopped`, and a stopped campaign needs a stop rule. It cannot be restored; create a new campaign with [`POST /campaigns`](https://docs.goyappr.com/api-reference/campaigns/create) and enrol its contacts there. It used to answer `CAMPAIGN_NOT_ARCHIVED`. Nothing was changed. |
| 500 | `INTERNAL_ERROR` | The write failed. Repeat the request; restoring is safe to repeat until it succeeds. The contacts are brought back before the campaign, so a failure leaves it archived and the repeat restores it and its contacts. |


## OpenAPI

````yaml POST /campaigns/{id}/restore
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:
  /campaigns/{id}/restore:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Campaigns
      summary: Restore campaign
      description: >
        Brings an archived campaign back. One that never launched (`started_at`
        null) is a

        `draft` again, and every contact the archive retired (`excluded`,
        `stop_reason:

        campaign_archived`) is `pending` again; one excluded by hand stays
        excluded. One that

        had launched comes back `stopped`, its contacts as they are. Archived
        campaigns are

        listed with `GET /campaigns?status=archived`. Required scope
        `campaigns:manage`.
      operationId: restoreCampaign
      responses:
        '200':
          description: The campaign, now `draft` or `stopped`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Campaign'
        '400':
          description: >-
            CAMPAIGN_REQUEST_INVALID: a body field (each in issues[] as
            field_unknown at its pointer, /status), or a body that is not a JSON
            object. Restoring takes no body. Nothing changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            `NOT_FOUND`: no campaign with that id in this workspace.
            `RESOURCE_ID_INVALID`: the id is not an id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >
            CAMPAIGN_NOT_ARCHIVED — the campaign is not archived (the message
            names its status). CAMPAIGN_STOP_RULE_REQUIRED — it had launched and
            its last stop outcome was deleted while it was archived, so it
            cannot come back as stopped; create a new campaign. Nothing changed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Campaign:
      type: object
      description: >
        A paced bulk-outbound dialing job over enrolled contacts.


        A campaign is an **admission-only scheduler**. It decides *when* each
        enrolled

        contact becomes eligible, then performs one ordinary outbound call — the
        same

        queue, the same priority, and the same concurrency limits as a call
        placed with

        `POST /calls`. The pacing fields below only control how fast a campaign
        hands

        calls to that queue; a campaign call never takes precedence over
        anything else.


        Campaigns are always created as `draft` and are launched with

        `POST /campaigns/{id}/launch`.


        **Two independent per-contact stop conditions** apply, whichever fires
        first:

        `max_attempts`, and the stop-disposition set (`stop_disposition_ids`
        plus the

        `stop_on_*` booleans). Landing a stop disposition retires that contact

        permanently; any other outcome retries until the attempt cap.


        Fields marked *Engine-owned* are written by the campaign engine and are
        never

        writable. Sending one on create or update returns `400`, as does any
        field name

        that isn't on the writable list — a misspelled `stop_dispositions` is
        rejected

        rather than silently ignored, so you can never believe a kill switch is
        armed

        when it is not.
      properties:
        id:
          type: string
          format: uuid
        company_id:
          type: string
          format: uuid
        name:
          type: string
          example: July reactivation
        description:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - draft
            - scheduled
            - running
            - paused
            - paused_insufficient_credit
            - paused_budget
            - paused_infra
            - paused_config
            - completed
            - stopped
            - archived
          description: >
            Engine-owned. Move it with the transition endpoints

            (`launch` / `pause` / `resume` / `stop`), never with `PATCH`.


            `draft` — created, not dialing.

            `scheduled` — not entered today. A campaign launched before its
            `starts_at`

            reads `running` and places no call until that moment.

            `running` — admitting contacts.

            `paused` — paused by you. A manual pause is **never** lifted
            automatically; it

            survives a top-up.

            `paused_insufficient_credit` — balance is below the minimum needed
            to place a

            call. **Auto-resumes** shortly after the balance is topped up.

            `paused_budget` — `budget_cents` reached, or the workspace's own
            monthly

            spending limit reached; `pause_reason` says which.

            `paused_infra` — the safeguard: one contact's call could not be
            placed more

            times than `max_infra_retries` allows (nobody's phone rang). Calls
            already

            under way finish normally and every contact keeps its place; nothing
            new is

            dialed until you resume. Not lifted automatically.

            `paused_config` — a permanent configuration problem (from-number no
            longer

            active, agent missing a call-duration cap, no reachable calling
            window).

            `completed` — every enrolled contact reached a terminal state.

            `stopped` — stopped by you. Terminal.

            `archived` — soft-deleted by `DELETE /campaigns/{id}`. Terminal.
        pause_reason:
          type: string
          nullable: true
          enum:
            - manual
            - insufficient_credit
            - campaign_budget
            - workspace_spend_limit
            - call_placement_failures
            - configuration
            - null
          description: >
            Why the campaign is paused, or `null` when it is not. Read-only.

            `manual` (`paused`), `insufficient_credit`
            (`paused_insufficient_credit`),

            `campaign_budget` or `workspace_spend_limit` (both `paused_budget` —
            this

            campaign's `budget_cents`, or the workspace's monthly limit from

            `PATCH /billing`), `call_placement_failures` (`paused_infra`),

            `configuration` (`paused_config`).
        agent_id:
          type: string
          format: uuid
          nullable: true
          description: Agent that runs the calls. Required before launch.
        agent:
          nullable: true
          description: >
            The Agent for `agent_id`. For a key holding `agents:read` it is the

            same object, field for field, that `GET /agents/{id}` returns for
            it.

            For a key without `agents:read` it is `{ id, name }` only: the

            campaign never shows a key more of an agent than `GET /agents/{id}`

            would.
          allOf:
            - $ref: '#/components/schemas/Agent'
        split:
          nullable: true
          description: >
            The A/B test on this campaign's calls, or `null` when every contact
            is

            called by `agent_id`.


            **`percent` is the share of contacts that go to the SECOND agent**

            (`agent_id` inside the object). `agent_id` on the campaign takes the
            rest.


            A contact is assigned once, on its first admission, and keeps that
            agent

            for every later attempt — a no-answer redial is the same
            conversation and

            not a fresh coin toss. Changing `percent` afterwards therefore only
            affects

            contacts that have not been dialed yet. Changing either agent, or
            sending

            `null`, does reach contacts already dialed: an assignment to an
            agent the

            campaign no longer runs is released, and that contact is assigned
            again on

            its next attempt. Both agents must have a maximum call duration set
            and be

            able to take calls, or `launch` refuses.


            Both agents are screened against the do-not-call list at enrolment,
            so a

            contact is never assigned an agent that is not allowed to call it.
          allOf:
            - $ref: '#/components/schemas/AgentSplit'
        split_agent:
          nullable: true
          description: >-
            The Agent for the second agent in `split`, read like `agent`: the
            object `GET /agents/{id}` returns for a key holding `agents:read`,
            `{ id, name }` for a key without it.
          allOf:
            - $ref: '#/components/schemas/Agent'
        from_phone_number_id:
          type: string
          format: uuid
          nullable: true
          description: >
            The number the campaign calls from, when it names one. `null` (the
            default) calls from the agent's own number: a number the agent calls
            from (its outbound agent, or either half of the number's outbound
            split), else one it answers on; a Yappr number before one on your
            own Telnyx account. An A/B split calls from the first agent's number
            for both halves. A create or edit that leaves it `null` on an agent
            with no number is `400 CAMPAIGN_REQUEST_INVALID`
            (`invalid_from_number` at `/from_phone_number_id`); at launch the
            number must still be active. If this number is released, the
            campaign calls from its agent's own number from then on.
        from_phone_number:
          nullable: true
          description: >
            The PhoneNumber for `from_phone_number_id`. For a key holding
            `phone_numbers:search` it is exactly the object GET /phone-numbers
            returns, and only that. For a key without it, it is `{ id,
            friendly_name, number: null }`: which number, and what it costs, are
            that scope's to show (`friendly_name` is null too when it spells the
            number). The carrier account's own plumbing (provider and order ids,
            SIP trunk/credential identifiers, SIP usernames and secrets) is
            never part of it.
          allOf:
            - $ref: '#/components/schemas/PhoneNumber'
        from_number:
          type: string
          nullable: true
          description: >
            Engine-owned. E.164 number the campaign calls from:
            `from_phone_number`'s, or its agent's own number when
            `from_phone_number_id` is `null`. Written on create, edit and
            launch, and on every dialling round, so it follows the agent onto a
            new number; kept for audit even if the number is later released.
            `null` until the campaign has an agent or a number that can call,
            and for a key without `phone_numbers:search`, as
            `from_phone_number.number` is.
          example: '+972551234567'
        variables:
          type: object
          additionalProperties:
            type: string
          description: >
            Values for the agent's `{{placeholders}}` on every call this
            campaign places. `FirstName` and `FullName` are filled on each call
            from its contact's own name (the first word of it, and the whole of
            it; a household, a title or half of a given name keeps the whole
            name under `FirstName`: "משפחת כהן"); the value here is what a
            contact with no name hears. `{}` when none are set.
        calling_window:
          type: object
          additionalProperties: true
          description: >
            Optional campaign-level narrowing of the workspace calling hours.
            Omit to inherit the workspace schedule (`GET /call-windows`). A
            campaign can only ever dial inside the workspace window — this field
            cannot widen it. `{ tz, days: [0..6], start: "HH:MM", end: "HH:MM"
            }`. `tz` is an IANA zone name and is required whenever `days`,
            `start` or `end` is present: hours without a zone are ambiguous, so
            they are refused rather than read against a zone you did not pick.
            `days` lists each day once and is never empty; `start` and `end`
            come together and `end` is later than `start` (no zero-minute
            window, none past midnight). Anything else is 400
            CAMPAIGN_REQUEST_INVALID, naming the value.
        stop_disposition_ids:
          type: array
          items:
            type: string
            format: uuid
          description: >
            Disposition **IDs** that retire a contact permanently when assigned
            — the

            campaign's kill switch. Always IDs, never labels: labels are
            renameable, and a

            rename would silently disarm the rule.


            `No Answer`, `Failed`, `Voicemail` and `Unclassified` are refused
            here with

            `400`. The platform assigns them by itself (`No Answer` on every
            unanswered

            ring), so listing one retires the contact the first time it lands,
            before any

            retry, and `Voicemail` or `Unclassified` can land on a call someone
            answered.

            Use `stop_on_no_answer`, `stop_on_voicemail` and
            `stop_on_unclassified` instead.


            Must contain dispositions belonging to your company; anything else
            is rejected

            with `400`.
        stop_dispositions:
          type: array
          description: Full Disposition objects for `stop_disposition_ids`.
          items:
            $ref: '#/components/schemas/Disposition'
        stop_on_no_answer:
          type: boolean
          example: false
          description: Retire a contact the first time a call goes unanswered.
        stop_on_voicemail:
          type: boolean
          example: false
          description: Retire a contact the first time a call reaches an answering machine.
        stop_on_unclassified:
          type: boolean
          example: false
          description: >
            What to do when the outcome that arrives is `Unclassified` — the
            call happened but could not be matched to any of your outcomes.
            `false` retries the contact, `true` retires it.

            This is not a timeout. A call's outcome is authoritative and a
            contact is never advanced without one: if classification is slow,
            only that contact waits while the campaign keeps calling everyone
            else.
        max_attempts:
          type: integer
          minimum: 1
          maximum: 999
          example: 3
          description: >
            Per-contact dial cap. One of the two independent stop conditions —
            the other is the stop-disposition set.
        max_infra_retries:
          type: integer
          minimum: 0
          maximum: 20
          example: 3
          description: >
            The safeguard: how many retries one contact gets after a
            platform-side failure — a call that never reached the person —
            before the whole campaign pauses as `paused_infra`. A count, not
            money: the money limits are `budget_cents` and the workspace's
            monthly spending limit. These retries do not consume `max_attempts`
            and are never terminal.
        retry_no_answer_seconds:
          type: integer
          minimum: 30
          maximum: 604800
          example: 3600
          description: Delay before retrying a contact who did not answer.
        retry_completed_seconds:
          type: integer
          minimum: 60
          maximum: 604800
          example: 86400
          description: >-
            Delay before retrying a contact whose call completed but landed on a
            non-stop disposition.
        randomize_retry_time:
          type: boolean
          example: false
          description: >
            Which time of day a retry lands on. `false` keeps the wait exact, so
            a one-week wait retries at the same hour a week later. `true` picks
            a different hour inside the campaign's calling window, so repeat
            attempts do not always arrive at the same moment. The wait length
            itself is unchanged either way — a randomized retry is still never
            earlier than the configured wait.
        double_dial_enabled:
          type: boolean
          example: false
          description: Ring a second time shortly after an unanswered first ring.
        double_dial_gap_seconds:
          type: integer
          minimum: 10
          maximum: 3600
          example: 90
          description: Gap between the two rings when `double_dial_enabled` is true.
        max_calls_per_day:
          type: integer
          minimum: 1
          maximum: 100000
          example: 200
          description: Daily admission cap, counted against the workspace timezone day.
        min_seconds_between_calls:
          type: integer
          minimum: 0
          maximum: 86400
          example: 30
          description: >-
            Minimum spacing between two calls handed to the queue by this
            campaign.
        max_in_flight:
          type: integer
          minimum: 1
          maximum: 8
          example: 2
          description: >
            Calls this campaign may have live at once. Platform concurrency
            limits still apply on top — raising this does not buy the campaign
            extra capacity.
        budget_cents:
          type: integer
          minimum: 1
          nullable: true
          description: >
            This campaign's LIFETIME spend cap, enforced against `spent_cents` +
            `reserved_cents` (credits are debited when a call ends, so in-flight
            cost has to count) plus the next call's hold: twice the agent's
            `max_call_duration_secs`, in minutes, times the per-minute rate (the
            highest per-minute price of any voice model, as `GET /billing/rates`
            lists them). Counted in credits: a credit is one cent. A cap below
            one call's hold is refused with `400` (it would pause the campaign
            before its first call), and launch refuses one stored before that
            check. `null` means no cap. On hit the campaign moves to
            `paused_budget`. Distinct from the workspace's calendar-month limit
            (`monthly_budget_cents`, PATCH /billing), which covers every
            outbound call in the workspace and resets each month: either can
            pause this campaign and both report `paused_budget`.
        regulatory_basis:
          type: string
          nullable: true
          enum:
            - lawful_basis_confirmed
            - consent
            - existing_customer
            - non_marketing
            - registry_screened
          description: >
            Your lawful basis for calling this list. **Required before launch**
            — recorded on the campaign's launch audit record alongside the
            enrolled count.

            `lawful_basis_confirmed` is what the dashboard records: a single
            attestation that the caller has consent or another lawful basis for
            everyone on the list. The four specific values are for callers that
            know which one applies.
        starts_at:
          type: string
          format: date-time
          nullable: true
          description: >
            No call is placed before this moment. It does not launch the
            campaign: a campaign launched earlier reads `running` and waits.
        ends_at:
          type: string
          format: date-time
          nullable: true
          description: >
            No new call is placed from this moment; the campaign then moves to
            `completed`. Later than `starts_at`, not already passed, and the
            `calling_window` must open at least once before it.
        daily_admitted_count:
          type: integer
          description: >-
            Engine-owned. Calls handed to the queue during the current day
            window.
        daily_window_date:
          type: string
          format: date
          nullable: true
          description: Engine-owned. Day `daily_admitted_count` belongs to.
        last_admitted_at:
          type: string
          format: date-time
          nullable: true
          description: Engine-owned. When this campaign last handed a call to the queue.
        estimate_cents:
          type: integer
          nullable: true
          description: >-
            Engine-owned. Reserved for a projected campaign cost; nothing
            computes it yet, so it is `null`.
        spent_cents:
          type: integer
          description: Engine-owned. Settled spend so far.
        reserved_cents:
          type: integer
          description: >-
            Engine-owned. Worst-case cost of in-flight calls, held against
            `budget_cents` until they settle.
        last_tick_at:
          type: string
          format: date-time
          nullable: true
          description: Engine-owned. Last time the engine evaluated this campaign.
        last_tick_result:
          type: string
          nullable: true
          description: >
            Engine-owned. Machine-readable answer to "why is nothing happening
            right now" — e.g. daily cap reached, outside the calling window,
            waiting on in-flight calls. `blocked` means another operation held
            this campaign during the last evaluation and it is retried on the
            next one. Full vocabulary on the campaign stats page.
        last_error:
          type: string
          nullable: true
          description: Engine-owned. Last error the engine recorded for this campaign.
        started_at:
          type: string
          format: date-time
          nullable: true
          description: Engine-owned. First launch time.
        completed_at:
          type: string
          format: date-time
          nullable: true
          description: Engine-owned. When the last contact reached a terminal state.
        total_leads:
          type: integer
          description: Engine-owned. Contacts currently enrolled.
        stats:
          type: object
          additionalProperties: true
          description: Engine-owned counter roll-up. Prefer `GET /campaigns/{id}/stats`.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        created_by:
          type: string
          format: uuid
          nullable: true
          description: Null when the campaign was created via the API.
    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
    AgentSplit:
      type: object
      description: |
        A two-agent A/B test. `percent` is the share of calls the second agent
        (`agent_id`) takes; the resource's existing agent takes `100 - percent`.
      properties:
        agent_id:
          type: string
          format: uuid
          description: The second agent — the one being tested against the existing one.
        percent:
          type: integer
          minimum: 1
          maximum: 99
          description: Share of calls routed to `agent_id`, 1–99.
      required:
        - agent_id
        - percent
    PhoneNumber:
      type: object
      properties:
        id:
          type: string
          format: uuid
        number:
          type: string
          example: '+972551234567'
        friendly_name:
          type: string
          nullable: true
        provider:
          type: string
          description: >
            Where the number comes from: `telnyx` for a number bought from
            Yappr,

            `external` for a number in your own Telnyx account, added to a

            [carrier account](/api-reference/carrier-accounts/add-number),
            `phone_system`

            for the business number of an extension endpoint that calls out
            through your own

            phone system
            ([register.outbound](/concepts/sip-trunks#outbound-calls-through-the-extension)):

            switched on and off on that endpoint, never released here, no rent,
            and no calls in

            (they reach the endpoint's own agent; `inbound_agent_id` and
            `inbound_split` are

            refused with `422 FIELD_NOT_ALLOWED`).
          enum:
            - telnyx
            - external
            - phone_system
        status:
          type: string
          enum:
            - active
            - pending_requirements
            - suspended
        is_active:
          type: boolean
        inbound_agent_id:
          type: string
          format: uuid
          nullable: true
        outbound_agent_id:
          type: string
          format: uuid
          nullable: true
        inbound_split:
          nullable: true
          description: |
            The A/B test on incoming calls, or `null` when the number always
            answers with `inbound_agent_id`.

            **`percent` is the share of calls that go to the SECOND agent**
            (`agent_id` below). The agent already bound to the number takes the
            rest — a `percent` of 30 means 70% of calls to `inbound_agent_id`
            and 30% to the second agent. The dashboard slider shows the first
            agent's share and stores `100 - slider`; the API always states the
            second agent's.

            Which agent answers a given call is fixed for that call: it is
            derived from the carrier's call id, so a redelivered webhook and
            every internal re-derivation agree. If the second agent cannot take
            calls (inactive, an unpublished workflow, or a different kind of
            agent from the first), the call goes to the first agent and the call
            record says so.
          allOf:
            - $ref: '#/components/schemas/AgentSplit'
        outbound_split:
          nullable: true
          description: |
            The same thing for calls this number places: when `POST /calls` is
            sent without an `agent_id`, this split decides which agent calls.
            An explicit `agent_id` always wins. BYOC SIP endpoints carry no
            split.
          allOf:
            - $ref: '#/components/schemas/AgentSplit'
        sip_inbound_configured:
          type: boolean
          description: |
            Whether carrier-side routing for incoming calls is in place. On an
            `external` number: whether the number is on Yappr's Call Control App
            in your Telnyx account, so calls to it reach Yappr.
        sip_outbound_configured:
          type: boolean
        country_code:
          type: string
          nullable: true
        monthly_cost:
          type: number
          nullable: true
          description: >
            The number's monthly price in cents, before VAT, as listed for it.
            Whether Yappr charges it is `rent`. Null on an `external` number.
        rent:
          description: >
            Whether Yappr charges the number's monthly rent. Returned by GET
            /phone-numbers and PATCH /phone-numbers/{id}; not part of a number
            embedded elsewhere (a campaign's from_phone_number, a carrier
            account's numbers).
          allOf:
            - $ref: '#/components/schemas/PhoneNumberRent'
        next_renewal_at:
          type: string
          format: date-time
          nullable: true
          description: >
            When the rent next renews: monthly, on the day and time the
            subscription started (the last day of a shorter month). Null when
            `rent.included`, and when the number's release is scheduled
            (`scheduled_release_at`): it does not renew. Returned by GET
            /phone-numbers and PATCH /phone-numbers/{id}.
        scheduled_release_at:
          type: string
          format: date-time
          nullable: true
          description: >
            When a number released with POST /phone-numbers/{id}/release goes:
            the end of the period already paid for. Until then the number keeps
            working as before; POST /phone-numbers/{id}/keep undoes the release.
            Null when no release is scheduled.
        created_at:
          type: string
          format: date-time
        phone_system:
          type: object
          nullable: true
          description: >
            The extension endpoint a `phone_system` number calls out through;
            `null` on every

            other number.
          properties:
            sip_endpoint_id:
              type: string
              format: uuid
            sip_endpoint_name:
              type:
                - string
                - 'null'
        carrier_account:
          type: object
          nullable: true
          description: >
            The Telnyx account an `external` number calls through. `null` on
            numbers

            bought from Yappr, and for a key without `carrier_accounts:read` —

            `provider: external` still says the number is your own. On a number
            a

            [disconnect](/api-reference/carrier-accounts/delete) kept for its
            history,

            `status` is `disconnected`: `GET /carrier-accounts/{id}` no longer
            finds the

            account, and its `id` is what removes the number

            (`DELETE /carrier-accounts/{id}/numbers/{phone_number_id}`).
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
            provider:
              type: string
              enum:
                - telnyx
            status:
              type: string
              enum:
                - untested
                - active
                - paused
                - disconnected
        carrier_state:
          type: object
          nullable: true
          description: >
            Where an `external` number stands in your Telnyx account. `null` on

            numbers bought from Yappr, and for a key without

            `carrier_accounts:read`. `state` is the first of these that applies:

            `telnyx_gone` (Telnyx no longer lists it: a sync found it gone,
            since

            `removed_at`; it cannot call), `removed` (Removed from this
            workspace: a

            disconnect kept it for its call history, since `removed_at`; it may
            still be

            in your Telnyx account, it cannot call, and `carrier_account.status`
            is

            `disconnected`), `not_ready` (Telnyx lists it

            with a status other than `active`), `paused` (its carrier account is

            paused), `blocked` (not configured, and a setting in `blockers`
            stops

            Yappr answering it), `not_configured` (calls out work; calls in
            still

            ring at `current_connection_name` until you configure it with

            `POST /carrier-accounts/{id}/numbers/{phone_number_id}/configure`)
            and

            `ready` (calls to it are answered here).
          properties:
            state:
              type: string
              enum:
                - ready
                - not_configured
                - blocked
                - paused
                - not_ready
                - telnyx_gone
                - removed
            telnyx_status:
              type: string
              nullable: true
              description: >-
                The number's status in Telnyx, as of the last sync. `null` until
                a sync has read it.
            current_connection_name:
              type: string
              nullable: true
              description: >-
                The connection the number is on in Telnyx, as of the last sync.
                `null` when it is on none.
            previous_connection_name:
              type: string
              nullable: true
              description: >-
                The connection the number goes back to when you stop answering
                it here. `null` when it had none.
            blockers:
              type: array
              items:
                type: string
                enum:
                  - forwarding_always
                  - translated_number
                  - tech_prefix
              description: >
                Telnyx settings that stop Yappr answering the number. Configure
                is refused while any is on.

                `forwarding_always`: Telnyx forwards every call to it elsewhere.
                `translated_number`: Telnyx

                delivers its calls as another number. `tech_prefix`: Telnyx adds
                a tech prefix to the dialled

                number, so Yappr could not match it. Change the setting in
                Telnyx, then sync.
            notes:
              type: array
              items:
                type: string
                enum:
                  - number_recording
                  - forwarding_on_failure
                  - call_screening
                  - off_by_owner
                  - off_until_active
                  - off_while_paused
              description: >
                Telnyx voice settings on the number that configuring leaves on
                (recording, forwarding when

                unanswered, call screening). They stay as they are when you
                configure it. When the number is

                switched off (`is_active` is `false`, so it places no calls),
                one more note says why:

                `off_by_owner` (an owner or admin switched it off; it stays off
                until one switches it on),

                `off_until_active` (Telnyx did not list it as active; the sync
                switches it on once Telnyx does)

                or `off_while_paused` (its carrier account paused; turning the
                account back on switches it on).
            removed_at:
              type: string
              format: date-time
              nullable: true
              description: >-
                When the number went out of use here, on a `telnyx_gone` or
                `removed` number. `null` on every other.
        ownership_verified_at:
          type: string
          format: date-time
          nullable: true
          description: >
            When your Telnyx API key last proved that this `external` number is
            an

            active number in your account. `null` means that is not proven now:
            Telnyx

            no longer lists it as active, or its account was disconnected. The
            number is

            not callable until a [test](/api-reference/carrier-accounts/test) or
            a sync

            finds it again. Always `null` on numbers bought from Yappr.
    Disposition:
      type: object
      properties:
        id:
          type: string
          format: uuid
        label:
          type: string
        color:
          type: string
          example: '#22c55e'
          description: >
            Always set. A disposition created without a colour is stored grey
            (`#6b7280`), the same default the dashboard's picker starts on. The
            format is not validated.
        position:
          type: integer
          description: Display order, ascending. Not unique.
        is_protected:
          type: boolean
          description: >-
            Protected dispositions cannot be deleted. They can still be renamed,
            which stops the rules that set them by name from finding them.
        created_at:
          type: string
          format: date-time
    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.
    PhoneNumberRent:
      type: object
      required:
        - included
        - reason
        - monthly_price_cents
        - last_charged_at
      properties:
        included:
          type: boolean
          description: >
            False when a rent was charged for the number in the last 40 days
            (each renewal is a phone_number row on GET /billing/transactions);
            true when none was.
        reason:
          type: string
          nullable: true
          enum:
            - own_carrier
            - not_charged
            - no_subscription
            - phone_system
            - null
          description: >
            Why the rent is included: `own_carrier` - a number in your own
            Telnyx account, whose rent Telnyx bills you; `not_charged` - a
            monthly subscription is on record but has charged nothing in the
            last 40 days; `no_subscription` - a Yappr number with no
            subscription (one Yappr set up for you); `phone_system` - a number
            that calls out through your own phone system, which Yappr does not
            rent. Null when the rent is charged.
        monthly_price_cents:
          type: integer
          nullable: true
          description: The monthly rent before VAT, paid by card. Null when included.
        last_charged_at:
          type: string
          format: date-time
          nullable: true
          description: The newest rent charge in the last 40 days, or null.
    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.