# Voice | Signal House API Docs

> Signal House Voice: programmable calling, WebRTC softphones, SIP trunks and call analytics, served by the dedicated Voice service.

Source: https://docs.signalhouse.io/voice

---

## Voice

# Voice

The Voice platform adds programmable calling, in-browser WebRTC softphones, SIP trunking, and call analytics to your account. Every Voice endpoint is served under the `/voice` base path and authenticates with the same bearer token as the rest of the API.

There are two ways to use Voice:

- **Browser calling (WebRTC)** — register a softphone in the browser with `@signalhouse-sms/sdk/voice-browser` and place or receive calls directly from your web app. Start with the Quickstart below.
- **Server-side programmable voice** — originate and control calls over REST with `voice.calls`, and pull history and analytics with `voice.callLogs` and `voice.analytics`.

**A dedicated service:** the Voice platform is served by a separate Voice service, not the core REST API. Every route is prefixed with `/voice` (e.g. `https://v2.signalhouse.io/voice/sip-trunks`) and reached in the SDK through the `voice` namespace and its sub-resources — for example `signalHouse.voice.sipTrunks.list()`. Because it is a distinct service, it follows its own conventions: partial updates use the `PATCH` method, and paths may include a `/v1` or `/api/v1` segment as shown per endpoint below.

## AI One-Shot Integration Prompts

Select your AI coding tool to get a copy-paste Voice integration prompt. Since Voice supports two very different integration shapes — a browser/mobile WebRTC softphone, or server-side programmable calling — the prompt has your AI tool ask you which one you need before it writes any code.

Prefer a copy-paste SDK walkthrough? The [Voice Quickstart](https://docs.signalhouse.io/voice-quickstart) covers this same flow (install → token → softphone → calls) in the SDK docs.

## Quickstart: place a call from the browser

Go from zero to a two-way browser call in five steps. Credentials are minted on your server so your API token is never exposed to the client.

#### 1\. Install the SDK

Install

```
npm install @signalhouse-sms/sdk jssip
```

`jssip` is an optional peer dependency required only by the browser softphone; server-only code does not need it.

#### 2\. Mint a voice token (on your server)

A token carries short-lived SIP credentials. Mint it server-side and return the response to the browser. To receive inbound calls, include `subgroupId` — the subgroup that owns the numbers that should ring this softphone. Omit it only for outbound-only clients.

Node (server)

```
import { SignalHouseSDK } from "@signalhouse-sms/sdk";

const signalHouse = new SignalHouseSDK({
  apiKey: process.env.SH_TOKEN,
  baseUrl: "https://v2.signalhouse.io",
});

const { data } = await signalHouse.voice.tokens.create({
  // subgroupId is REQUIRED for inbound routing; omit only for outbound-only softphones
  tokenData: { identity: "alice", ttl: 1800, subgroupId: "S1A2B3C4" },
});
// Return data to the browser:
// { token, identity, expires_at, sip_credentials: { username, password, domain, wss_url } }
```

#### 3\. Register the softphone (in the browser)

Browser

```
import { Device } from "@signalhouse-sms/sdk/voice-browser";

const device = new Device(tokenResponse); // pass the whole mint response
device.on("registered", () => console.log("ready to call"));
device.on("registrationFailed", (e) => console.error("register failed:", e.cause));
await device.register();
```

#### 4\. Place an outbound call

Browser

```
const call = await device.connect({ to: "+15551234567", from: "+19153374770" });

call.on("progress", () => console.log("ringing"));
call.on("accepted", () => console.log("answered"));
call.on("ended", ({ cause }) => console.log("ended:", cause));
// Remote audio is auto-attached to a hidden <audio> element.
```

#### 5\. In-call controls

Browser

```
call.mute();                    // mute the mic (media-layer, not SIP hold)
call.unmute();
call.hold();                    // re-INVITE sendonly
call.unhold();
call.sendDigits("1");           // send DTMF
call.transfer("+15559876543");  // blind transfer (SIP REFER)
call.hangup();
```

#### Receiving inbound calls

Browser

```
device.on("incoming", (call) => {
  console.log("incoming from", call.from);
  call.accept();  // or: call.reject({ statusCode: 486, reason: "Busy Here" })
});
```

**About identities & credentials:** the `identity` in the token response is a server-generated SIP username. The `identity` you *pass* to `tokens.create` is your logical name (stored as `requested_identity`) that a server-side call can ring via `voice.calls.create({ to_identity })`. Each mint returns fresh, one-time credentials — treat `sip_credentials.password` as a secret and re-mint before `expires_at`.

## Quickstart: place a call from your server

Originate a call over REST and read its outcome from the call logs. This is the programmable-voice surface, with Twilio-compatible request and response shapes.

Node (server)

```
// Originate an outbound call
const { data } = await signalHouse.voice.calls.create({
  callData: { to: "+15551234567", from: "+19153374770", recording_enabled: true },
});
console.log(data.call_id, data.status);

// Later, read the outcome
const log = await signalHouse.voice.callLogs.get({ id: data.call_id });
```

## Programmable Call Control (SHML)

Drive a call from your own web app. Point a number (or an outbound call) at an HTTPS URL you host; when the call is answered, Signal House `POST`s the call details to that URL and executes the markup you return — speaking text, collecting digits, recording, bridging, or forwarding. The markup is **SHML** (Signal House Markup Language), an XML dialect whose element and request shapes mirror Twilio’s TwiML / TeXML so an existing app can move over by swapping the SDK and pointing its number here.

**Two entry points, one markup:** the same SHML contract drives both directions. **Inbound** — create a Programmable Voice Profile with `routeAction: "CALL_CONTROL"`and a `webhookUrl`, then assign your numbers to it; every call to those numbers is controlled by your app. **Outbound** — pass `answer_url` to `voice.calls.create`and your app takes over the moment the callee answers.

#### 1\. Point inbound numbers at your app

Programmable call control is a Programmable Voice Profile routing action, exactly like FORWARD or SIP\_TRUNK. Create a profile with `routeAction: "CALL_CONTROL"` and your SHML `webhookUrl`, then assign one or more of your numbers to it. You can also do this from the portal (Voice → Programmable Voice Profiles).

Node (server)

```
// 1. Create a CALL_CONTROL profile pointed at your SHML webhook
const { data: created } = await signalHouse.voice.programmableVoiceProfiles.create({
  profileData: {
    name: "My call app",
    subgroupIds: ["S1A2B3C4"],
    routeAction: "CALL_CONTROL",
    webhookUrl: "https://example.com/voice/inbound",
  },
});

// 2. Assign a number you own to the profile
await signalHouse.voice.programmableVoiceProfiles.assignNumber({
  id: created.profile.id,
  e164: "+19153374770",
});
```

**Precedence & isolation:** a profile action applies to its assigned numbers over per-subgroup routing. The webhook lives entirely in your voice configuration — it is separate from a number’s *messaging* (inbound SMS/MMS) webhook and never affects it. To stop programmable control, switch the profile to another action or unassign the number.

#### 2\. Control an outbound call

Originate a call and take control when it connects. On answer, Signal House fetches `answer_url` and runs the returned SHML against the answered leg.

Node (server)

```
const { data } = await signalHouse.voice.calls.create({
  callData: {
    to: "+15551234567",
    from: "+19153374770",          // a number you own
    answer_url: "https://example.com/voice/outbound",
    answer_method: "POST",         // GET or POST; defaults to POST
  },
});
```

#### The webhook request

Your URL receives an HTTP `POST` (or `GET`, if you chose it) with `Content-Type: application/x-www-form-urlencoded`. The fields below are Twilio-compatible. Fields that need a lookup we don’t perform yet (CNAM, geo) are always present but sent as empty strings, matching Twilio’s behavior when those lookups are disabled.

| Field | Description |
| --- | --- |
| `CallSid` | Unique ID for this call. Stable across every request in the call's control chain. |
| `AccountSid` | The account that owns the call. |
| `From / Caller` | Caller's number in E.164. (Caller is an alias of From.) |
| `To / Called` | The dialed number in E.164. (Called is an alias of To.) |
| `Direction` | inbound, outbound-api, or outbound-dial. |
| `CallStatus` | queued, ringing, in-progress, completed, busy, failed, no-answer, or canceled. |
| `ApiVersion` | Contract version — 2010-04-01 (Twilio-compatible). |
| `CallerName` | CNAM display name when available, else empty. |
| `ForwardedFrom` | Original number for a forwarded call, when available, else empty. |
| `From{City,State,Zip,Country} / To{…}` | Geo of the endpoints when available, else empty. |
| `ApplicationSid` | Reserved; empty unless an application is associated. |

Follow-up requests (a verb’s `action` URL, or `<Redirect>`) carry the same base fields plus the result of the verb that triggered them: `Digits` and `FinishedOnKey` after`<Gather>`; `DialCallStatus` and `DialCallDuration` after `<Dial>`; and `RecordingUrl`, `RecordingSid`, `RecordingDuration`, and `Digits` after`<Record>`.

#### The SHML response

Respond with `Content-Type: text/xml` (or `application/xml`) and a single `<Response>` root. Signal House runs the child verbs top to bottom, in order. When the document ends without redirecting, the call is hung up.

SHML response

```
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say voice="alice">Thanks for calling. Please hold.</Say>
  <Pause length="1"/>
  <Play>https://example.com/audio/hold.mp3</Play>
</Response>
```

#### Verb reference

| Verb | Purpose | Key attributes |
| --- | --- | --- |
| `<Say>` | Speak text to the caller (TTS). Text content is the words to speak. | `voice, language, loop` |
| `<Play>` | Play an audio asset. Text content is an http(s) URL to an audio file (mp3, wav, ogg or aiff; up to 10 MB, played up to 10 minutes) or an Asterisk-native URI (sound:, tone:, digits:, number:, characters:). A file that can't be fetched or played is skipped and the call continues. loop="0" repeats until the caller hangs up. | `loop, digits` |
| `<Pause>` | Wait silently before the next verb. | `length (seconds, default 1)` |
| `<Gather>` | Collect DTMF from the caller. Nest <Say>/<Play>/<Pause> as the prompt. On input (or timeout) POSTs to action. | `input="dtmf", numDigits, timeout, finishOnKey, action, method` |
| `<Record>` | Record the caller's speech; POSTs the recording URL to action when finished. | `action, method, maxLength, timeout, finishOnKey, playBeep, format, recordingStatusCallback` |
| `<Dial>` | Bridge the call to another leg. Target as text content or a nested <Number>. On completion POSTs to action. | `timeout, callerId, action, method, hangupOnStar` |
| `<Redirect>` | Fetch and run SHML from another URL (text content). Transfers control to the next document. | `method` |
| `<Reject>` | Reject the call before answering. | `reason ("busy" | "rejected")` |
| `<Hangup>` | End the call immediately. | `—` |

**Audio note:** `<Play>` supports Asterisk-native URI schemes today (`sound:`, `tone:`, `digits:`…). For spoken prompts prefer `<Say>`.

#### Control flow & failover

`<Gather>`, `<Record>`, and `<Dial>` continue the call by requesting their `action` URL with the result fields above, and `<Redirect>` jumps to a new document — so you build multi-step flows (menus, sub-menus, voicemail) by chaining requests. If a request times out or returns a `5xx`, Signal House retries; if it still fails, it falls back to a safe “technical difficulties” message and hangs up. A `4xx` is treated as your app deliberately declining the call: no retry, straight to the safe fallback.

Every URL Signal House requests, your answer URL and each `action` URL, must be a public `http` or `https` address. A URL that names an internal host, or resolves to a private, loopback or link-local address, is never requested: the call goes straight to the safe fallback. Each request may follow up to 3 redirects, must finish (body included) within its timeout, and may return up to 256 KB of SHML.

#### Request signing

When signing is enabled for your account, each request carries an `X-Twilio-Signature`header computed with Twilio’s algorithm over the request URL and sorted parameters, so existing Twilio signature verifiers work unchanged. Always serve your webhook over HTTPS.

#### Worked example: a phone menu

Greet the caller, collect one digit, and branch. The `<Gather>` posts `Digits`to `/voice/menu`, which returns the next document.

First response

```
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Gather numDigits="1" timeout="8" action="https://example.com/voice/menu" method="POST">
    <Say>For sales, press 1. For support, press 2.</Say>
  </Gather>
  <!-- Fallthrough if the caller pressed nothing -->
  <Say>We didn't get your selection. Goodbye.</Say>
  <Hangup/>
</Response>
```

POST /voice/menu (Digits=1) → next response

```
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Connecting you to sales.</Say>
  <Dial callerId="+19153374770" timeout="30">
    <Number>+15551234567</Number>
  </Dial>
</Response>
```

### API Reference

#### WebRTC Tokens

### POST /voice/tokens

Mint an ephemeral voice token and one-time SIP credentials for the browser softphone (Device). All fields are optional. The returned identity is a server-generated SIP username; the identity you pass is stored as requested\_identity so a server-side call can ring this endpoint via to\_identity. The password is returned once only.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `identity` | String | Optional | Logical name for this softphone (1-255 chars). Stored as requested\_identity for inbound routing. |
| `ttl` | Number | Optional | Token lifetime in seconds (min 60). Server-clamped to the account maximum. |
| `subgroupId` | String | Optional | Subgroup (1-64 chars) whose phone numbers should ring this softphone. REQUIRED to receive inbound calls — inbound DIDs fork only to live tokens carrying that DID's subgroupId. Optional for outbound-only softphones; a token minted without it registers and dials out fine but never receives inbound calls. |
| `grants` | Object | Optional | Optional voice grants, e.g. { voice: { incoming: { allow }, outgoing: { allowedNumbers } } }. |

#### Example Request

Request

```json
{
  "identity": "alice",
  "ttl": 1800,
  "subgroupId": "S1A2B3C4"
}
```

#### Example Response 201

Response

```json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "identity": "wrtc_9f3c1a2b",
  "expires_at": "2026-07-28T18:30:00.000Z",
  "sip_credentials": {
    "username": "wrtc_9f3c1a2b",
    "password": "s3cr3t-one-time-password",
    "domain": "sip.signalhouse.io",
    "wss_url": "wss://sip.signalhouse.io:7443"
  }
}
```

### POST /voice/tokens/refresh

Refresh (extend) an existing voice token in place — identity-preserving. Keeps the same identity + SIP credentials and only pushes out expires\_at, so a long-lived softphone stays registered without re-establishing its SIP registration (mirrors Twilio's Device.updateToken). Identify the session with the current token (its identity is decoded) or the identity directly. Returns 404 if no matching token exists for the account — mint a new one via POST /voice/tokens instead.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | String | Optional | The current voice token (JWT); its grants.identity is extended. Provide this or identity. |
| `identity` | String | Optional | The wrtc\_ identity to extend, if held directly (from the mint/refresh response). Provide this or token. |
| `ttl` | Number | Optional | New token lifetime in seconds (min 60). Server-clamped to the account maximum. |

#### Example Request

Request

```json
{
  "identity": "wrtc_9f3c1a2b"
}
```

#### Example Response 200

Response

```json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "identity": "wrtc_9f3c1a2b",
  "expires_at": "2026-07-28T19:00:00.000Z",
  "sip_credentials": {
    "username": "wrtc_9f3c1a2b",
    "password": "s3cr3t-one-time-password",
    "domain": "sip.signalhouse.io",
    "wss_url": "wss://sip.signalhouse.io:7443"
  }
}
```

#### Calls

### POST /voice/v1/calls

Originate an outbound call. Provide to and from (an owned E.164 number). Omit trunk/profile/identity for a single-leg call, pass sip\_trunk\_id to route down a trunk, or pass sip\_profile\_id or to\_identity to bridge to a SIP endpoint or a browser-registered identity.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `to` | String | Required | Destination number (E.164) or SIP target. |
| `from` | String | Required | Caller ID — must be an E.164 number you own. |
| `sip_trunk_id` | String | Optional | Route the call down this SIP trunk (UUID). |
| `sip_profile_id` | String | Optional | Bridge to this SIP profile (UUID). Mutually exclusive with to\_identity. |
| `to_identity` | String | Optional | Ring a browser-registered WebRTC identity (the logical name from tokens.create). |
| `answer_url` | String | Optional | Programmable call control: on answer, the call is handed to your webhook, which returns SHML to control it. See Programmable Call Control (SHML) above. Must be a public http(s) address: a URL naming an internal or private host is refused with a 400. |
| `answer_method` | String | Optional | HTTP method used to fetch answer\_url — GET or POST. Defaults to POST. |
| `recording_enabled` | Boolean | Optional | Record the call. Defaults to false. |
| `transcription_enabled` | Boolean | Optional | Transcribe the recording. Defaults to false. |
| `status_callback` | String | Optional | URL to receive call status webhooks. Must be a public http(s) address: a URL naming an internal or private host is refused with a 400. |
| `metadata` | Object | Optional | Arbitrary key/value data echoed back on the call log. |

#### Example Request

Request

```json
{
  "to": "+15551234567",
  "from": "+19153374770",
  "recording_enabled": true
}
```

#### Example Response 201

Response

```json
{
  "call_id": "8c1f2e34-9a0b-4c1d-8e2f-1a2b3c4d5e6f",
  "status": "QUEUED",
  "direction": "OUTBOUND",
  "from": "+19153374770",
  "to": "+15551234567",
  "created_at": "2026-07-28T18:30:00.000Z"
}
```

### GET /voice/v1/calls

List calls with pagination and filtering. This is a Twilio-compatible view of the call history.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | Query Param | Optional | Page number (default 1). |
| `limit` | Query Param | Optional | Results per page (1-100, default 20). |
| `status` | Query Param | Optional | Filter by call status (e.g. QUEUED, COMPLETED, FAILED). |
| `direction` | Query Param | Optional | INBOUND or OUTBOUND. |
| `from` | Query Param | Optional | Filter by originating number. |
| `to` | Query Param | Optional | Filter by destination number. |
| `from_date` | Query Param | Optional | ISO date-time lower bound. |
| `to_date` | Query Param | Optional | ISO date-time upper bound. |

#### Example Response 200

Response

```json
{
  "data": [
    {
      "call_id": "8c1f2e34-9a0b-4c1d-8e2f-1a2b3c4d5e6f",
      "status": "COMPLETED",
      "direction": "OUTBOUND",
      "from": "+19153374770",
      "to": "+15551234567",
      "type": "SIP_TRUNK",
      "started_at": "2026-07-28T18:30:01.000Z",
      "answered_at": "2026-07-28T18:30:06.000Z",
      "ended_at": "2026-07-28T18:31:12.000Z",
      "duration_seconds": 66,
      "recording_available": true
    }
  ],
  "page": 1,
  "limit": 20,
  "total": 1
}
```

### GET /voice/v1/calls/:call_id

Retrieve a single call by its call\_id.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `call_id` | URL Param | Required | The call identifier. |

#### Example Response 200

Response

```json
{
  "call_id": "8c1f2e34-9a0b-4c1d-8e2f-1a2b3c4d5e6f",
  "status": "COMPLETED",
  "direction": "OUTBOUND",
  "from": "+19153374770",
  "to": "+15551234567",
  "started_at": "2026-07-28T18:30:01.000Z",
  "answered_at": "2026-07-28T18:30:06.000Z",
  "ended_at": "2026-07-28T18:31:12.000Z",
  "duration_seconds": 66,
  "hangup_cause": "NORMAL",
  "recording_enabled": true,
  "transcription_enabled": false,
  "metadata": {}
}
```

### POST /voice/v1/calls/:call_id/hangup

Hang up an in-progress call.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `call_id` | URL Param | Required | The call identifier. |
| `reason` | String | Optional | Hangup reason: NORMAL, BUSY, NO\_ANSWER, or REJECTED. |

#### Example Request

Request

```json
{
  "reason": "NORMAL"
}
```

#### Example Response 200

Response

```json
{
  "call_id": "8c1f2e34-9a0b-4c1d-8e2f-1a2b3c4d5e6f",
  "status": "COMPLETED",
  "message": "Call hangup requested"
}
```

#### Call Logs

### GET /voice/api/v1/call-logs

List call history with rich filtering — by direction, status, call source, sentiment, subgroup, carrier, recording presence, voicemail, free-text query, and date range.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | Query Param | Optional | Page number (default 1). |
| `limit` | Query Param | Optional | Results per page (1-1000, default 20). |
| `direction` | Query Param | Optional | CSV of INBOUND, OUTBOUND, INTERNAL. |
| `status` | Query Param | Optional | Filter by call status. |
| `callSource` | Query Param | Optional | CSV of SIP\_TRUNK, PROGRAMMABLE\_VOICE, AI\_VOICE, WEBRTC, VOICEMAIL, CONFERENCE, PSTN. |
| `sentiment` | Query Param | Optional | positive, negative, or neutral. |
| `subgroupId` | Query Param | Optional | Filter by subgroup. |
| `carrier` | Query Param | Optional | Exact carrier match. |
| `from` | Query Param | Optional | Filter by originating number. |
| `to` | Query Param | Optional | Filter by destination number. |
| `voicemail` | Query Param | Optional | Only voicemail calls when true. |
| `hasRecording` | Query Param | Optional | Only calls with a recording when true. |
| `q` | Query Param | Optional | Free-text search. |
| `dateFrom` | Query Param | Optional | ISO date-time lower bound. |
| `dateTo` | Query Param | Optional | ISO date-time upper bound. |
| `sort` | Query Param | Optional | Sort field (default startedAt). |
| `order` | Query Param | Optional | asc or desc (default desc). |

#### Example Response 200

Response

```json
{
  "success": true,
  "data": [
    {
      "id": "b1a2c3d4-...",
      "callId": "8c1f2e34-...",
      "direction": "OUTBOUND",
      "from": "+19153374770",
      "to": "+15551234567",
      "status": "COMPLETED",
      "duration": 66,
      "startTime": "2026-07-28T18:30:01.000Z",
      "endTime": "2026-07-28T18:31:12.000Z",
      "cost": 1980,
      "callSource": "SIP_TRUNK",
      "carrier": "AT&T",
      "sentiment": "positive",
      "callRecordingUrl": null
    }
  ],
  "meta": {
    "total": 1,
    "page": 1,
    "limit": 20,
    "totalPages": 1
  }
}
```

### GET /voice/api/v1/call-logs/:id

Retrieve a single call log by its UUID or external callId.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call log UUID or callId. |

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "id": "b1a2c3d4-...",
    "callId": "8c1f2e34-...",
    "direction": "OUTBOUND",
    "from": "+19153374770",
    "to": "+15551234567",
    "status": "COMPLETED",
    "duration": 66,
    "cost": 1980,
    "callSource": "SIP_TRUNK",
    "sentiment": "positive",
    "callRecordingUrl": null,
    "createdAt": "2026-07-28T18:31:12.000Z"
  }
}
```

### GET /voice/api/v1/call-logs/:id/recording

Return a short-TTL presigned URL to play back a call recording.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call log UUID or callId. |

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "callId": "8c1f2e34-...",
    "url": "https://recordings.signalhouse.io/...signed",
    "expiresIn": 300
  }
}
```

### PATCH /voice/api/v1/call-logs/:id/voicemail-read

Mark a voicemail as read or unread.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call log UUID or callId. |
| `read` | Boolean | Optional | Read state to set. Defaults to true. |

#### Example Request

Request

```json
{
  "read": true
}
```

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "id": "b1a2c3d4-...",
    "voicemailReadAt": "2026-07-28T18:40:00.000Z"
  }
}
```

#### Analytics

### GET /voice/stats/voice-analytics

Aggregated voice analytics — per-direction summary tiles plus breakdowns by date, number, carrier, and channel. Summary tiles honor all filters except direction; breakdowns honor all filters.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `dateFrom` | Query Param | Optional | ISO date-time lower bound. |
| `dateTo` | Query Param | Optional | ISO date-time upper bound. |
| `groupBy` | Query Param | Optional | day, week, or month (default day). |
| `direction` | Query Param | Optional | INBOUND or OUTBOUND. |
| `callSource` | Query Param | Optional | CSV of call sources. |
| `subgroupId` | Query Param | Optional | Filter by subgroup. |
| `number` | Query Param | Optional | Substring match against from/to E.164. |
| `carrier` | Query Param | Optional | Filter by carrier. |

#### Example Response 200

Response

```json
{
  "success": true,
  "range": {
    "dateFrom": "2026-07-01T00:00:00.000Z",
    "dateTo": "2026-07-28T00:00:00.000Z",
    "days": 27
  },
  "outbound": {
    "totalCalls": 1240,
    "successfulCalls": 1102,
    "successRate": 88.9,
    "avgCallDurationSeconds": 74,
    "totalCallMinutes": 1528,
    "answerRate": 71.2,
    "failedCalls": 138,
    "sentimentScore": 0.42,
    "sentimentLabel": "positive"
  },
  "inbound": {
    "totalCalls": 860,
    "successfulCalls": 774,
    "successRate": 90,
    "avgCallDurationSeconds": 96,
    "totalCallMinutes": 1376,
    "answerRate": 82.5,
    "failedCalls": 86,
    "sentimentScore": 0.51,
    "sentimentLabel": "positive"
  },
  "byDate": [
    {
      "key": "2026-07-01",
      "total": 78,
      "completed": 70,
      "failed": 8,
      "totalDurationSeconds": 5820
    }
  ],
  "byNumber": [
    {
      "key": "+19153374770",
      "total": 420,
      "completed": 380,
      "failed": 40
    }
  ],
  "byCarrier": [
    {
      "key": "AT&T",
      "total": 610,
      "completed": 560,
      "failed": 50
    }
  ],
  "byChannel": [
    {
      "key": "SIP_TRUNK",
      "total": 1500,
      "completed": 1360,
      "failed": 140
    }
  ]
}
```

#### SIP Trunks

### GET /voice/sip-trunks

List all SIP trunks on the account.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "sipTrunks": [
    {
      "id": "0a1b2c3d-...",
      "name": "Primary Trunk",
      "region": "us-east-1",
      "connectionType": "IP_AUTH",
      "transport": "tcp",
      "isActive": true,
      "sipDomain": "trunk.signalhouse.io",
      "allowedIps": [
        "203.0.113.10"
      ],
      "e911Enabled": false,
      "phoneNumbers": [
        {
          "id": "n1",
          "number": "+19153374770"
        }
      ],
      "createdAt": "2026-07-20T12:00:00.000Z"
    }
  ]
}
```

### GET /voice/sip-trunks/pops

List available SIP points of presence (regions, domains, and ports) for trunk configuration.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "sipPops": [
    {
      "id": "pop-use1",
      "popCode": "us-east-1",
      "name": "US East (Virginia)",
      "sipDomain": "use1.trunk.signalhouse.io",
      "udpPort": 5060,
      "tcpPort": 5060,
      "tlsPort": 5061
    }
  ]
}
```

### GET /voice/sip-trunks/:id

Retrieve a single SIP trunk by ID.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |

#### Example Response 200

Response

```json
{
  "sipTrunk": {
    "id": "0a1b2c3d-...",
    "name": "Primary Trunk",
    "region": "us-east-1",
    "connectionType": "IP_AUTH",
    "transport": "tcp",
    "isActive": true,
    "sipDomain": "trunk.signalhouse.io",
    "destinationHosts": [
      {
        "host": "203.0.113.20",
        "port": "5060"
      }
    ],
    "sourceHosts": [
      {
        "host": "203.0.113.10"
      }
    ],
    "phoneNumbers": [],
    "createdAt": "2026-07-20T12:00:00.000Z"
  }
}
```

### POST /voice/sip-trunks

Create a SIP trunk. connectionType IP\_AUTH authorizes by source IP; REGISTRATION returns generated username/password credentials.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | String | Required | Trunk name (1-255 chars). |
| `region` | String | Required | SIP POP region code (see /voice/sip-trunks/pops). |
| `connectionType` | String | Required | IP\_AUTH or REGISTRATION. |
| `transport` | String | Optional | tcp, udp, or tls (default tcp). |
| `allowedIps` | Array\[String\] | Optional | Source IPs allowed to send (IP\_AUTH). |
| `destinationHosts` | Array\[Object\] | Optional | Where outbound calls are delivered: { host, port }. |
| `sourceHosts` | Array\[Object\] | Optional | Trusted inbound source hosts: { host }. |
| `maxSpendPerMinute` | Number | Optional | Per-minute spend cap. |
| `allowedRegions` | Array\[String\] | Optional | Permitted destination regions. |
| `e911Enabled` | Boolean | Optional | Enable E911 (default false). |

#### Example Request

Request

```json
{
  "name": "Primary Trunk",
  "region": "us-east-1",
  "connectionType": "IP_AUTH",
  "transport": "tcp",
  "allowedIps": [
    "203.0.113.10"
  ],
  "destinationHosts": [
    {
      "host": "203.0.113.20",
      "port": "5060"
    }
  ]
}
```

#### Example Response 201

Response

```json
{
  "sipTrunk": {
    "id": "0a1b2c3d-...",
    "name": "Primary Trunk",
    "region": "us-east-1",
    "connectionType": "IP_AUTH",
    "isActive": true,
    "sipDomain": "trunk.signalhouse.io",
    "createdAt": "2026-07-28T18:30:00.000Z"
  }
}
```

### PATCH /voice/sip-trunks/:id

Update a SIP trunk. All fields are optional; only supplied fields are changed.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |
| `name` | String | Optional | New trunk name. |
| `transport` | String | Optional | tcp, udp, or tls. |
| `allowedIps` | Array\[String\] | Optional | Replacement source IP allowlist. |
| `destinationHosts` | Array\[Object\] | Optional | Replacement destination hosts. |
| `maxSpendPerMinute` | Number | Optional | Per-minute spend cap. |
| `e911Enabled` | Boolean | Optional | Enable or disable E911. |

#### Example Request

Request

```json
{
  "name": "Primary Trunk (US East)",
  "maxSpendPerMinute": 5
}
```

#### Example Response 200

Response

```json
{
  "sipTrunk": {
    "id": "0a1b2c3d-...",
    "name": "Primary Trunk (US East)",
    "maxSpendPerMinute": 5
  }
}
```

### POST /voice/sip-trunks/:id/toggle-active

Enable or disable a SIP trunk.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |

#### Example Response 200

Response

```json
{
  "sipTrunk": {
    "id": "0a1b2c3d-...",
    "isActive": false
  }
}
```

### POST /voice/sip-trunks/:id/regenerate-password

Rotate the SIP registration password for a REGISTRATION trunk. The new password is returned once.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |

#### Example Response 200

Response

```json
{
  "password": "new-one-time-trunk-password"
}
```

### POST /voice/sip-trunks/:id/assign-numbers

Route one or more owned E.164 numbers down this trunk. Numbers that cannot be assigned are returned in skipped.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |
| `phoneNumbers` | Array\[String\] | Required | E.164 numbers to assign. |

#### Example Request

Request

```json
{
  "phoneNumbers": [
    "+19153374770",
    "+15551234567"
  ]
}
```

#### Example Response 200

Response

```json
{
  "assigned": [
    "+19153374770"
  ],
  "skipped": [
    {
      "e164": "+15551234567",
      "reason": "not owned"
    }
  ]
}
```

### POST /voice/sip-trunks/:id/unassign-numbers

Detach numbers from this trunk.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |
| `phoneNumbers` | Array\[String\] | Required | E.164 numbers to unassign. |

#### Example Request

Request

```json
{
  "phoneNumbers": [
    "+19153374770"
  ]
}
```

#### Example Response 200

Response

```json
{
  "unassigned": [
    "+19153374770"
  ]
}
```

### DELETE /voice/sip-trunks/:id

Delete a SIP trunk.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP trunk UUID. |

#### Example Response 200

Response

```json
{
  "success": true,
  "message": "SIP trunk deleted"
}
```

#### SIP Profiles

### GET /voice/sip-profiles

List all SIP profiles (device credentials for registering a softphone or PBX endpoint).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "sipProfiles": [
    {
      "id": "p1a2b3c4-...",
      "name": "Front Desk",
      "username": "sip_frontdesk",
      "sipDomain": "sip.signalhouse.io",
      "sipPort": 5061,
      "transport": "TLS",
      "status": "active",
      "recordingAllowed": true,
      "phoneNumbers": [
        {
          "id": "n1",
          "number": "+19153374770",
          "status": "assigned"
        }
      ]
    }
  ]
}
```

### GET /voice/sip-profiles/transports

List valid transports and their address/port per region.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "transports": [
    {
      "transport": "TLS",
      "address": "sip.signalhouse.io",
      "port": 5061
    },
    {
      "transport": "UDP",
      "address": "sip.signalhouse.io",
      "port": 5060
    }
  ]
}
```

### GET /voice/sip-profiles/:id

Retrieve a single SIP profile. The password is not included — use the password endpoint.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP profile UUID. |

#### Example Response 200

Response

```json
{
  "sipProfile": {
    "id": "p1a2b3c4-...",
    "name": "Front Desk",
    "username": "sip_frontdesk",
    "sipDomain": "sip.signalhouse.io",
    "transport": "TLS",
    "status": "active",
    "recordingAllowed": true,
    "phoneNumbers": []
  }
}
```

### GET /voice/sip-profiles/:id/password

Retrieve the stored SIP password for a profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP profile UUID. |

#### Example Response 200

Response

```json
{
  "password": "profile-sip-password"
}
```

### POST /voice/sip-profiles

Create a SIP profile. The generated password is returned once, at the top level of the response.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | String | Required | Profile name. |
| `recordingAllowed` | Boolean | Optional | Allow call recording on this profile. |
| `transcriptionEnabled` | Boolean | Optional | Enable transcription. |
| `sentimentFlag` | Boolean | Optional | Enable sentiment scoring. |

#### Example Request

Request

```json
{
  "name": "Front Desk",
  "recordingAllowed": true
}
```

#### Example Response 201

Response

```json
{
  "sipProfile": {
    "id": "p1a2b3c4-...",
    "name": "Front Desk",
    "username": "sip_frontdesk",
    "sipDomain": "sip.signalhouse.io",
    "transport": "TLS",
    "status": "active"
  },
  "password": "one-time-sip-password",
  "message": "SIP profile created"
}
```

### PATCH /voice/sip-profiles/:id

Update a SIP profile. Pass password to rotate the credential.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP profile UUID. |
| `name` | String | Optional | New profile name. |
| `sipUsername` | String | Optional | New SIP username. |
| `password` | String | Optional | New SIP password. |
| `transport` | String | Optional | UDP, TCP, or TLS. |
| `recordingAllowed` | Boolean | Optional | Allow call recording. |
| `transcriptionEnabled` | Boolean | Optional | Enable transcription. |
| `sentimentFlag` | Boolean | Optional | Enable sentiment scoring. |

#### Example Request

Request

```json
{
  "recordingAllowed": false
}
```

#### Example Response 200

Response

```json
{
  "sipProfile": {
    "id": "p1a2b3c4-...",
    "name": "Front Desk",
    "recordingAllowed": false
  }
}
```

### POST /voice/sip-profiles/:id/assign-number

Route an inbound number to this SIP profile. Numbers are identified by their E.164.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP profile UUID. |
| `e164` | String | Required | The phone number in E.164. |

#### Example Request

Request

```json
{
  "e164": "+19153374770"
}
```

#### Example Response 200

Response

```json
{
  "sipProfile": {
    "id": "p1a2b3c4-...",
    "phoneNumbers": [
      {
        "id": "n1a2b3c4-...",
        "number": "+19153374770",
        "status": "assigned"
      }
    ]
  }
}
```

### POST /voice/sip-profiles/:id/unassign-number

Unassign a number from this SIP profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP profile UUID. |
| `e164` | String | Required | The phone number in E.164. |

#### Example Request

Request

```json
{
  "e164": "+19153374770"
}
```

#### Example Response 200

Response

```json
{
  "sipProfile": {
    "id": "p1a2b3c4-...",
    "phoneNumbers": []
  }
}
```

### DELETE /voice/sip-profiles/:id

Delete a SIP profile. Any assigned numbers are unassigned.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | SIP profile UUID. |

#### Example Response 200

Response

```json
{
  "message": "SIP profile deleted"
}
```

#### Number Routes

A number route is an inbound route set directly on one phone number. It supports the same routing actions as a Programmable Voice Profile, plus VOICEMAIL, and it takes priority over everything else that could route the number. Inbound calls are routed by the first of these that applies: the number's own route, then the Programmable Voice Profile the number is assigned to, then the subgroup's voice settings, then the default (ring the subgroup's WebRTC softphones, then voicemail). Use a number route when one number needs its own destination; use a profile to route a set of numbers the same way.

Numbers are addressed by their E.164 value in the path (the leading `+` is optional, so `+19153374770` and `19153374770` are the same number). The number must be held by your account.

### PUT /voice/api/v1/numbers/:e164/route

Set a number's route, creating it or replacing the existing one. The whole route is replaced: fields the new routeAction doesn't use are cleared, so a number never keeps a stale target. SIP trunk and SIP endpoint targets must belong to your account. Returns the saved route and the routing now in effect. Errors: 400 when the number isn't valid E.164 or a field the routeAction requires is missing; 404 when the number isn't held by your account or the SIP trunk / SIP endpoint isn't yours; 503 when number ownership couldn't be verified (safe to retry).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `e164` | URL Param | Required | The phone number in E.164 (leading + optional). |
| `routeAction` | String | Required | FORWARD, WEBRTC, SIP\_TRUNK, SIP\_PROFILE, CALL\_CONTROL, AI, VOICEMAIL or CALL\_FLOW. |
| `forwardToE164` | String | Optional | Destination number in E.164. Required for FORWARD, and for WEBRTC when noAnswerAction is FORWARD. |
| `noAnswerAction` | String | Optional | WEBRTC only: VOICEMAIL (default), FORWARD or KEEP\_RINGING — what happens when no softphone answers. |
| `noAnswerSeconds` | Integer | Optional | WEBRTC only: seconds to ring before the no-answer action, 5-120 (default 20). |
| `routeSipTrunkId` | String | Optional | SIP trunk to deliver to (required for SIP\_TRUNK). |
| `routeSipProfileId` | String | Optional | SIP endpoint to ring (required for SIP\_PROFILE). |
| `webhookUrl` | String | Optional | Your inbound voice webhook / SHML program URL (required for CALL\_CONTROL). See Programmable Call Control (SHML) above. Must be a public http(s) address: a URL naming an internal or private host is refused with a 400. |
| `routeAgentProfileId` | String | Optional | AI agent profile id (AGP…) to answer the call (required for AI). |
| `routeCallFlowId` | String | Optional | Call flow to run (required for CALL\_FLOW). It must be in the number's subgroup. It need not be published yet: until it is published and enabled, calls fall through to the number's Programmable Voice Profile or subgroup voice settings. See Call Flows below. |
| `recordingEnabled` | Boolean | Optional | Record calls handled by this route (default false). |

#### Example Request

Request

```json
{
  "routeAction": "FORWARD",
  "forwardToE164": "+13055551234"
}
```

#### Example Response 200

Response

```json
{
  "e164": "+19153374770",
  "route": {
    "e164": "+19153374770",
    "accountId": "G1234567",
    "routeAction": "FORWARD",
    "forwardToE164": "+13055551234",
    "noAnswerAction": null,
    "noAnswerSeconds": null,
    "routeSipTrunkId": null,
    "routeSipProfileId": null,
    "webhookUrl": null,
    "routeAgentProfileId": null,
    "recordingEnabled": false,
    "source": "api",
    "createdAt": "2026-10-21T03:00:00.000Z",
    "updatedAt": "2026-10-21T03:00:00.000Z"
  },
  "effective": {
    "found": true,
    "action": "FORWARD",
    "subgroupId": "S1234567",
    "accountId": "G1234567",
    "forwardToE164": "+13055551234",
    "recording": false,
    "source": "number_route"
  }
}
```

### GET /voice/api/v1/numbers/:e164/route

Read a number's own route and the routing currently in effect for it. route is null when the number has no route of its own. effective shows how inbound calls are routed and which layer decided it in effective.source: number\_route, programmable\_profile, subgroup\_settings or default. Numbers assigned to a SIP trunk or SIP endpoint are routed by that assignment unless a number route is set. Errors: 404 when the number isn't held by your account.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `e164` | URL Param | Required | The phone number in E.164 (leading + optional). |

#### Example Response 200

Response

```json
{
  "e164": "+19153374770",
  "route": null,
  "effective": {
    "found": true,
    "action": "WEBRTC",
    "subgroupId": "S1234567",
    "accountId": "G1234567",
    "forwardToE164": null,
    "noAnswerAction": "VOICEMAIL",
    "noAnswerSeconds": 20,
    "recording": false,
    "source": "default"
  }
}
```

### DELETE /voice/api/v1/numbers/:e164/route

Remove a number's own route. Calls to the number are then routed by its Programmable Voice Profile, subgroup voice settings or the default, as shown in effective. Errors: 404 when the number isn't held by your account or has no route to remove.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `e164` | URL Param | Required | The phone number in E.164 (leading + optional). |

#### Example Response 200

Response

```json
{
  "e164": "+19153374770",
  "route": null,
  "effective": {
    "found": true,
    "action": "WEBRTC",
    "subgroupId": "S1234567",
    "accountId": "G1234567",
    "noAnswerAction": "VOICEMAIL",
    "noAnswerSeconds": 20,
    "recording": false,
    "source": "default"
  }
}
```

#### Programmable Voice Profiles

### GET /voice/api/v1/programmable-voice-profiles

List programmable voice profiles. A profile defines how inbound calls to its assigned numbers are handled — forwarded, routed to WebRTC, or delivered to a SIP trunk or profile — scoped to one or more subgroups.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "profiles": [
    {
      "id": "pv1a2b3c-...",
      "name": "Support Routing",
      "enabled": true,
      "subgroupIds": [
        "S1234567"
      ],
      "routeAction": "FORWARD",
      "forwardToE164": "+15558675309",
      "forwardAfterSeconds": 20,
      "recordingEnabled": true,
      "numbers": [
        {
          "e164": "+19153374770",
          "createdAt": "2026-07-20T12:00:00.000Z"
        }
      ],
      "createdAt": "2026-07-20T12:00:00.000Z"
    }
  ]
}
```

### GET /voice/api/v1/programmable-voice-profiles/:id

Retrieve a single programmable voice profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Profile UUID. |

#### Example Response 200

Response

```json
{
  "profile": {
    "id": "pv1a2b3c-...",
    "name": "Support Routing",
    "enabled": true,
    "subgroupIds": [
      "S1234567"
    ],
    "routeAction": "FORWARD",
    "forwardToE164": "+15558675309",
    "numbers": []
  }
}
```

### POST /voice/api/v1/programmable-voice-profiles

Create a programmable voice profile. routeAction determines which target fields are required: FORWARD needs forwardToE164, SIP\_TRUNK needs routeSipTrunkId, SIP\_PROFILE needs routeSipProfileId, CALL\_CONTROL needs webhookUrl, AI needs routeAgentProfileId, CALL\_FLOW needs routeCallFlowId, WEBRTC needs none.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | String | Required | Profile name. |
| `subgroupIds` | Array\[String\] | Required | Subgroups this profile applies to (at least one). |
| `routeAction` | String | Optional | FORWARD, WEBRTC, SIP\_TRUNK, SIP\_PROFILE, CALL\_CONTROL, AI or CALL\_FLOW (default FORWARD). |
| `forwardToE164` | String | Optional | Destination number (required for FORWARD). |
| `forwardAfterSeconds` | Number | Optional | Ring timeout before forwarding. |
| `routeSipTrunkId` | String | Optional | Trunk to deliver to (required for SIP\_TRUNK). |
| `routeSipProfileId` | String | Optional | Profile to deliver to (required for SIP\_PROFILE). |
| `routeAgentProfileId` | String | Optional | AI agent profile id (AGP…) to answer the call (required for AI). The agent's prompt, voice, model and tools are read when the call lands, so editing the agent takes effect on the next call with nothing to re-save here. |
| `webhookUrl` | String | Optional | Your inbound voice webhook / SHML program URL (required for CALL\_CONTROL). See Programmable Call Control (SHML) above. Must be a public http(s) address: a URL naming an internal or private host is refused with a 400. |
| `routeCallFlowId` | String | Optional | Call flow to run (required for CALL\_FLOW). It must be in one of the profile's subgroups. Until it is published and enabled, calls fall through to the subgroup's voice settings. See Call Flows below. |
| `recordingEnabled` | Boolean | Optional | Record calls handled by this profile. |
| `enabled` | Boolean | Optional | Whether the profile is active. |

#### Example Request

Request

```json
{
  "name": "Support Routing",
  "subgroupIds": [
    "S1234567"
  ],
  "routeAction": "FORWARD",
  "forwardToE164": "+15558675309",
  "forwardAfterSeconds": 20,
  "recordingEnabled": true
}
```

#### Example Response 201

Response

```json
{
  "profile": {
    "id": "pv1a2b3c-...",
    "name": "Support Routing",
    "enabled": true,
    "subgroupIds": [
      "S1234567"
    ],
    "routeAction": "FORWARD",
    "forwardToE164": "+15558675309",
    "numbers": []
  }
}
```

### PATCH /voice/api/v1/programmable-voice-profiles/:id

Update a programmable voice profile. All fields optional.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Profile UUID. |
| `name` | String | Optional | New name. |
| `subgroupIds` | Array\[String\] | Optional | Replacement subgroup list. |
| `routeAction` | String | Optional | FORWARD, WEBRTC, SIP\_TRUNK, SIP\_PROFILE, CALL\_CONTROL, AI or CALL\_FLOW. |
| `forwardToE164` | String | Optional | Destination number. |
| `routeAgentProfileId` | String | Optional | AI agent profile id (AGP…) to answer the call (required when routeAction is AI). Pass null to clear. |
| `webhookUrl` | String | Optional | Inbound voice webhook / SHML program URL (required for CALL\_CONTROL). Pass null to clear. Must be a public http(s) address: a URL naming an internal or private host is refused with a 400. |
| `routeCallFlowId` | String | Optional | Call flow to run (required when routeAction is CALL\_FLOW). It must be in one of the profile's subgroups, and narrowing subgroupIds away from it is refused. Pass null to clear. |
| `recordingEnabled` | Boolean | Optional | Record calls. |

#### Example Request

Request

```json
{
  "forwardAfterSeconds": 30
}
```

#### Example Response 200

Response

```json
{
  "profile": {
    "id": "pv1a2b3c-...",
    "forwardAfterSeconds": 30
  }
}
```

### POST /voice/api/v1/programmable-voice-profiles/:id/toggle-active

Enable or disable a programmable voice profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Profile UUID. |

#### Example Response 200

Response

```json
{
  "profile": {
    "id": "pv1a2b3c-...",
    "enabled": false
  }
}
```

### POST /voice/api/v1/programmable-voice-profiles/:id/assign-number

Assign an owned E.164 number to this profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Profile UUID. |
| `e164` | String | Required | E.164 number to assign. |

#### Example Request

Request

```json
{
  "e164": "+19153374770"
}
```

#### Example Response 200

Response

```json
{
  "profile": {
    "id": "pv1a2b3c-...",
    "numbers": [
      {
        "e164": "+19153374770",
        "createdAt": "2026-07-28T18:30:00.000Z"
      }
    ]
  }
}
```

### POST /voice/api/v1/programmable-voice-profiles/:id/unassign-number

Remove a number from this profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Profile UUID. |
| `e164` | String | Required | E.164 number to unassign. |

#### Example Request

Request

```json
{
  "e164": "+19153374770"
}
```

#### Example Response 200

Response

```json
{
  "profile": {
    "id": "pv1a2b3c-...",
    "numbers": []
  }
}
```

### DELETE /voice/api/v1/programmable-voice-profiles/:id

Delete a programmable voice profile.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Profile UUID. |

#### Example Response 200

Response

```json
{
  "message": "Programmable voice profile deleted"
}
```

#### Call Flows

A call flow is a call tree you build from steps: answer, play a greeting, send a text, offer a keypad menu, hand the call to one of your AI voice agents, have one of your AI SMS agents text the caller, call your own URL and branch on its response, forward to one or more numbers, forward to your SIP trunk or a Programmable Voice Profile, take a voicemail, or hang up. Each step leads to the next through its outcomes, such as a menu's keypresses or a forward's answered, no-answer, busy, declined and error results. A flow runs when a number route or a Programmable Voice Profile sets `routeAction` to `CALL_FLOW` and names the flow in `routeCallFlowId`.

Every flow belongs to one subgroup, set when it is created. Only numbers and Programmable Voice Profiles in that subgroup can run it. Each flow has one working draft, which you replace with `PUT /draft` as often as you like, and published versions. Calls always run the latest published version, so editing the draft never affects a live call. A flow that is not published, is disabled or is deleted does not run: calls routed to it fall through to the number's next routing layer (its Programmable Voice Profile, then the subgroup's voice settings, then the default). Call flows are being rolled out, and an environment where they are not yet available refuses `CALL_FLOW` as a routing action.

### GET /voice/api/v1/call-flows

List your call flows, newest first by default. Deleted flows are left out unless includeDeleted is true.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | Query Param | Optional | Page number, from 1 (default 1). |
| `limit` | Query Param | Optional | Page size, 1-100 (default 20). |
| `q` | Query Param | Optional | Match against the flow name, ignoring case. |
| `subgroupId` | Query Param | Optional | Only flows in this subgroup. |
| `includeDeleted` | Query Param | Optional | true to include deleted flows (default false). |
| `sortBy` | Query Param | Optional | createdAt (default), updatedAt or name. |
| `sortOrder` | Query Param | Optional | asc or desc (default desc). |

#### Example Response 200

Response

```json
{
  "data": [
    {
      "id": "0088947b-7821-4853-bfe6-744fce926de2",
      "accountId": "G1234567",
      "subgroupId": "S1234567",
      "name": "Main Support Line",
      "status": "ACTIVE",
      "deletedAt": null,
      "currentVersionId": "5c1f9a2e-3b4d-4e8f-9a0b-1c2d3e4f5a6b",
      "createdAt": "2026-11-17T19:00:00.000Z",
      "updatedAt": "2026-11-17T19:20:00.000Z"
    }
  ],
  "meta": {
    "total": 1,
    "page": 1,
    "limit": 20,
    "totalPages": 1
  }
}
```

### GET /voice/api/v1/call-flows/catalog

List the step types a flow can use, with the outcomes each one offers. An empty ports list means the step ends the call. A menu (ivr) also gets one opt\_<optionId> outcome per option you give it, on top of the unknown and no\_input outcomes listed here. configurable is true when the step takes settings in its config.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "data": {
    "nodeTypes": [
      {
        "type": "inbound",
        "ports": [
          "next"
        ],
        "configurable": false
      },
      {
        "type": "answer",
        "ports": [
          "next"
        ],
        "configurable": false
      },
      {
        "type": "play",
        "ports": [
          "next"
        ],
        "configurable": true
      },
      {
        "type": "sms",
        "ports": [
          "next"
        ],
        "configurable": true
      },
      {
        "type": "ivr",
        "ports": [
          "unknown",
          "no_input"
        ],
        "configurable": true
      },
      {
        "type": "ai_agent",
        "ports": [
          "unavailable"
        ],
        "configurable": true
      },
      {
        "type": "ai_sms",
        "ports": [
          "next"
        ],
        "configurable": true
      },
      {
        "type": "webhook",
        "ports": [
          "no_match",
          "failed"
        ],
        "configurable": true
      },
      {
        "type": "fwd_phone",
        "ports": [
          "success",
          "no_answer",
          "busy",
          "decline",
          "error"
        ],
        "configurable": true
      },
      {
        "type": "fwd_sip",
        "ports": [
          "success",
          "no_answer",
          "busy",
          "decline",
          "error",
          "unavailable"
        ],
        "configurable": true
      },
      {
        "type": "voicemail",
        "ports": [],
        "configurable": false
      },
      {
        "type": "hangup",
        "ports": [],
        "configurable": false
      }
    ]
  }
}
```

### GET /voice/api/v1/call-flows/:id

Get a call flow with its working draft and the issues that stop the draft being published. Deleted flows can still be read. Steps come back with their type in nodeType and connections with their outcome in conditionType. Errors: 404 when the flow isn't yours.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call flow UUID. |

#### Example Response 200

Response

```json
{
  "data": {
    "id": "0088947b-7821-4853-bfe6-744fce926de2",
    "accountId": "G1234567",
    "subgroupId": "S1234567",
    "name": "Main Support Line",
    "status": "ACTIVE",
    "deletedAt": null,
    "currentVersionId": null,
    "createdAt": "2026-11-17T19:00:00.000Z",
    "updatedAt": "2026-11-17T19:00:00.000Z",
    "draft": {
      "versionId": "9e8d7c6b-5a49-4382-a1b0-c9d8e7f6a5b4",
      "nodes": [
        {
          "id": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
          "nodeType": "inbound",
          "name": "Inbound Call",
          "config": {},
          "positionX": 0,
          "positionY": 0
        }
      ],
      "edges": [],
      "issues": [
        {
          "code": "PORT_UNCONNECTED",
          "nodeId": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
          "port": "next",
          "message": "Inbound Call has nothing connected to its \"next\" outcome."
        }
      ]
    }
  }
}
```

### POST /voice/api/v1/call-flows

Create a call flow, with a working draft that holds the Inbound Call step every flow starts from. Creating a flow changes no routing. Errors: 404 when the subgroup isn't yours; 409 when a flow in the subgroup already has that name, including a deleted one; 503 when the subgroup couldn't be verified (safe to retry).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | String | Required | Flow name, 1-120 characters, unique within the subgroup. |
| `subgroupId` | String | Required | The subgroup the flow belongs to. It can't be changed later; only numbers and Programmable Voice Profiles in this subgroup can run the flow. |

#### Example Request

Request

```json
{
  "name": "Main Support Line",
  "subgroupId": "S1234567"
}
```

#### Example Response 201

Response

```json
{
  "data": {
    "id": "0088947b-7821-4853-bfe6-744fce926de2",
    "accountId": "G1234567",
    "subgroupId": "S1234567",
    "name": "Main Support Line",
    "status": "ACTIVE",
    "deletedAt": null,
    "currentVersionId": null,
    "createdAt": "2026-11-17T19:00:00.000Z",
    "updatedAt": "2026-11-17T19:00:00.000Z",
    "draft": {
      "versionId": "9e8d7c6b-5a49-4382-a1b0-c9d8e7f6a5b4",
      "nodes": [
        {
          "id": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
          "nodeType": "inbound",
          "name": "Inbound Call",
          "config": {},
          "positionX": 0,
          "positionY": 0
        }
      ],
      "edges": [],
      "issues": [
        {
          "code": "PORT_UNCONNECTED",
          "nodeId": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
          "port": "next",
          "message": "Inbound Call has nothing connected to its \"next\" outcome."
        }
      ]
    }
  }
}
```

### PATCH /voice/api/v1/call-flows/:id

Rename a call flow, or enable or disable it. Send only the fields you are changing. A disabled flow does not run: calls routed to it fall through to the number's next routing layer until you enable it again. Errors: 404 when the flow isn't yours; 409 when a flow in the subgroup already has the new name, including a deleted one.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call flow UUID. |
| `name` | String | Optional | New name, unique within the flow's subgroup. |
| `status` | String | Optional | ACTIVE or DISABLED. |

#### Example Request

Request

```json
{
  "status": "DISABLED"
}
```

#### Example Response 200

Response

```json
{
  "data": {
    "id": "0088947b-7821-4853-bfe6-744fce926de2",
    "name": "Main Support Line",
    "status": "DISABLED",
    "draft": {
      "versionId": "9e8d7c6b-5a49-4382-a1b0-c9d8e7f6a5b4",
      "nodes": [],
      "edges": [],
      "issues": []
    }
  }
}
```

### PUT /voice/api/v1/call-flows/:id/draft

Replace the working draft with the steps and connections you send. The whole draft is saved even when it isn't finished, and the response lists the issues that would stop it being published, so you can save as often as you like. Send each step's type in type and each connection's outcome in port; reads return the same values as nodeType and conditionType. Ids are UUIDs you generate, and they are kept, so a step keeps its id across saves. Errors: 400 when the body is malformed (more than 200 steps or 400 connections, or an id that isn't a UUID); 404 when the flow isn't yours.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call flow UUID. |
| `nodes` | Array\[Object\] | Required | Every step: { id, type, name, config, positionX, positionY }. type is one of the catalog's step types, and the flow needs exactly one inbound step. config holds the step's settings: play takes { mode: "tts", text } or { mode: "audio", url }; ivr takes the same prompt fields plus options \[{ id, press, label }\] and waitInputSeconds; sms takes from (one of your numbers that can send texts, in E.164), to ("inbound" for the caller, or "designated" with toNumber) and message (up to 1,600 characters), and the call carries on whether or not the text is sent; ai\_agent takes agentProfileId, one of your active AI agents with its voice channel on, either shared with every subgroup or in the flow's own subgroup. The agent is checked on each call. If it can take the call, the call is handed to it and leaves the flow, so the step has no outcome for that. If it can't, the step takes unavailable. ai\_sms takes agentProfileId (one of your active AI agents with its SMS channel on), from (a number in the flow's subgroup that agent answers texts on, in E.164) and message (the opening text, up to 1,600 characters). When the text starts a new conversation and doesn't mention STOP, "Reply STOP to opt out." is added to it. The caller is texted from that number, and the agent answers their replies the way it answers any text to it; the call carries on whether or not the text is sent. webhook calls your URL during the call: method (GET, POST, PUT or DELETE), url (a public https address; variables may fill in the path or query, not the host), headers \[{ name, value }\] (up to 20), body (a string or JSON, up to 10,000 characters; not sent on GET), timeoutSeconds (1 to 10, default 5), store (keep the response for later steps) and conditions \[{ id, field, operator, value }\] (up to 10). A condition's field is status (the HTTP status), response (the whole body) or response.<path> into a JSON body, such as response.customer.tier; operator is equals, not\_equals, contains, starts\_with, exists, not\_exists, gt, lt, gte or lte, and text comparisons ignore case. The step's outcomes are cond\_<id> for the first condition the response meets, in order, then no\_match, and failed when there is no response (a timeout, an address that is not public, a connection error). Redirects are not followed, the response is read up to 64 KB, and a call may make at most 10 such requests. Variables: the webhook's url, headers and body, play and ivr text, sms and ai\_sms messages, and fwd\_phone whisperText may use {{from}} (the caller, E.164), {{to}} (the number dialled), {{callId}}, and, after a webhook step with store on, {{response.<path>}}. A variable with no value is left empty. fwd\_phone takes numbers \[{ number, timeoutSeconds, whisper, whisperText }\], tried one after another, and callerId ("inbound", or "designated" with callerIdNumber). Every number that answers is checked for voicemail. One detected as a voicemail is hung up without hearing the whisper, the next number rings, and the step takes no\_answer after the last. When the check can't tell, the call connects as if a person answered: the whisper plays and the step takes success. A number's whisperText (with whisper: true) is spoken to whoever answers before the caller is connected; the caller never hears it. fwd\_sip takes target ("trunk", the default, or "profile"), sipTrunkId (with trunk: one of your SIP trunks), profileId (with profile: an enabled Programmable Voice Profile whose subgroups include the flow's) and timeoutSeconds (3 to 120, default 30). A trunk is sent the number the caller dialled, with the caller's number as caller ID, at its highest-priority enabled destination host; your PBX must allow our SIP addresses, as for inbound calls. A profile does what it does for its own numbers: FORWARD, SIP\_TRUNK, SIP\_PROFILE and WEBRTC ring their target (WEBRTC rings the flow subgroup's signed-in softphones, and takes no\_answer when none is signed in) and take a forward's outcomes; AI, CALL\_CONTROL and CALL\_FLOW hand the call on, and it leaves the flow. The trunk or profile is checked on each call, and the step takes unavailable when it can't take the call: a trunk that is disabled or has no enabled destination host, a profile that is disabled or outside the flow's subgroup, a target that is missing, or a profile whose call flow this call is already running. positionX and positionY place the step on a canvas. |
| `edges` | Array\[Object\] | Required | Every connection: { id, fromNodeId, toNodeId, port }. port is the outcome of the source step it leaves from, e.g. next, success, no\_answer, no\_input or opt\_<optionId>. |

#### Example Request

Request

```json
{
  "nodes": [
    {
      "id": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
      "type": "inbound",
      "name": "Inbound Call",
      "config": {},
      "positionX": 0,
      "positionY": 0
    },
    {
      "id": "7a6b5c4d-3e2f-4a1b-8c9d-0e1f2a3b4c5d",
      "type": "play",
      "name": "Greeting",
      "config": {
        "mode": "tts",
        "text": "Thanks for calling. Please hold while we connect you."
      },
      "positionX": 0,
      "positionY": 160
    },
    {
      "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
      "type": "hangup",
      "name": "Hang Up",
      "config": {},
      "positionX": 0,
      "positionY": 320
    }
  ],
  "edges": [
    {
      "id": "a0b1c2d3-e4f5-4a6b-8c7d-9e0f1a2b3c4d",
      "fromNodeId": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
      "toNodeId": "7a6b5c4d-3e2f-4a1b-8c9d-0e1f2a3b4c5d",
      "port": "next"
    },
    {
      "id": "b1c2d3e4-f5a6-4b7c-9d8e-0f1a2b3c4d5e",
      "fromNodeId": "7a6b5c4d-3e2f-4a1b-8c9d-0e1f2a3b4c5d",
      "toNodeId": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
      "port": "next"
    }
  ]
}
```

#### Example Response 200

Response

```json
{
  "data": {
    "nodes": [
      {
        "id": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
        "nodeType": "inbound",
        "name": "Inbound Call",
        "config": {},
        "positionX": 0,
        "positionY": 0
      },
      {
        "id": "7a6b5c4d-3e2f-4a1b-8c9d-0e1f2a3b4c5d",
        "nodeType": "play",
        "name": "Greeting",
        "config": {
          "mode": "tts",
          "text": "Thanks for calling. Please hold while we connect you."
        },
        "positionX": 0,
        "positionY": 160
      },
      {
        "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
        "nodeType": "hangup",
        "name": "Hang Up",
        "config": {},
        "positionX": 0,
        "positionY": 320
      }
    ],
    "edges": [
      {
        "id": "a0b1c2d3-e4f5-4a6b-8c7d-9e0f1a2b3c4d",
        "fromNodeId": "3f2e1d0c-9b8a-4796-8584-736251403f2e",
        "toNodeId": "7a6b5c4d-3e2f-4a1b-8c9d-0e1f2a3b4c5d",
        "conditionType": "next"
      },
      {
        "id": "b1c2d3e4-f5a6-4b7c-9d8e-0f1a2b3c4d5e",
        "fromNodeId": "7a6b5c4d-3e2f-4a1b-8c9d-0e1f2a3b4c5d",
        "toNodeId": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
        "conditionType": "next"
      }
    ],
    "issues": []
  }
}
```

### POST /voice/api/v1/call-flows/:id/publish

Publish the working draft, making it the version calls run. The draft stays editable afterwards and changes nothing until you publish again. Send an empty JSON object as the body. Errors: 400 with code CALL\_FLOW\_NOT\_PUBLISHABLE and an issues array when the draft isn't ready. Each issue names the step (nodeId), connection (edgeId) or outcome (port) it concerns, with a code such as ENTRY\_MISSING, PORT\_UNCONNECTED, UNREACHABLE or CONFIG\_INVALID. 404 when the flow isn't yours.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call flow UUID. |

#### Example Request

Request

```json
{}
```

#### Example Response 200

Response

```json
{
  "data": {
    "id": "5c1f9a2e-3b4d-4e8f-9a0b-1c2d3e4f5a6b",
    "versionNumber": 1,
    "status": "PUBLISHED",
    "publishedAt": "2026-11-17T19:20:00.000Z"
  }
}
```

### POST /voice/api/v1/call-flows/:id/duplicate

Copy a call flow and its working draft into a new flow in the same subgroup. The copy is not published and nothing routes to it. Send an empty JSON object to name the copy “<name> (copy)”. Errors: 404 when the flow isn't yours; 409 when a flow in the subgroup already has that name, including a deleted one.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | UUID of the flow to copy. |
| `name` | String | Optional | Name for the copy, unique within the subgroup. |

#### Example Request

Request

```json
{
  "name": "Main Support Line (weekend)"
}
```

#### Example Response 201

Response

```json
{
  "data": {
    "id": "4d3c2b1a-0f9e-4d8c-b7a6-5f4e3d2c1b0a",
    "subgroupId": "S1234567",
    "name": "Main Support Line (weekend)",
    "status": "ACTIVE",
    "currentVersionId": null,
    "draft": {
      "versionId": "e1d2c3b4-a5f6-4e7d-8c9b-0a1f2e3d4c5b",
      "nodes": [],
      "edges": [],
      "issues": []
    }
  }
}
```

### DELETE /voice/api/v1/call-flows/:id

Delete a call flow. Numbers and profiles that route to it keep pointing at it, but their calls fall through to the next routing layer until you restore it. Errors: 404 when the flow isn't yours.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call flow UUID. |

#### Example Response 200

Response

```json
{
  "data": {
    "id": "0088947b-7821-4853-bfe6-744fce926de2",
    "name": "Main Support Line",
    "status": "ACTIVE",
    "deletedAt": "2026-11-18T09:00:00.000Z"
  }
}
```

### POST /voice/api/v1/call-flows/:id/restore

Restore a deleted call flow. Numbers and profiles that still point at it run it again, as long as it is published and enabled. Restoring a flow that isn't deleted changes nothing. Send an empty JSON object as the body. Errors: 404 when the flow isn't yours.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Call flow UUID. |

#### Example Request

Request

```json
{}
```

#### Example Response 200

Response

```json
{
  "data": {
    "id": "0088947b-7821-4853-bfe6-744fce926de2",
    "name": "Main Support Line",
    "status": "ACTIVE",
    "deletedAt": null,
    "draft": {
      "versionId": "9e8d7c6b-5a49-4382-a1b0-c9d8e7f6a5b4",
      "nodes": [],
      "edges": [],
      "issues": []
    }
  }
}
```

#### Global Voice Settings

### GET /voice/api/v1/global-voice-settings

Retrieve account-wide voice defaults. Returns null data when settings have never been configured.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "accountId": "G1234567",
    "acceptedRegions": [
      "1"
    ],
    "maxSpendPerMinute": 10,
    "e911Enabled": false,
    "updatedAt": "2026-07-20T12:00:00.000Z"
  }
}
```

### PUT /voice/api/v1/global-voice-settings

Update account-wide voice defaults. Partial — omitted fields are preserved.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `acceptedRegions` | Array\[String\] | Optional | Country calling codes allowed for calls; empty means all. |
| `maxSpendPerMinute` | Number | Optional | Per-minute spend cap; null means no limit. |
| `e911Enabled` | Boolean | Optional | Enable E911 by default. |

#### Example Request

Request

```json
{
  "acceptedRegions": [
    "1"
  ],
  "maxSpendPerMinute": 10
}
```

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "accountId": "G1234567",
    "acceptedRegions": [
      "1"
    ],
    "maxSpendPerMinute": 10,
    "e911Enabled": false,
    "updatedAt": "2026-07-28T18:30:00.000Z"
  }
}
```

#### Mobile Push

Mobile Push rings your iOS or Android app for incoming calls, even while it is in the background. Phones suspend background apps, which drops their connection to us, so there is nothing to ring. Mobile Push sends a push notification that wakes the app first, the same way Twilio and Telnyx do it.

1. **Upload your push credentials once.** Your Apple APNs auth key (`.p8`) for iOS, your Firebase service account for Android, or both. They are encrypted and never returned. Push turns on for your account once a credential exists and an app registers a device; nothing changes for accounts that never set it up.
2. **Register each device with its voice token.** Mint the user's voice token with a `subgroupId` (`POST /voice/tokens`), then send the device's push token to `POST /voice/api/v1/push-devices` using that voice token as the bearer token. Register again after each mint and whenever the OS gives the app a new push token. Unregister on sign-out.
3. **We push, and hold the call.** When a call comes in for the subgroup's app users, we push every registered device of each user and keep the caller hearing ringback. The app wakes, shows the call screen, and connects with its voice token, and then the call rings it. If no device connects before the subgroup's ring time runs out, the call follows its no-answer setting (voicemail or forwarding).
4. **We cancel.** If the call ends before a device connects (the caller hangs up, it rings out, or another device answers), the devices we woke get a cancel push for the same call.

##### The push payload

On iOS it is a VoIP push (`apns-push-type: voip`, topic `<bundleId>.voip`) with the fields under a `signalhouse` key: `{ "aps": {}, "signalhouse": { ... } }`. On Android it is a high-priority Firebase data message (no `notification` block) with the same fields as strings, plus `source: "signalhouse"`.

| Field | Meaning |
| --- | --- |
| `type` | `incoming` when a call is about to ring the user; `cancel` when it ended or was answered before this device connected. |
| `callId` | The call's ID. The incoming call the app then receives carries it in the `X-Call-UUID` header (`call.callUuid` in the JS SDK), so the app can match the two. It is not always a UUID: keep your own map from `callId` to the CallKit UUID. |
| `from` | The caller, in E.164. |
| `to` | The number they dialed, in E.164. |
| `subgroupId` | The subgroup the call is for. |
| `identity` | Who is being called: the `identity` the voice token was minted with. |
| `expiresAt` | When to stop waiting for the call (ISO 8601). |
| `reason` | Cancel pushes only: `canceled` (the caller hung up or it rang out) or `answered` (another device took it). |

##### In your app

- **iOS:** receive VoIP pushes with PushKit and report every one to CallKit at once. Apple terminates apps that receive a VoIP push without reporting a call, and that includes cancel pushes: report the call, then end it immediately.
- **Android:** handle the data message in your Firebase messaging service and show the incoming call with ConnectionService or a full-screen notification.
- **Connect:** on an incoming push, connect with the user's voice token (mint a fresh one through your server if it has expired) and answer the call whose `X-Call-UUID` matches `callId`. Ignore a push for a call the app already has.
- **Declining:** if the user declines from the lock screen, connect and reject the incoming call so the caller goes straight to the no-answer setting; otherwise it rings out.

### GET /voice/api/v1/push-credentials

List the account's push credentials. Secrets are never returned; fingerprint is the first 12 hex characters of the key's SHA-256, to tell keys apart.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Example Response 200

Response

```json
{
  "success": true,
  "data": [
    {
      "id": "5a3c2f8e-1b7d-4c9a-9e2f-0d4b6a8c1e33",
      "provider": "apns",
      "name": "Production app",
      "appId": "com.example.app",
      "keyId": "ABC123DEFG",
      "teamId": "TEAM123456",
      "bundleId": "com.example.app",
      "projectId": null,
      "clientEmail": null,
      "fingerprint": "3f9a1c7e2b04",
      "createdAt": "2026-11-25T15:00:00.000Z",
      "updatedAt": "2026-11-25T15:00:00.000Z"
    }
  ]
}
```

### GET /voice/api/v1/push-credentials/:id

Get one push credential (metadata only).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | The credential ID. |

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "id": "8d1e4b2a-6c3f-4a7e-b1d9-2f5c7e9a0b44",
    "provider": "fcm",
    "name": "Android",
    "appId": "example-voice",
    "keyId": null,
    "teamId": null,
    "bundleId": null,
    "projectId": "example-voice",
    "clientEmail": "push@example-voice.iam.gserviceaccount.com",
    "fingerprint": "b71d0e9c4a25",
    "createdAt": "2026-11-25T15:05:00.000Z",
    "updatedAt": "2026-11-25T15:05:00.000Z"
  }
}
```

### POST /voice/api/v1/push-credentials

Upload push credentials for one app: an Apple APNs auth key (one key works for development and production builds) or a Firebase service account. The key is checked when you upload it. One credential per app; to change one, replace it.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `provider` | String | Required | "apns" (Apple, iOS) or "fcm" (Firebase, Android). |
| `name` | String | Optional | A label for the credential, up to 100 characters. |
| `keyId` | String | Optional | apns: the 10-character key ID of the .p8 key. Required for apns. |
| `teamId` | String | Optional | apns: your 10-character Apple developer team ID. Required for apns. |
| `bundleId` | String | Optional | apns: your app's bundle ID. VoIP pushes go to its .voip topic. Required for apns. |
| `privateKey` | String | Optional | apns: the contents of the .p8 file. Required for apns. |
| `serviceAccount` | String | Optional | fcm: the service account key file from Firebase (Project settings › Service accounts), as its JSON text or as an object. Required for fcm. |

#### Example Request

Request

```json
{
  "provider": "apns",
  "name": "Production app",
  "keyId": "ABC123DEFG",
  "teamId": "TEAM123456",
  "bundleId": "com.example.app",
  "privateKey": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----"
}
```

#### Example Response 201

Response

```json
{
  "success": true,
  "data": {
    "id": "5a3c2f8e-1b7d-4c9a-9e2f-0d4b6a8c1e33",
    "provider": "apns",
    "name": "Production app",
    "appId": "com.example.app",
    "keyId": "ABC123DEFG",
    "teamId": "TEAM123456",
    "bundleId": "com.example.app",
    "projectId": null,
    "clientEmail": null,
    "fingerprint": "3f9a1c7e2b04",
    "createdAt": "2026-11-25T15:00:00.000Z",
    "updatedAt": "2026-11-25T15:00:00.000Z"
  }
}
```

### PUT /voice/api/v1/push-credentials/:id

Replace a credential's key or service account (and name). Same body as upload; the provider cannot change. Registered devices keep working and use the new key from then on.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | The credential ID. |

#### Example Request

Request

```json
{
  "provider": "fcm",
  "serviceAccount": "{\"type\":\"service_account\",\"project_id\":\"example-voice\",...}"
}
```

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "id": "8d1e4b2a-6c3f-4a7e-b1d9-2f5c7e9a0b44",
    "provider": "fcm",
    "appId": "example-voice",
    "projectId": "example-voice",
    "fingerprint": "c02e8f6a1d39",
    "updatedAt": "2026-11-26T09:00:00.000Z"
  }
}
```

### DELETE /voice/api/v1/push-credentials/:id

Delete a credential and every device registered for that app. Calls stop waking those phones until you upload a credential and the app registers again.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | The credential ID. |

#### Example Response 200

Response

```json
{
  "success": true
}
```

### POST /voice/api/v1/push-devices

Register this device for push. Called by your app with the user's voice token (from POST /voice/tokens, minted with a subgroupId) as the bearer token, not a dashboard or API key token. Ties the device's push token to the voice token's identity. Refused if the token was minted with incoming calls off, or if the account has no credential for the provider. A push token already registered to another user moves to this one.

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `provider` | String | Required | "apns" or "fcm". |
| `deviceToken` | String | Required | The device's push token: the PushKit VoIP token (hex) on iOS, the Firebase registration token on Android. |
| `environment` | String | Optional | apns only: "sandbox" for development builds, "production" (default) for TestFlight and App Store builds. |
| `appId` | String | Optional | The bundle ID or Firebase project ID. Only needed when the account has more than one credential for the provider. |

#### Example Request

Request

```json
{
  "provider": "apns",
  "deviceToken": "740f4707bebcf74f9b7c25d48e3358945f6aa01da5ddb387462c7eaf61bb78ad",
  "environment": "production"
}
```

#### Example Response 201

Response

```json
{
  "success": true,
  "data": {
    "id": "c4e2a9f1-7b3d-4e8a-a5c6-9d1f0b2e7a55",
    "identity": "agent-42",
    "provider": "apns",
    "environment": "production",
    "appId": "com.example.app",
    "registeredAt": "2026-11-25T15:10:00.000Z"
  }
}
```

### DELETE /voice/api/v1/push-devices/:deviceToken

Unregister this device, e.g. when the user signs out. Called with the user's voice token.

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `deviceToken` | URL Param | Required | The device's push token, URL-encoded. |

#### Example Response 200

Response

```json
{
  "success": true,
  "data": {
    "removed": true
  }
}
```

### GET /voice/api/v1/push-devices/deliveries

The pushes recently sent to this voice token's user, newest first, for debugging your app. status is sent, failed, or removed (the provider said the device token is no longer valid, so the device was unregistered). Kept for 7 days.

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | Query Param | Optional | How many to return, 1 to 100 (default 20). |

#### Example Response 200

Response

```json
{
  "success": true,
  "data": [
    {
      "id": "e9b1c3d5-2f4a-4b6c-8d0e-1a3c5e7f9b66",
      "callUuid": "8f3a2b1c-4d5e@203.0.113.10",
      "provider": "apns",
      "kind": "incoming",
      "status": "sent",
      "error": null,
      "createdAt": "2026-11-25T15:12:03.000Z"
    }
  ]
}
```
