# Voice reference

> Every Voice endpoint with parameters, request and response fields, required scope and a curl example.

Every Voice endpoint. Base URL `https://api.pingx.ai`; send `Authorization: Bearer <API key>`. Read endpoints need `voice:read` (or `:write`), write endpoints need `voice:write`; the bare `voice` scope grants both. See [Authentication and conventions](https://docs.pingx.ai/authentication.md). Machine-readable: [openapi.json](/openapi.json).

**19 endpoints**

| Method | Path | Operation | Scope |
|---|---|---|---|
| `GET` | `/voice/v1/calls` | ListCalls | read |
| `POST` | `/voice/v1/calls` | PlaceCall | write |
| `GET` | `/voice/v1/calls/{callId}` | GetCall | read |
| `GET` | `/voice/v1/calls/{callId}/recording` | DownloadCallRecording | read |
| `GET` | `/voice/v1/calls/{callId}/transcript` | GetCallTranscript | read |
| `POST` | `/voice/v1/dials/{dialId}:end` | EndCall | write |
| `GET` | `/voice/v1/dials/{dialId}/status` | GetCallStatus | read |
| `GET` | `/voice/v1/human-assignments` | ListHumanAssignments | read |
| `PUT` | `/voice/v1/human-assignments/{agentId}/{humanId}` | SetHumanAssignment | write |
| `POST` | `/voice/v1/human-calls` | PlaceHumanCall | write |
| `GET` | `/voice/v1/humans` | ListHumans | read |
| `POST` | `/voice/v1/humans` | AddHuman | write |
| `DELETE` | `/voice/v1/humans/{humanId}` | RemoveHuman | write |
| `PATCH` | `/voice/v1/humans/{humanId}` | UpdateHuman | write |
| `GET` | `/voice/v1/numbers` | ListNumbers | read |
| `POST` | `/voice/v1/numbers` | AddNumber | write |
| `DELETE` | `/voice/v1/numbers/{numberId}` | RemoveNumber | write |
| `POST` | `/voice/v1/numbers/{numberId}:setDefault` | SetDefaultNumber | write |
| `POST` | `/voice/v1/numbers/{numberId}:setInboundAgent` | SetInboundAgent | write |

## GET /voice/v1/calls

**ListCalls** · needs `voice:read` (or write)

ListCalls lists the organization's past and in-progress calls (AI agent
calls, inbound calls and human-bridged calls), newest first, optionally
filtered. Browser test calls from the app are not included. Transcript
text and audio are not returned here; use GetCallTranscript and
DownloadCallRecording.

**Query parameters**

| Name | Type | Description |
|---|---|---|
| `pageSize` | integer | Max calls per page. Default 50, max 200. |
| `pageToken` | string | nextPageToken from the previous response; empty for the first page. |
| `agentId` | string (int64) | Only calls handled by this AI agent. Optional (must belong to the organization). |
| `humanId` | string (int64) | Only bridged calls handled by this human. Optional. |
| `leadId` | string (int64) | Only the call(s) from this dial attempt (the dialId from PlaceCall). |
| `startedAfter` | string | Only calls started at or after this time (RFC3339). Optional. |
| `startedBefore` | string | Only calls started before this time (RFC3339). Optional. |

**Response** `ListCallsResponse`

| Field | Type | Description |
|---|---|---|
| `calls` | Call[] |  |
| `calls[].callId` | string (int64) | Call id; used by GetCall, GetCallTranscript and DownloadCallRecording. |
| `calls[].direction` | string | "outbound" (AI agent dialed the customer), "inbound" (customer dialed one of the organization's numbers) or "human" (bridged human call). |
| `calls[].leadId` | string (int64) | The dialId returned when this call was placed via the API; 0 for inbound calls. |
| `calls[].agentId` | string (int64) | AI agent that handled the call; 0 for human-bridged calls. |
| `calls[].humanId` | string (int64) | Human who handled the call; 0 for AI calls. |
| `calls[].humanName` | string | Human's name for human-bridged calls; empty otherwise. |
| `calls[].customerName` | string | Customer name if known; may be empty. |
| `calls[].customerPhone` | string | Customer phone number, E.164 where known. |
| `calls[].startedAt` | string | When the call started (RFC3339, UTC). |
| `calls[].endedAt` | string | When it ended (RFC3339, UTC); empty while ongoing. |
| `calls[].outcome` | string | Free-text outcome (e.g. "link_sent", "declined"). |
| `calls[].sentimentScore` | integer | Sentiment 1 (negative) to 5 (positive); 0 = unscored. |
| `calls[].sentimentWentRight` | string | What went right / wrong, from the post-call sentiment analysis. |
| `calls[].sentimentWentWrong` | string |  |
| `calls[].transcriptSummary` | string | AI summary of the conversation; empty if none captured. |
| `calls[].metrics` | ScoredMetric[] | The organization's custom scored metrics for this call. |
| `calls[].hasTranscript` | boolean | True if GetCallTranscript will return content. |
| `calls[].hasRecording` | boolean | True if DownloadCallRecording will return audio. |
| `nextPageToken` | string | Pass as pageToken for the next page; empty on the last page. |

```bash
curl "https://api.pingx.ai/voice/v1/calls" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## POST /voice/v1/calls

**PlaceCall** · needs `voice:write`

PlaceCall starts an outbound phone call from an AI agent to a customer.
It validates that the agent belongs to the organization, then queues the
call and returns immediately with a dialId; the telephony layer rings the
customer asynchronously (credit checks, caller-ID/number selection and
number-sync checks happen there, exactly as for calls placed from the
the app). Poll GetCallStatus with the dialId to follow progress, and call
EndCall to hang up. Once the call has connected it appears in ListCalls /
GetCall (find it with ListCalls leadId = dialId).

Not idempotent: every successful request places a new call, so do not
blindly retry on a timeout; check ListCalls first. Billing is the same as
for the app calls; a call refused for insufficient credits is reported by
GetCallStatus as status "failed" with the reason in `outcome`.

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `agentId` | string (int64) | The AI agent (persona) that will run the call. Required. Must belong to the organization (NOT_FOUND otherwise). |
| `phone` | string | Customer phone number to call, E.164 (e.g. "+919876543210"). Required. |
| `name` | string | Optional customer display name, shown in call history (max 120 chars). |

**Response** `PlaceCallResponse`

| Field | Type | Description |
|---|---|---|
| `dialId` | string (int64) | Handle for this dial attempt; pass it to GetCallStatus and EndCall, and use it as leadId in ListCalls to find the resulting call. |
| `status` | string | Always "dialing" on success (the call has been queued, not yet answered). |

```bash
curl -X POST "https://api.pingx.ai/voice/v1/calls" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agentId":"…","phone":"…","name":"…"}'
```

## GET /voice/v1/calls/{callId}

**GetCall** · needs `voice:read` (or write)

GetCall returns one call's details: parties, timing, outcome, AI summary,
sentiment and scored metrics, and whether a transcript and recording
exist. NOT_FOUND for an unknown id or another organization's call.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `callId` | string (int64) |  |

**Response** `GetCallResponse`

| Field | Type | Description |
|---|---|---|
| `call` | Call | One call (AI agent call, inbound call, or human-bridged call). |
| `call.callId` | string (int64) | Call id; used by GetCall, GetCallTranscript and DownloadCallRecording. |
| `call.direction` | string | "outbound" (AI agent dialed the customer), "inbound" (customer dialed one of the organization's numbers) or "human" (bridged human call). |
| `call.leadId` | string (int64) | The dialId returned when this call was placed via the API; 0 for inbound calls. |
| `call.agentId` | string (int64) | AI agent that handled the call; 0 for human-bridged calls. |
| `call.humanId` | string (int64) | Human who handled the call; 0 for AI calls. |
| `call.humanName` | string | Human's name for human-bridged calls; empty otherwise. |
| `call.customerName` | string | Customer name if known; may be empty. |
| `call.customerPhone` | string | Customer phone number, E.164 where known. |
| `call.startedAt` | string | When the call started (RFC3339, UTC). |
| `call.endedAt` | string | When it ended (RFC3339, UTC); empty while ongoing. |
| `call.outcome` | string | Free-text outcome (e.g. "link_sent", "declined"). |
| `call.sentimentScore` | integer | Sentiment 1 (negative) to 5 (positive); 0 = unscored. |
| `call.sentimentWentRight` | string | What went right / wrong, from the post-call sentiment analysis. |
| `call.sentimentWentWrong` | string |  |
| `call.transcriptSummary` | string | AI summary of the conversation; empty if none captured. |
| `call.metrics` | ScoredMetric[] | The organization's custom scored metrics for this call. |
| `call.hasTranscript` | boolean | True if GetCallTranscript will return content. |
| `call.hasRecording` | boolean | True if DownloadCallRecording will return audio. |

```bash
curl "https://api.pingx.ai/voice/v1/calls/CALLID" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## GET /voice/v1/calls/{callId}/recording

**DownloadCallRecording** · needs `voice:read` (or write)

DownloadCallRecording returns a call's audio recording (Ogg/Opus, content
type "audio/ogg") as the response body itself. Over REST this is the raw
audio file, so `curl -H "Authorization: Bearer pk_..." -o call.ogg
https://HOST/voice/v1/calls/123/recording` just works; over Connect/gRPC it
is a google.api.HttpBody message. The API key authenticates the download
directly: there are no signed or expiring URLs to manage. Whole-file
download only (no HTTP Range). NOT_FOUND when the call is unknown, belongs
to another organization, or has no recording (check Call.hasRecording);
FAILED_PRECONDITION if the file exceeds the 32 MiB download cap.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `callId` | string (int64) |  |

**Response** `apiHttpBody`

| Field | Type | Description |
|---|---|---|
| `contentType` | string | The HTTP Content-Type header value specifying the content type of the body. |
| `data` | string (base64) | The HTTP request/response body as raw binary. |
| `extensions` | protobufAny[] | Application specific response metadata. Must be set in the first response for streaming APIs. |
| `extensions[].@type` | string | Identifies the type of the serialized Protobuf message with a URI reference consisting of a prefix ending in a slash and the fully-qualified type name. Example: type.googleapis.com/google.protobuf.StringValue This string must contain at least one `/` character, and the content after the last `/` must be the fully-qualified name of the type in canonical form, without a leading dot. Do not write a scheme on these URI references so that clients do not attempt to contact them. The prefix is arbitrary and Protobuf implementations are expected to simply strip off everything up to and including the last `/` to identify the type. `type.googleapis.com/` is a common default prefix that some legacy implementations require. This prefix does not indicate the origin of the type, and URIs containing it are not expected to respond to any requests. All type URL strings must be legal URI references with the additional restriction (for the text format) that the content of the reference must consist only of alphanumeric characters, percent-encoded escapes, and characters in the following set (not including the outer backticks): `/-.~_!$&()*+,;=`. Despite our allowing percent encodings, implementations should not unescape them to prevent confusion with existing parsers. For example, `type.googleapis.com%2FFoo` should be rejected. In the original design of `Any`, the possibility of launching a type resolution service at these type URLs was considered but Protobuf never implemented one and considers contacting these URLs to be problematic and a potential security issue. Do not attempt to contact type URLs. |

```bash
curl "https://api.pingx.ai/voice/v1/calls/CALLID/recording" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## GET /voice/v1/calls/{callId}/transcript

**GetCallTranscript** · needs `voice:read` (or write)

GetCallTranscript returns a call's transcript as speaker-tagged turns
(voice markup such as "[laughs]" is stripped). A call that finished
without a transcript returns an empty list. NOT_FOUND for an unknown id or
another organization's call.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `callId` | string (int64) |  |

**Response** `GetCallTranscriptResponse`

| Field | Type | Description |
|---|---|---|
| `turns` | TranscriptTurn[] | The conversation in order. Empty if the call has no transcript. |
| `turns[].role` | string | "assistant" (the AI agent or human operator side) or "user" (the customer). |
| `turns[].text` | string | What was said. |

```bash
curl "https://api.pingx.ai/voice/v1/calls/CALLID/transcript" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## POST /voice/v1/dials/{dialId}:end

**EndCall** · needs `voice:write`

EndCall hangs up an in-progress call immediately (disconnects the customer
and the AI agent / human). Idempotent: ending a call that already ended
returns ended=false without error. NOT_FOUND for an unknown dialId or one
belonging to another organization.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `dialId` | string (int64) | dialId returned by PlaceCall or PlaceHumanCall. |

**Response** `EndCallResponse`

| Field | Type | Description |
|---|---|---|
| `ended` | boolean | True if an in-progress call was hung up; false if nothing was active. |

```bash
curl -X POST "https://api.pingx.ai/voice/v1/dials/DIALID:end" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## GET /voice/v1/dials/{dialId}/status

**GetCallStatus** · needs `voice:read` (or write)

GetCallStatus reports the live status of a call placed with PlaceCall or
PlaceHumanCall, identified by the dialId those returned. Poll every 2-5
seconds while status is "dialing" or "in_progress". NOT_FOUND for a dialId
that does not exist or belongs to another organization.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `dialId` | string (int64) | dialId returned by PlaceCall or PlaceHumanCall. |

**Response** `GetCallStatusResponse`

| Field | Type | Description |
|---|---|---|
| `status` | string | "dialing" (queued / ringing), "in_progress" (answered), "completed" or "failed" (could not be placed, or refused; see outcome). |
| `outcome` | string | Free-text outcome once known (e.g. "link_sent", "declined"), or the reason a call was refused (e.g. insufficient credits). Empty while ongoing. |
| `callId` | string (int64) | The call's id once the call exists (0 while still dialing). Use with GetCall / GetCallTranscript / DownloadCallRecording. |
| `hasTranscript` | boolean | True once a transcript is available. |
| `transcriptSummary` | string | Short AI summary of the conversation; empty until the call has finished post-processing. |
| `sentimentScore` | integer | Sentiment 1 (negative) to 5 (positive); 0 = not scored yet. |

```bash
curl "https://api.pingx.ai/voice/v1/dials/DIALID/status" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## GET /voice/v1/human-assignments

**ListHumanAssignments** · needs `voice:read` (or write)

ListHumanAssignments lists which humans each AI agent may escalate to
(triage). An agent can only ever reach humans assigned to it.

**Query parameters**

| Name | Type | Description |
|---|---|---|
| `pageSize` | integer | Max assignments per page. Default 50, max 200. |
| `pageToken` | string | nextPageToken from the previous response; empty for the first page. |

**Response** `ListHumanAssignmentsResponse`

| Field | Type | Description |
|---|---|---|
| `assignments` | HumanAssignment[] |  |
| `assignments[].agentId` | string (int64) |  |
| `assignments[].humanId` | string (int64) |  |
| `assignments[].channel` | string | Currently always "whatsapp". |
| `assignments[].createdAt` | string | RFC3339, UTC. |
| `nextPageToken` | string | Pass as pageToken for the next page; empty on the last page. |

```bash
curl "https://api.pingx.ai/voice/v1/human-assignments" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## PUT /voice/v1/human-assignments/{agentId}/{humanId}

**SetHumanAssignment** · needs `voice:write`

SetHumanAssignment allows (channel "whatsapp") or revokes (channel "")
an AI agent's escalation to a human. Idempotent. INVALID_ARGUMENT if the
agent is unknown or the human has no whatsappMobile.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `agentId` | string (int64) | Path parameter. |
| `humanId` | string (int64) | Path parameter. |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `channel` | string | "whatsapp" to allow escalation; "" to revoke the assignment. |

**Response** `SetHumanAssignmentResponse`

| Field | Type | Description |
|---|---|---|
| `assignment` | HumanAssignment | The resulting assignment; unset when it was revoked. |
| `assignment.agentId` | string (int64) |  |
| `assignment.humanId` | string (int64) |  |
| `assignment.channel` | string | Currently always "whatsapp". |
| `assignment.createdAt` | string | RFC3339, UTC. |

```bash
curl -X PUT "https://api.pingx.ai/voice/v1/human-assignments/AGENTID/HUMANID" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channel":"…"}'
```

## POST /voice/v1/human-calls

**PlaceHumanCall** · needs `voice:write`

PlaceHumanCall starts a bridged call between one of the organization's
humans (see ListHumans) and a customer: the human's phone is dialed first,
then the customer's, and both are joined on one line. No AI persona
speaks; the call is silently recorded, transcribed and scored. Returns
immediately with a dialId, same lifecycle and polling as PlaceCall. The
human must have a phone number. Not idempotent.

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `humanId` | string (int64) | The human to bridge in (from ListHumans). Required; must have a phone. |
| `phone` | string | Customer phone number to call, E.164. Required. |
| `name` | string | Optional customer display name (max 120 chars). |

**Response** `PlaceHumanCallResponse`

| Field | Type | Description |
|---|---|---|
| `dialId` | string (int64) | Handle for this dial attempt; see PlaceCallResponse.dialId. |
| `status` | string | Always "dialing" on success. |

```bash
curl -X POST "https://api.pingx.ai/voice/v1/human-calls" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"humanId":"…","phone":"…","name":"…"}'
```

## GET /voice/v1/humans

**ListHumans** · needs `voice:read` (or write)

ListHumans lists the directory of people the business can reach by phone
(bridged human calls) and/or WhatsApp (AI agent escalations), oldest first.

**Query parameters**

| Name | Type | Description |
|---|---|---|
| `pageSize` | integer | Max humans per page. Default 50, max 200. |
| `pageToken` | string | nextPageToken from the previous response; empty for the first page. |

**Response** `ListHumansResponse`

| Field | Type | Description |
|---|---|---|
| `humans` | Human[] |  |
| `humans[].humanId` | string (int64) |  |
| `humans[].name` | string |  |
| `humans[].phone` | string | Dialed for bridged human calls, E.164; may be empty. |
| `humans[].whatsappMobile` | string | Where AI agents notify this human on WhatsApp, E.164; may be empty. |
| `humans[].purpose` | string | Optional role tag (e.g. "technician", "billing") AI agents can look people up by. |
| `humans[].active` | boolean | Whether this human can currently be dialed or notified. |
| `humans[].createdAt` | string | RFC3339, UTC. |
| `nextPageToken` | string | Pass as pageToken for the next page; empty on the last page. |

```bash
curl "https://api.pingx.ai/voice/v1/humans" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## POST /voice/v1/humans

**AddHuman** · needs `voice:write`

AddHuman adds a person to the directory. At least one of phone or
whatsappMobile is required. ALREADY_EXISTS if the phone is already
registered.

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` | string | Required, max 60 chars. |
| `phone` | string | E.164; optional if whatsappMobile is set. |
| `whatsappMobile` | string | E.164; optional if phone is set. |
| `purpose` | string | Optional role tag, max 60 chars. |

**Response** `AddHumanResponse`

| Field | Type | Description |
|---|---|---|
| `human` | Human | A person in the directory. |
| `human.humanId` | string (int64) |  |
| `human.name` | string |  |
| `human.phone` | string | Dialed for bridged human calls, E.164; may be empty. |
| `human.whatsappMobile` | string | Where AI agents notify this human on WhatsApp, E.164; may be empty. |
| `human.purpose` | string | Optional role tag (e.g. "technician", "billing") AI agents can look people up by. |
| `human.active` | boolean | Whether this human can currently be dialed or notified. |
| `human.createdAt` | string | RFC3339, UTC. |

```bash
curl -X POST "https://api.pingx.ai/voice/v1/humans" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"…","phone":"…","whatsappMobile":"…","purpose":"…"}'
```

## DELETE /voice/v1/humans/{humanId}

**RemoveHuman** · needs `voice:write`

RemoveHuman deletes a human and their agent assignments. NOT_FOUND if
unknown or in another organization.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `humanId` | string (int64) |  |

**Response** `RemoveHumanResponse`

```bash
curl -X DELETE "https://api.pingx.ai/voice/v1/humans/HUMANID" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## PATCH /voice/v1/humans/{humanId}

**UpdateHuman** · needs `voice:write`

UpdateHuman replaces a human's name, phone, whatsappMobile and purpose
(full replace, not a merge: send every field you want to keep).

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `humanId` | string (int64) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `name` | string | Same rules as AddHumanRequest; all fields replace the stored values. |
| `phone` | string |  |
| `whatsappMobile` | string |  |
| `purpose` | string |  |

**Response** `UpdateHumanResponse`

| Field | Type | Description |
|---|---|---|
| `human` | Human | A person in the directory. |
| `human.humanId` | string (int64) |  |
| `human.name` | string |  |
| `human.phone` | string | Dialed for bridged human calls, E.164; may be empty. |
| `human.whatsappMobile` | string | Where AI agents notify this human on WhatsApp, E.164; may be empty. |
| `human.purpose` | string | Optional role tag (e.g. "technician", "billing") AI agents can look people up by. |
| `human.active` | boolean | Whether this human can currently be dialed or notified. |
| `human.createdAt` | string | RFC3339, UTC. |

```bash
curl -X PATCH "https://api.pingx.ai/voice/v1/humans/HUMANID" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"…","phone":"…","whatsappMobile":"…","purpose":"…"}'
```

## GET /voice/v1/numbers

**ListNumbers** · needs `voice:read` (or write)

ListNumbers lists the organization's voice phone numbers (the numbers
calls are placed from and received on), default number first. WhatsApp
numbers are managed by the WhatsApp API, not here.

**Query parameters**

| Name | Type | Description |
|---|---|---|
| `pageSize` | integer | Max numbers per page. Default 50, max 200. |
| `pageToken` | string | nextPageToken from the previous response; empty for the first page. |

**Response** `pingxVoiceV1ListNumbersResponse`

| Field | Type | Description |
|---|---|---|
| `numbers` | VoiceNumber[] |  |
| `numbers[].numberId` | string (int64) | Id used by RemoveNumber, SetDefaultNumber and SetInboundAgent. |
| `numbers[].number` | string | The number, E.164. |
| `numbers[].label` | string | Optional human label (max 60 chars). |
| `numbers[].isDefault` | boolean | True for the number outbound calls use by default. |
| `numbers[].inboundAgentId` | string (int64) | AI agent answering inbound calls to this number; 0 = none (calls refused). |
| `numbers[].inboundAgentName` | string | Name of that agent; empty when unbound. |
| `numbers[].syncError` | string | Empty when the number is registered on the telephony trunk and dialable; otherwise why not (the number is refused for calls until fixed). |
| `numbers[].createdAt` | string | When it was registered (RFC3339, UTC). |
| `nextPageToken` | string | Pass as pageToken for the next page; empty on the last page. |

```bash
curl "https://api.pingx.ai/voice/v1/numbers" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## POST /voice/v1/numbers

**AddNumber** · needs `voice:write`

AddNumber registers a phone number the organization owns on Pingx
Telephony so it can place and receive calls. The first number becomes the
default automatically. If registering it on the telephony trunk fails the
number is still saved and the returned syncError says why it is not yet
dialable (registration is retried automatically). ALREADY_EXISTS if the
number is already registered.

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `number` | string | E.164 number to register. Required. |
| `label` | string | Optional label (max 60 chars). |
| `makeDefault` | boolean | Force this number to become the default even if others exist. |

**Response** `AddNumberResponse`

| Field | Type | Description |
|---|---|---|
| `number` | VoiceNumber | A voice phone number registered by the organization. |
| `number.numberId` | string (int64) | Id used by RemoveNumber, SetDefaultNumber and SetInboundAgent. |
| `number.number` | string | The number, E.164. |
| `number.label` | string | Optional human label (max 60 chars). |
| `number.isDefault` | boolean | True for the number outbound calls use by default. |
| `number.inboundAgentId` | string (int64) | AI agent answering inbound calls to this number; 0 = none (calls refused). |
| `number.inboundAgentName` | string | Name of that agent; empty when unbound. |
| `number.syncError` | string | Empty when the number is registered on the telephony trunk and dialable; otherwise why not (the number is refused for calls until fixed). |
| `number.createdAt` | string | When it was registered (RFC3339, UTC). |

```bash
curl -X POST "https://api.pingx.ai/voice/v1/numbers" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"number":"…","label":"…","makeDefault":false}'
```

## DELETE /voice/v1/numbers/{numberId}

**RemoveNumber** · needs `voice:write`

RemoveNumber unregisters a voice number and removes it from the telephony
trunk; inbound calls to it stop being answered. NOT_FOUND when the number
is unknown (including already removed) or belongs to another organization.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `numberId` | string (int64) |  |

**Response** `RemoveNumberResponse`

```bash
curl -X DELETE "https://api.pingx.ai/voice/v1/numbers/NUMBERID" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## POST /voice/v1/numbers/{numberId}:setDefault

**SetDefaultNumber** · needs `voice:write`

SetDefaultNumber makes a number the one outbound calls are placed from by
default. Idempotent.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `numberId` | string (int64) |  |

**Response** `SetDefaultNumberResponse`

```bash
curl -X POST "https://api.pingx.ai/voice/v1/numbers/NUMBERID:setDefault" \
  -H "Authorization: Bearer $PINGX_API_KEY"
```

## POST /voice/v1/numbers/{numberId}:setInboundAgent

**SetInboundAgent** · needs `voice:write`

SetInboundAgent chooses which AI agent answers cold inbound calls to a
number. agentId = 0 clears the binding, after which the number refuses
inbound calls (there is no fallback agent). Idempotent.

**Path parameters**

| Name | Type | Description |
|---|---|---|
| `numberId` | string (int64) |  |

**Request body** (JSON)

| Field | Type | Description |
|---|---|---|
| `agentId` | string (int64) | AI agent to answer inbound calls; 0 clears the binding. Must belong to the organization. |

**Response** `SetInboundAgentResponse`

| Field | Type | Description |
|---|---|---|
| `number` | VoiceNumber | A voice phone number registered by the organization. |
| `number.numberId` | string (int64) | Id used by RemoveNumber, SetDefaultNumber and SetInboundAgent. |
| `number.number` | string | The number, E.164. |
| `number.label` | string | Optional human label (max 60 chars). |
| `number.isDefault` | boolean | True for the number outbound calls use by default. |
| `number.inboundAgentId` | string (int64) | AI agent answering inbound calls to this number; 0 = none (calls refused). |
| `number.inboundAgentName` | string | Name of that agent; empty when unbound. |
| `number.syncError` | string | Empty when the number is registered on the telephony trunk and dialable; otherwise why not (the number is refused for calls until fixed). |
| `number.createdAt` | string | When it was registered (RFC3339, UTC). |

```bash
curl -X POST "https://api.pingx.ai/voice/v1/numbers/NUMBERID:setInboundAgent" \
  -H "Authorization: Bearer $PINGX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"agentId":"…"}'
```


