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

# Sync Numbers

> Reads every number in your Telnyx account with your key and brings each one
into this workspace as an `external` phone number. Calls out from them work
right away; to have an agent answer calls to one,
[configure it](/api-reference/carrier-accounts/configure-number). **Changes
nothing in your Telnyx account and places no call.** Yappr also runs it when you
choose the Call Control App, on every test and Turn back on, and once a day;
call it after you buy, port or release numbers in Telnyx. Requires
`carrier_accounts:manage`.
Limit: 48 sync runs a day per workspace (continuing a run is free).

- A new number starts able to call if Telnyx lists it as active and the account
  is not paused. On a number already here, a sync refreshes only what Telnyx
  says (`carrier_state`): its name and agents stay as you set them. It switches
  a number back on only when it switched it off itself (`off_until_active`, once
  Telnyx lists it as active again), never one someone in your workspace switched
  off (`off_by_owner`); see `is_active`.
- Numbers Telnyx lists as deleted, ported out, or with a failed purchase or
  port are skipped. Any other status than `active` shows as `not_ready`.
- A number Telnyx no longer lists is marked removed (`carrier_state.state` is
  `telnyx_gone`), never deleted: its call history stays. On a large account, read in parts, that happens only once two
  complete reads in a row miss it.
- A number another Yappr workspace already uses is not added; it is counted in
  `held_elsewhere`.
- A large account is read in parts: `complete: false` means sync again, or let
  Yappr read the next part within 5 minutes.


Reads every number in your Telnyx account, with your API key, and brings each one into
this workspace as a phone number with `provider: "external"`. You don't add numbers one
by one: they appear in [GET /phone-numbers](https://docs.goyappr.com/api-reference/phone-numbers/list.md) and on the
account's `numbers`, with the same agent settings as any number. Requires
`carrier_accounts:manage`.

A sync **changes nothing in your Telnyx account and places no call.** Yappr runs one when
you [choose the Call Control App](https://docs.goyappr.com/api-reference/carrier-accounts/connection.md), on every
[test](https://docs.goyappr.com/api-reference/carrier-accounts/test.md) and [Turn back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md),
and once a day. Call it yourself after you buy, port or release numbers in Telnyx. A
workspace has 48 sync runs a day, whatever starts them; continuing a run already in
progress is free.

To learn whether an account is synced at all — and why not — without running one, read
its `sync_status` on [GET /carrier-accounts/{id}](https://docs.goyappr.com/api-reference/carrier-accounts/get.md#is-the-account-synced),
or `sync` on [GET /carrier-accounts/status](https://docs.goyappr.com/api-reference/carrier-accounts/status.md).

```bash theme={null}
curl -X POST https://api.goyappr.com/carrier-accounts/7c1e…/sync \
  -H "Authorization: Bearer ypr_live_..."
```

```json theme={null}
{
  "data": {
    "synced_at": "2026-09-27T09:14:02Z",
    "complete": true,
    "seen": 43,
    "added": 40,
    "updated": 1,
    "removed": 0,
    "not_ready": 1,
    "held_elsewhere": 1,
    "held_elsewhere_numbers": ["+972501110000"],
    "held_elsewhere_details": [
      { "phone_number": "+972501110000", "reason": "other_workspace" },
      { "phone_number": "+972501110001", "reason": "own_removed" }
    ],
    "excluded": [{ "phone_number": "+972501110001", "telnyx_number_id": "1293…" }],
    "batch": { "seen": 43, "added": 40, "updated": 1, "unchanged": 0, "restored": 0, "removed": 0, "not_ready": 1, "skipped_stale": 0, "invalid": 0, "dropped": 0, "missing": 0, "held_elsewhere": 1, "excluded": 1 },
    "run": { "seen": 43, "added": 40, "updated": 1, "unchanged": 0, "restored": 0, "removed": 0, "not_ready": 1, "skipped_stale": 0, "invalid": 0, "dropped": 0, "missing": 0, "held_elsewhere": 1, "excluded": 1 },
    "numbers": [
      {
        "id": "e2a4…",
        "number": "+972501234567",
        "provider": "external",
        "is_active": true,
        "inbound_agent_id": null,
        "outbound_agent_id": null,
        "sip_inbound_configured": false,
        "ownership_verified_at": "2026-09-27T09:14:02Z",
        "carrier_account": { "id": "7c1e…", "name": "Main Telnyx account", "provider": "telnyx", "status": "active" },
        "carrier_state": {
          "state": "not_configured",
          "telnyx_status": "active",
          "current_connection_name": "Office PBX",
          "previous_connection_name": null,
          "blockers": [],
          "notes": ["number_recording"],
          "removed_at": null
        }
      }
    ]
  }
}
```

## What a sync does to each number

| In Telnyx | In Yappr |
| - | - |
| New to Yappr | Added. It can call out right away if Telnyx lists it as active and the account is not paused; otherwise it comes in switched off (`is_active: false`, see below). Calls to it keep going where they go in Telnyx until you [configure it](https://docs.goyappr.com/api-reference/carrier-accounts/configure-number.md). |
| Already here | Only what Telnyx says is refreshed (`carrier_state`: its status, its connection, its settings). Its name and its agents stay as you set them. It is switched back on only if the sync itself had switched it off (see below). |
| Any status other than `active` | Shown as `not_ready`, and switched off (`off_until_active`, or `off_by_owner` if someone in your workspace had switched it off): it cannot call, and Yappr does not answer calls to it. |
| Deleted, ported out, or a failed purchase or port | Skipped. |
| No longer listed | Shown as `telnyx_gone` (since `carrier_state.removed_at`), never deleted, so its call history stays. On a large account, once two complete reads in a row miss it (see below). It cannot call, and calls to it stop being answered. [Remove it](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md) once you're done with it. If it comes back to your account, the next sync lists it again and switches it back on, unless someone in your workspace had switched it off. |
| Already used by another Yappr workspace | Not added: counted in `held_elsewhere`. |
| Removed from this workspace by you | Skipped, and listed in `excluded` until you add it back (see below). |

## When a number is switched off

A number that cannot call out has `is_active: false`, and `carrier_state.notes` says why.
What switched it off decides what switches it back on:

| Note | Switched off because | Switched back on by |
| - | - | - |
| `off_until_active` | Telnyx does not list it as active (a port still pending, say), it left your account, or the account was disconnected. | The sync switches it back on once Telnyx lists it as active again (on an account that is not paused). Nothing to do. |
| `off_while_paused` | Its carrier account paused. | [Turn back on](https://docs.goyappr.com/api-reference/carrier-accounts/reactivate.md), which switches on these numbers and only these. |
| `off_by_owner` | Someone in your workspace switched it off. | Only someone in your workspace. It stays off: a sync or Turn back on never switches it on. |

A number someone in your workspace switched off stays off through every sync. The sync
still proves every active number again (`ownership_verified_at`), so you can
[configure](https://docs.goyappr.com/api-reference/carrier-accounts/configure-number.md) any of them and have its
calls answered, whether it is on or off.

## A number another workspace uses

A number is in Yappr once. If several workspaces connect the same Telnyx account, a number
one of them already has is never taken over by another: the sync counts it in
`held_elsewhere` and lists it in `held_elsewhere_numbers` (up to 100, without saying which
workspace has it). It is added here by the first sync after that workspace removes it
([DELETE …/numbers/{phone_number_id}](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md), which
changes nothing in Telnyx and keeps its call history there). That workspace's own syncs
then skip it.

`held_elsewhere_details` says why each number the sync kept out is not here
(`{phone_number, reason}`, never which workspace): the numbers in `held_elsewhere_numbers`,
then the ones in `excluded`.

| `reason` | Meaning |
| - | - |
| `other_workspace` | Another workspace uses it. It comes here at the first sync after that workspace removes it. |
| `own_removed` | You removed it from this workspace (it is in `excluded`). Add it back to bring it back (see [Numbers you removed](#numbers-you-removed)). |
| `pending_release` | Another record holds it until it lets it go: a workspace that disconnected the account and keeps it for its call history, another connection of this workspace, or a number Yappr itself holds. It comes here at the first sync after that record lets it go; there is nothing to do here. |

## Numbers you removed

A number you took out with
[DELETE …/numbers/{phone_number_id}](https://docs.goyappr.com/api-reference/carrier-accounts/remove-number.md) is
skipped by every sync of this workspace, so another workspace connected to the same Telnyx
account can take it. Each sync lists the ones it skipped in `excluded` (up to 100). To have
one here again, send [POST /carrier-accounts/{id}/numbers](https://docs.goyappr.com/api-reference/carrier-accounts/add-number.md)
with the number: it is added here again (`201`), and the syncs keep it up to date from then
on — unless another workspace has taken it since: then `409 NUMBER_ALREADY_REGISTERED`
until that workspace removes it. A number that left your Telnyx account and came back under
a new Telnyx id is synced as usual.

## Large accounts

A sync reads a large account in parts. `complete: false` means there is more to read:
call sync again, or let Yappr read the next part: it carries on within 5 minutes, where
this one stopped (the counts are the run's so far, and `synced_at` is `null`). An account
with more than 10,000 numbers answers `422 TOO_MANY_NUMBERS`.

`run` and `batch` hold every count, of the run so far and of the last part, including a few
the top level leaves out: `unchanged`, `restored`, `missing`, `dropped`, `skipped_stale`,
`invalid` and `excluded`.

Numbers that left your account are marked gone (`telnyx_gone`) only at the end of a whole
read. Telnyx's list can shift while a large account is read in parts, so there a number is
marked gone only when two complete reads in a row miss it, and a read during which the list
changed removes nothing.

The account keeps what the last sync found on
[GET /carrier-accounts/{id}](https://docs.goyappr.com/api-reference/carrier-accounts/get.md): `last_synced_at`, `sync`
(with `in_progress: true` while a large account is still being read) and, when it failed,
`last_sync_error`.

## Errors

| Status | `code` | Meaning |
| - | - | - |
| 403 | `CARRIER_ACCOUNTS_NOT_ENABLED` | Yappr has switched carrier accounts off for this workspace. Contact Yappr support. |
| 404 | `CARRIER_ACCOUNT_NOT_FOUND` | Not in this workspace. |
| 409 | `CONNECTION_REQUIRED` | [Choose the Call Control App](https://docs.goyappr.com/api-reference/carrier-accounts/connection.md) first. |
| 422 | `TELNYX_KEY_REJECTED` | Telnyx refused the saved key. The account pauses (`key_rejected`) and no number changes. |
| 422 | `TELNYX_REFUSED_REQUEST` | Telnyx accepted the key but refused to list the numbers. Check the key's permissions in Telnyx. The account does not pause. |
| 422 | `TOO_MANY_NUMBERS` | The account holds more than 10,000 numbers. |
| 429 | `RATE_LIMITED` | 48 sync runs in this workspace today; continuing a run already in progress is free. `Retry-After` says when the day's window resets. |
| 500 | `INTERNAL_ERROR` | Yappr could not save what it read. Nothing else changed, and `last_sync_error` is `sync_failed`. Try again. |
| 503 | `TELNYX_UNAVAILABLE` | Telnyx did not answer. No number changed, and `last_sync_error` says so. Try again. |
| 503 | `SYNC_NOT_READY` | Yappr has not switched number syncing on yet (`sync_status.ready: false`). Nothing changed; it starts by itself. Choosing the app, a test and Turn back on still do their job, and report it in `sync_error`. |


## OpenAPI

````yaml POST /carrier-accounts/{id}/sync
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:
  /carrier-accounts/{id}/sync:
    parameters:
      - in: path
        name: id
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - Carrier Accounts
      summary: Sync numbers
      description: >
        Reads every number in your Telnyx account with your key and brings each
        one

        into this workspace as an `external` phone number. Calls out from them
        work

        right away; to have an agent answer calls to one,

        [configure it](/api-reference/carrier-accounts/configure-number).
        **Changes

        nothing in your Telnyx account and places no call.** Yappr also runs it
        when you

        choose the Call Control App, on every test and Turn back on, and once a
        day;

        call it after you buy, port or release numbers in Telnyx. Requires

        `carrier_accounts:manage`.

        Limit: 48 sync runs a day per workspace (continuing a run is free).


        - A new number starts able to call if Telnyx lists it as active and the
        account
          is not paused. On a number already here, a sync refreshes only what Telnyx
          says (`carrier_state`): its name and agents stay as you set them. It switches
          a number back on only when it switched it off itself (`off_until_active`, once
          Telnyx lists it as active again), never one someone in your workspace switched
          off (`off_by_owner`); see `is_active`.
        - Numbers Telnyx lists as deleted, ported out, or with a failed purchase
        or
          port are skipped. Any other status than `active` shows as `not_ready`.
        - A number Telnyx no longer lists is marked removed
        (`carrier_state.state` is
          `telnyx_gone`), never deleted: its call history stays. On a large account, read in parts, that happens only once two
          complete reads in a row miss it.
        - A number another Yappr workspace already uses is not added; it is
        counted in
          `held_elsewhere`.
        - A large account is read in parts: `complete: false` means sync again,
        or let
          Yappr read the next part within 5 minutes.
      operationId: syncCarrierAccountNumbers
      responses:
        '200':
          description: Synced. For a large account, one more part read (see `complete`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    allOf:
                      - type: object
                        properties:
                          synced_at:
                            type: string
                            format: date-time
                            nullable: true
                            description: >-
                              When the whole account had been read. `null` while
                              `complete` is `false`.
                          complete:
                            type: boolean
                            description: >
                              `false` while a large account is still being read
                              in parts: sync

                              again, or let Yappr read the next part within 5
                              minutes. The counts

                              are the run's so far.
                      - type: object
                        properties:
                          seen:
                            type: integer
                            description: Numbers read from your Telnyx account.
                          added:
                            type: integer
                            description: Numbers new to this workspace.
                          updated:
                            type: integer
                            description: Numbers already here whose Telnyx details changed.
                          removed:
                            type: integer
                            description: >
                              Numbers Telnyx no longer lists, now marked removed
                              (`telnyx_gone`). Counted

                              only at the end of a whole read of the account. On
                              an account read in parts, a number is marked

                              removed only when two complete reads in a row miss
                              it, and a read during which

                              Telnyx's list changed removes nothing.
                          not_ready:
                            type: integer
                            description: >-
                              Numbers Telnyx lists with a status other than
                              `active`.
                          held_elsewhere:
                            type: integer
                            description: >
                              Numbers in your Telnyx account that another Yappr
                              workspace already uses.

                              They are not added here. One is added by the next
                              sync after that workspace

                              removes it (Remove from this workspace, which
                              keeps its call history there).
                          held_elsewhere_numbers:
                            type: array
                            items:
                              type: string
                              example: '+972501234567'
                            description: >-
                              Those numbers, up to 100 of them (`held_elsewhere`
                              is the exact count). It never says which workspace
                              holds them.
                          held_elsewhere_details:
                            type: array
                            description: >
                              Why each number of your Telnyx account that the
                              sync kept out is not here: the

                              numbers in `held_elsewhere_numbers` with their
                              reason, then every number in

                              `excluded` as `own_removed`. It never says which
                              workspace holds a number.

                              - `other_workspace` — another Yappr workspace uses
                              it; **Your carrier** shows it as **In use by
                              another workspace**. It comes here at the first
                              sync after that workspace removes it (Remove from
                              this workspace).

                              - `own_removed` — this workspace removed it;
                              **Your carrier** shows it as **Removed from this
                              workspace**, and **Add back** adds it again (the
                              same numbers as `excluded`), unless another
                              workspace has taken it since: then Add back
                              answers `409 NUMBER_ALREADY_REGISTERED` until that
                              workspace removes it.

                              - `pending_release` — another record holds it
                              until it lets it go: a workspace that disconnected
                              the account and keeps it for its call history,
                              another connection of this workspace, or a number
                              Yappr itself holds. It comes here at the first
                              sync after that record lets it go; there is
                              nothing to do here.
                            items:
                              type: object
                              properties:
                                phone_number:
                                  type: string
                                  example: '+972501110000'
                                reason:
                                  type: string
                                  enum:
                                    - other_workspace
                                    - own_removed
                                    - pending_release
                          excluded:
                            type: array
                            description: >
                              Numbers in your Telnyx account that this workspace
                              removed (Remove from this

                              workspace), up to 100. Every sync of this
                              workspace skips them, so another

                              workspace can take them. **Your carrier** lists
                              them as **Removed from this

                              workspace**, with **Add back**:

                              [POST
                              /carrier-accounts/{id}/numbers](/api-reference/carrier-accounts/add-number)

                              with the number (`201`), unless another workspace
                              has taken it since: then

                              `409 NUMBER_ALREADY_REGISTERED` until that
                              workspace removes it. A number Telnyx

                              lists under a new id (it left your account and
                              came back) is synced as usual.
                            items:
                              type: object
                              properties:
                                phone_number:
                                  type: string
                                  example: '+972501110001'
                                telnyx_number_id:
                                  type: string
                                  nullable: true
                                  example: '1293384261075731499'
                                  description: >-
                                    The number's id in your Telnyx account, when
                                    the sync has read it.
                          batch:
                            type: object
                            description: >-
                              The counts of the last part read (the whole
                              account, on one that fits in one part).
                            properties:
                              seen:
                                type: integer
                                description: Numbers read from your Telnyx account.
                              added:
                                type: integer
                                description: Numbers new to this workspace.
                              updated:
                                type: integer
                                description: >-
                                  Numbers already here whose Telnyx details
                                  changed.
                              unchanged:
                                type: integer
                                description: Numbers already here with nothing new.
                              restored:
                                type: integer
                                description: >-
                                  Numbers that had left your account and came
                                  back.
                              removed:
                                type: integer
                                description: >-
                                  Numbers marked removed because Telnyx no
                                  longer lists them.
                              not_ready:
                                type: integer
                                description: >-
                                  Numbers Telnyx lists with a status other than
                                  `active`.
                              skipped_stale:
                                type: integer
                                description: >-
                                  Numbers you configured or stopped answering on
                                  while the sync was reading them: left as they
                                  are.
                              invalid:
                                type: integer
                                description: >-
                                  Entries Yappr could not read. While any
                                  remain, the run removes no number.
                              dropped:
                                type: integer
                                description: >-
                                  Numbers Telnyx lists as deleted, ported out,
                                  or with a failed purchase or port.
                              missing:
                                type: integer
                                description: >-
                                  Numbers a run read in parts did not find. They
                                  are kept, and removed only if the next
                                  complete run misses them too.
                              held_elsewhere:
                                type: integer
                                description: >-
                                  Numbers another record holds (see
                                  `held_elsewhere_details`).
                              excluded:
                                type: integer
                                description: Numbers this workspace removed, skipped.
                          run:
                            type: object
                            description: >-
                              The counts of the whole run so far. `seen`,
                              `added`, `updated`, `removed`, `not_ready` and
                              `held_elsewhere` above are the same numbers.
                            properties:
                              seen:
                                type: integer
                                description: Numbers read from your Telnyx account.
                              added:
                                type: integer
                                description: Numbers new to this workspace.
                              updated:
                                type: integer
                                description: >-
                                  Numbers already here whose Telnyx details
                                  changed.
                              unchanged:
                                type: integer
                                description: Numbers already here with nothing new.
                              restored:
                                type: integer
                                description: >-
                                  Numbers that had left your account and came
                                  back.
                              removed:
                                type: integer
                                description: >-
                                  Numbers marked removed because Telnyx no
                                  longer lists them.
                              not_ready:
                                type: integer
                                description: >-
                                  Numbers Telnyx lists with a status other than
                                  `active`.
                              skipped_stale:
                                type: integer
                                description: >-
                                  Numbers you configured or stopped answering on
                                  while the sync was reading them: left as they
                                  are.
                              invalid:
                                type: integer
                                description: >-
                                  Entries Yappr could not read. While any
                                  remain, the run removes no number.
                              dropped:
                                type: integer
                                description: >-
                                  Numbers Telnyx lists as deleted, ported out,
                                  or with a failed purchase or port.
                              missing:
                                type: integer
                                description: >-
                                  Numbers a run read in parts did not find. They
                                  are kept, and removed only if the next
                                  complete run misses them too.
                              held_elsewhere:
                                type: integer
                                description: >-
                                  Numbers another record holds (see
                                  `held_elsewhere_details`).
                              excluded:
                                type: integer
                                description: Numbers this workspace removed, skipped.
                      - type: object
                        properties:
                          numbers:
                            type: array
                            description: >-
                              The account's numbers in this workspace after the
                              sync.
                            items:
                              $ref: '#/components/schemas/PhoneNumber'
        '403':
          $ref: '#/components/responses/CarrierAccountsNotEnabled'
        '404':
          description: '`CARRIER_ACCOUNT_NOT_FOUND` — not in this workspace.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '`CONNECTION_REQUIRED` — choose the Call Control App first.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >
            - `TELNYX_KEY_REJECTED` — Telnyx refused the saved key. The account
            pauses
              (`key_rejected`) and no number changes.
            - `TELNYX_REFUSED_REQUEST` — Telnyx accepted the key but refused to
            list the
              numbers. Check the key's permissions in Telnyx. The account does not pause.
            - `TOO_MANY_NUMBERS` — the account holds more than 10,000 numbers.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            `RATE_LIMITED` — 48 sync runs in this workspace today (continuing a
            run is free).
          headers:
            Retry-After:
              $ref: '#/components/headers/RetryAfter'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >
            - `TELNYX_UNAVAILABLE` — Telnyx did not answer. No number changed
            and
              `last_sync_error` says so; try again.
            - `SYNC_NOT_READY` — Yappr has not switched number syncing on yet
              (`sync_status.ready: false`, readable without syncing). Nothing changed; it
              starts by itself. Choosing the app, a test and Turn back on still do their
              job, and report it in `sync_error`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    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.
    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
    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
    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.
  responses:
    CarrierAccountsNotEnabled:
      description: >
        `CARRIER_ACCOUNTS_NOT_ENABLED` — Yappr has switched calling out through
        your own

        Telnyx account off for this workspace. It is available in every
        workspace, so this

        is only the emergency-off answer; contact Yappr support. Every
        carrier-accounts

        route answers this while it is off (check with

        [GET /carrier-accounts/status](/api-reference/carrier-accounts/status)).
        An API key

        without the route's scope gets a 403 of its own.
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
              - type: object
                properties:
                  enabled:
                    type: boolean
                    example: false
          example:
            error: >-
              Calling out through your own Telnyx account is switched off for
              this workspace. Contact Yappr support.
            code: CARRIER_ACCOUNTS_NOT_ENABLED
            enabled: false
  headers:
    RetryAfter:
      description: Whole seconds to wait before sending the request again. Never zero.
      schema:
        type: integer
        minimum: 1
  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.