# Phone Numbers

Source: https://docs.autessa.com/docs/api/poweruser/phone-numbers

> Poweruser endpoints for finding and purchasing phone numbers, routing inbound calls to agents, managers, people, or keypad menus, setting recording and call limits, reading call history, turning on texting, deciding who answers texts, and sending and reading text messages through the shared inbox.

# Phone Numbers

Find and purchase phone numbers, wire inbound calls to your agents, tools, or managers — directly, through a press-a-digit menu, or through a call flow that can also ring people, follow business hours, and take voicemail — set recording, transcripts, and call limits, read call history, decide who answers texts, send and read text messages, and release numbers you no longer need.

> All paths on this page are relative to `https://api.autessa.com/autessa_poweruser/twilio`. Every request is a POST with a JSON body, and every ID is an opaque string. See the [Poweruser API overview](/docs/api/poweruser.md) for authentication and conventions.

The typical flow is two calls: [`/purchase-number`](#purchase-a-phone-number) buys a
number and returns a `configId`, then [`/configure-routing`](#configure-routing)
points that number at a resource. Use [`/search-numbers`](#search-available-numbers)
first if you want to pick the number yourself. A number routes one of three ways:

- **`DIRECT`** — every inbound call goes straight to one resource
  (`directResourceType` + `directResourceId`).
- **`PRESS_DIGIT`** — callers hear a menu and are routed by the digit they
  press, using `routingConfig.digitToResourceMap`. These numbers now run as
  a keypad-menu call flow.
- **`FLOW`** — a [call flow](#update-the-call-flow) decides who answers:
  AI agents, people, a keypad menu, voicemail, or a mix, with business
  hours. Set it with [`/update-call-flow`](#update-the-call-flow).

Separately, [`/update-call-settings`](#update-call-settings) controls
voice and language, recording, transcripts, Call Redaction, call limits,
caller-name lookup, blocked callers, AI call behavior, and answering
machine detection for every call on the number, and
[`/get-calls`](#list-calls) reads its call history.
[`/audio-upload-link`](#get-an-audio-upload-link) uploads your own
recordings for greetings and menus, and
[`/voice-options`](#list-voice-options) lists the voices and languages you
can pick.

For texts, [`/update-text-flow`](#update-the-text-flow) decides who answers
them (an AI agent or your team, with business hours, auto-replies, and
keyword replies), [`/sms/threads`](#list-text-threads) and
[`/sms/thread`](#get-a-text-thread) read the shared inbox, and
[`/sms/send`](#send-a-text-message) replies.

A number with nothing set up yet still takes messages: callers go to
voicemail, and texts are saved to the shared inbox. See
[Numbers with nothing set up](/docs/guide/agentic/phone-numbers.md#numbers-with-nothing-set-up).

---

## The phone config object

- `configId` (string) — Unique phone configuration identifier.
- `phoneNumber` (string) — The purchased number in E.164 format (for example `+12065550142`).
- `twilioPhoneSid` (string) — The carrier's identifier for the number.
- `routingType` (string) — `DIRECT`, `PRESS_DIGIT`, or `FLOW`.
- `directResourceType` (string) — `DIRECT` routing — the resource kind answering calls: `AGENT`, `TOOL`, or `MANAGER`.
- `directResourceId` (string) — `DIRECT` routing — the resource answering calls.
- `directRoutingConfig` (object) — `DIRECT` routing — call settings: `environmentVariables`, `promptTemplateVariables`, `locallyHostedStt` (default `true`), `initialMessage`, `initialMessagePrompt`, `conferenceParticipants`, `clientDisplayMessage`.
- `routingConfig` (object) — `PRESS_DIGIT` routing — `digitToResourceMap` (map of digit to a routing target with `type`, `id`, `environmentVariables`, `promptTemplateVariables`) and `locallyHostedStt`.
- `callFlow` (CallFlow | null) — `FLOW` routing — the [call flow](#update-the-call-flow); `null` otherwise.
- `callSettings` (CallSettings) — The number's [call settings](#update-call-settings). Always present; an empty object means every setting is at its default.
- `callLogTableId` (string | null) — Your company's Phone calls AutessaDB table, or `null` until the first call creates it. The same table is shared by all your numbers.
- `textFlow` (TextFlow | null) — How texts to the number are handled; see [`/update-text-flow`](#update-the-text-flow). `null` means the default.
- `textLogTableId` (string | null) — Your company's [Text messages](/docs/guide/agentic/phone-numbers.md#the-text-messages-table) AutessaDB table, or `null` until the first text creates it. The same table is shared by all your numbers.
- `automations` (object) — The number's [quick automations](#set-an-automation): `textBackMissedCalls` (`enabled`, `smsMessage`, `triggerId`, `toolId`), `emailVoicemails` (`enabled`, `emails`, `triggerId`, `toolId`), `textForwardSms` (`enabled`, `phones`, `triggerId`, `toolId`), and `textForwardEmail` (`enabled`, `emails`, `triggerId`, `toolId`). The ids point at the trigger and tool behind each one, or are `null` if it was never turned on.
- `audioPreviewUrls` (object) — A map from each uploaded audio file the number uses (the `audioUri` key from [`/audio-upload-link`](#get-an-audio-upload-link)) to a short-lived `https://` link you can play it from. Audio fields themselves come back exactly as you saved them.
- `speechLanguageWarnings` (array<object>) — Returned by `/get-config` and the call-settings and call-flow updates. When the number's `speech.language` is Spanish, one entry for each agent or manager the number sends calls to that doesn't have Spanish in its [`languages`](/docs/api/poweruser/agents.md#language-entries). Each entry has `resourceType` (`AGENT` or `MANAGER`), `resourceId`, `resourceName`, `language`, and `message` (a plain-language explanation you can show as-is). For a language other than English or Spanish, one entry without `resourceType` says the assistant can't understand callers in it. Empty when every routed AI will understand callers. It's a hint only; saving is never blocked.
- `sharingLevel` (string) — `PRIVATE`, `SPECIFIC_MEMBER`, or `COMPANY`.
- `companyPermissionLevel` (string) — Access level granted company-wide when shared with the company: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `isActive` (boolean) — Whether the number is live. Released numbers become inactive.
- `createdAt` (string) — ISO-8601 creation timestamp.
- `updatedAt` (string) — ISO-8601 timestamp of the last update.

```json title="Phone config object (DIRECT)"
{
  "configId": "pH9nR3vC6b",
  "phoneNumber": "+12065550142",
  "twilioPhoneSid": "PNa1b2c3d4e5f60718293a4b5c6d7e8f90",
  "routingType": "DIRECT",
  "directResourceType": "AGENT",
  "directResourceId": "V1StGXR8Z5",
  "directRoutingConfig": {
    "environmentVariables": {},
    "promptTemplateVariables": { "companyName": "Acme Corp" },
    "locallyHostedStt": true,
    "initialMessage": "Thanks for calling Acme, how can I help?",
    "initialMessagePrompt": null,
    "conferenceParticipants": [],
    "clientDisplayMessage": null
  },
  "routingConfig": null,
  "callFlow": null,
  "callSettings": {
    "transcript": { "save": true },
    "recording": { "save": true, "announcement": "This call may be recorded." }
  },
  "callLogTableId": "tB7xQ2mL9k",
  "textFlow": null,
  "textLogTableId": "tM3wK8pR5j",
  "automations": {
    "textBackMissedCalls": { "enabled": false, "smsMessage": null, "triggerId": null, "toolId": null },
    "emailVoicemails": { "enabled": true, "emails": ["frontdesk@example.com"], "triggerId": "tR4kP8nW2q", "toolId": "tL6vH3cJ9d" },
    "textForwardSms": { "enabled": false, "phones": [], "triggerId": null, "toolId": null },
    "textForwardEmail": { "enabled": false, "emails": [], "triggerId": null, "toolId": null }
  },
  "sharingLevel": "COMPANY",
  "companyPermissionLevel": "READ",
  "isActive": true,
  "createdAt": "2026-06-01T14:22:05",
  "updatedAt": "2026-06-28T17:42:10"
}
```

---

## Search available numbers

**POST** `/twilio/search-numbers`

Lists US numbers available to buy. Nothing is
reserved — pass the number you pick to
[`/purchase-number`](#purchase-a-phone-number) as `phoneNumber`.

### Request parameters

- `areaCode` (string) — Three-digit US area code.
- `contains` (string) — Digits the number should contain, for example `"555"`.
- `limit` (integer) — How many numbers to return, 1–20 (default 10).

### Response

- `numbers` (array<object>) — Available numbers: `phoneNumber` (E.164), `locality`, `region`, and `capabilities` (`sms`, `voice`, `mms`).
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/search-numbers \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "areaCode": "206", "limit": 5 }'
```

```json title="Response (truncated)"
{
  "numbers": [
    {
      "phoneNumber": "+12065550142",
      "locality": "Seattle",
      "region": "WA",
      "capabilities": { "sms": true, "voice": true, "mms": true }
    }
  ],
  "errors": []
}
```

---

## Purchase a phone number

**POST** `/twilio/purchase-number`

Gets a new US phone number. Numbers are free for calls, and no card is
needed. Pick an exact number from
[`/search-numbers`](#search-available-numbers), give just an area code, or send
`{}` to let the platform choose. The number takes calls immediately. It starts
without routing; configure it with [`/configure-routing`](#configure-routing).
Texting is off until you turn it on with
[`/sms/attach-number`](#turn-on-texting-for-a-number).

### Request parameters

- `phoneNumber` (string) — The exact number to buy, in E.164 format, from `/search-numbers`.
- `areaCode` (string) — Buy the first available number in this area code.
- `idempotencyKey` (string) — Your own key (up to 64 characters). Retrying with the same key never buys twice.
- `attachToSms` (boolean) — Also turn on texting for the number, exactly as [`/sms/attach-number`](#turn-on-texting-for-a-number) does — including its monthly texting fee and card requirement.

### Response

- `success` (boolean) — Whether the purchase succeeded.
- `configId` (string) — The new phone configuration — pass this to every other endpoint on this page.
- `phoneNumber` (string) — The purchased number in E.164 format.
- `twilioPhoneSid` (string) — The carrier's identifier for the number.
- `message` (string) — Human-readable result.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/twilio/purchase-number \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

**JavaScript:**

```javascript
const response = await fetch(
  'https://api.autessa.com/autessa_poweruser/twilio/purchase-number',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({})
  }
);

const { configId, phoneNumber } = await response.json();
```

**Python:**

```python
import os
import requests

response = requests.post(
    'https://api.autessa.com/autessa_poweruser/twilio/purchase-number',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={}
)

data = response.json()
config_id = data['configId']
```

```json title="Response"
{
  "success": true,
  "configId": "pH9nR3vC6b",
  "phoneNumber": "+12065550142",
  "twilioPhoneSid": "PNa1b2c3d4e5f60718293a4b5c6d7e8f90",
  "message": "Phone number purchased successfully",
  "errors": []
}
```

---

## Configure routing

**POST** `/twilio/configure-routing`

Sets how inbound calls to a number are handled. For `DIRECT` routing, supply
`directResourceType` and `directResourceId`; for `PRESS_DIGIT`, supply
`routingConfig` with a `digitToResourceMap`.

### Request parameters

- `configId` (string, required) — The phone configuration to update.
- `routingType` (string, required) — `DIRECT` or `PRESS_DIGIT`.
- `directResourceType` (string) — `DIRECT` — `AGENT`, `TOOL`, or `MANAGER`.
- `directResourceId` (string) — `DIRECT` — the resource that answers calls.
- `routingConfig` (object) — `PRESS_DIGIT` — `digitToResourceMap`: map of digit (`"1"`, `"2"`, …) to a target `{ type, id, environmentVariables, promptTemplateVariables }`, plus `locallyHostedStt`.
- `locallyHostedStt` (boolean) — Use Autessa-hosted speech-to-text (default `true`).
- `promptTemplateVariables` (object) — Values for the resource's `@@{variable}@@` prompt template placeholders.
- `environmentVariables` (object) — Environment variables passed to tool executions triggered by the call.
- `initialMessage` (string) — Static greeting spoken when an inbound call connects.
- `initialMessagePrompt` (string) — Prompt sent to the LLM to generate a dynamic greeting when the call connects. Supports `@@{variableName}@@` placeholders. Takes the place of `initialMessage` when provided.
- `conferenceParticipants` (array<string>) — Additional phone numbers dialed into the conference when an inbound call starts; each participant joins on answer.
- `clientDisplayMessage` (string) — Message shown to browser-client conference participants when they receive the call.

### Response

- `success` (boolean) — Whether the routing was applied.
- `message` (string) — Human-readable result.
- `errors` (array<string>) — Error messages, if any occurred.

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/twilio/configure-routing \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "routingType": "DIRECT",
    "directResourceType": "AGENT",
    "directResourceId": "V1StGXR8Z5",
    "initialMessage": "Thanks for calling Acme, how can I help?",
    "promptTemplateVariables": { "companyName": "Acme Corp" }
  }'
```

**JavaScript:**

```javascript
// PRESS_DIGIT menu: 1 → support agent, 2 → sales agent
await fetch(
  'https://api.autessa.com/autessa_poweruser/twilio/configure-routing',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      configId: 'pH9nR3vC6b',
      routingType: 'PRESS_DIGIT',
      routingConfig: {
        digitToResourceMap: {
          '1': { type: 'AGENT', id: 'V1StGXR8Z5' },
          '2': { type: 'AGENT', id: 'kZ3mQ9pW2x' }
        },
        locallyHostedStt: true
      }
    })
  }
);
```

**Python:**

```python
import os
import requests

requests.post(
    'https://api.autessa.com/autessa_poweruser/twilio/configure-routing',
    headers={'Authorization': os.environ['POWERUSER_KEY']},
    json={
        'configId': 'pH9nR3vC6b',
        'routingType': 'DIRECT',
        'directResourceType': 'AGENT',
        'directResourceId': 'V1StGXR8Z5',
        'initialMessage': 'Thanks for calling Acme, how can I help?'
    }
)
```

```json title="Response"
{
  "success": true,
  "message": "Routing configured successfully",
  "errors": []
}
```

---

## Update the call flow

**POST** `/twilio/update-call-flow`

Sets who answers the number: AI agents, people, a keypad menu, voicemail,
or a mix, optionally with business hours. Setting a flow changes
`routingType` to `FLOW`. Passing `callFlow: null` changes it back to
`DIRECT`, and calls go to the number's direct resource again, which is kept
while a flow is set. See [Who answers](/docs/guide/agentic/phone-numbers.md#who-answers)
for how each destination behaves.

The flow is checked before it's saved. Phone numbers must be in E.164
format, menu keys must be `0`–`9`, `*`, or `#`, times must be `HH:mm`, the
time zone must be a valid name such as `America/New_York`, and you must be
able to use every agent and multi-agent it names. A flow that fails a check
returns `400` with a plain-language message.

### Request parameters

- `configId` (string, required) — The phone configuration to update.
- `callFlow` (CallFlow | null, required) — The flow, or `null` to go back to `DIRECT` routing.

### The call flow object

- `greeting` (string) — Spoken to every caller first.
- `greetingAudio` (string) — A recording to play instead of `greeting`: an `https://` link, or an `audioUri` from [`/audio-upload-link`](#get-an-audio-upload-link).
- `businessHours` (object) — Optional. `timezone` (for example `America/Los_Angeles`), `weekly` (a list of `{ day, open, close }` with `day` from `MONDAY` to `SUNDAY` and times as `HH:mm`), `closedDates`, and `closedDestination` (a destination for calls outside those hours). Days not listed are closed all day. `closedDates` lists holidays and other days you're closed all day, each as `{ date, endDate, name }` with dates as `YYYY-MM-DD`. `endDate` is optional and makes an inclusive range, and `name` (such as `"Thanksgiving"`) is just a label. A closed date wins over `weekly`, so every call that day goes to `closedDestination`.
- `destination` (CallDestination, required) — Where calls go (during business hours, if set).

### The destination object

- `type` (string, required) — `AI_AGENT`, `AI_MULTI_AGENT`, `RING`, `MENU`, `VOICEMAIL`, or `HANG_UP`.
- `message` (string) — Spoken before the destination runs, for example "Our office is closed today."
- `messageAudio` (string) — A recording to play instead of `message`: an `https://` link, or an `audioUri` from [`/audio-upload-link`](#get-an-audio-upload-link).
- `resourceId` (string) — `AI_AGENT` / `AI_MULTI_AGENT` — the agent or multi-agent that answers. It uses the AI call settings set with [`/configure-routing`](#configure-routing).
- `ring` (object) — `RING` — rings people. See [the ring object](#the-ring-object).
- `menu` (object) — `MENU` — `prompt` (the options read to the caller), `promptAudio` (a recording to play instead), `options` (a map of key to destination, for example `{ "1": {...}, "2": {...} }`), `timeoutSeconds` (how long to wait for a key after the prompt, `2` to `30`, default `6`), `invalidMessage` (spoken when the caller presses a key that isn't an option), `noInputMessage` (spoken when they press nothing in time), `retries` (how many times to repeat the prompt), and `noInput` (a destination for when the caller never presses a valid key).
- `voicemail` (object) — `VOICEMAIL` — `greeting` (played before the beep), `greetingAudio` (a recording to play instead), `maxSeconds` (longest message, default `120`), `finishOnKey` (the key that ends the message, default `#`; `""` for none), `silenceSeconds` (seconds of silence that end the message, `1` to `30`, default `5`), and `transcribe` (default `true`).

### The ring object

- `targets` (array<object>, required) — Who to ring. Each target is `{ to, label, ringSeconds }`: `to` is a phone number in E.164 format or `client:<identity>` for a teammate's browser phone, `label` is an optional name such as `"Front desk"`, and `ringSeconds` overrides the ring time for that target.
- `strategy` (string, required) — `SIMULTANEOUS` rings everyone at once and the first to answer gets the call; `SEQUENTIAL` rings one at a time, in order.
- `ringSeconds` (integer) — How long each target rings when it has no `ringSeconds` of its own (default `20`).
- `requireKeyPress` (boolean) — The person who answers must press 1 to accept the call (default `false`). Turn it on for cell phones, so a personal voicemail that picks up can't take the caller; the call moves on as if nobody answered.
- `whisper` (string) — Spoken only to the person who answers, before they're connected, for example "Call from the sales line."
- `callerId` (string) — What the rung phone shows: `BUSINESS_NUMBER` (default) or `CALLER`. If the carrier won't show the caller's number, the business number is shown.
- `waitAudio` (string) — Played on a loop to the caller while phones ring, instead of a ringing tone: an `https://` link, or an `audioUri` from [`/audio-upload-link`](#get-an-audio-upload-link).
- `maxTotalSeconds` (integer) — `SEQUENTIAL` only. Stop ringing after this many seconds in total, even if some targets haven't rung yet.
- `noAnswer` (CallDestination) — Where the call goes when nobody answers. If it's not set, the caller goes to voicemail.

### Response

The updated [phone config object](#the-phone-config-object).

**cURL:**

```bash
curl https://api.autessa.com/autessa_poweruser/twilio/update-call-flow \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "callFlow": {
      "greeting": "Thanks for calling Acme.",
      "businessHours": {
        "timezone": "America/New_York",
        "weekly": [
          { "day": "MONDAY", "open": "09:00", "close": "17:00" },
          { "day": "FRIDAY", "open": "09:00", "close": "15:00" }
        ],
        "closedDates": [
          { "date": "2026-11-26", "endDate": "2026-11-27", "name": "Thanksgiving" }
        ],
        "closedDestination": { "type": "AI_AGENT", "resourceId": "V1StGXR8Z5" }
      },
      "destination": {
        "type": "MENU",
        "menu": {
          "prompt": "Press 1 for sales or 2 for support.",
          "timeoutSeconds": 8,
          "invalidMessage": "Sorry, that is not an option.",
          "retries": 2,
          "options": {
            "1": {
              "type": "RING",
              "ring": {
                "targets": [
                  { "to": "+14155550100", "label": "Sales desk" },
                  { "to": "+14155550101", "label": "Sam cell", "ringSeconds": 25 }
                ],
                "strategy": "SIMULTANEOUS",
                "ringSeconds": 20,
                "requireKeyPress": true,
                "whisper": "Call from the sales line.",
                "noAnswer": { "type": "VOICEMAIL" }
              }
            },
            "2": { "type": "AI_AGENT", "resourceId": "kZ3mQ9pW2x" }
          },
          "noInput": { "type": "VOICEMAIL" }
        }
      }
    }
  }'
```

**JavaScript:**

```javascript
// back to DIRECT routing
await fetch(
  'https://api.autessa.com/autessa_poweruser/twilio/update-call-flow',
  {
    method: 'POST',
    headers: {
      'Authorization': process.env.POWERUSER_KEY,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ configId: 'pH9nR3vC6b', callFlow: null })
  }
);
```

---

## Update call settings

**POST** `/twilio/update-call-settings`

Sets the number's voice and language, recording, transcripts, Call
Redaction, call limits, caller-name lookup, blocked callers, AI call
behavior, and answering machine detection. The settings apply to every call on it, incoming and
outgoing, whether an agent or a person handles it. A call already in
progress keeps the settings it started with. Calls placed with the
[Make Phone Call tool](/docs/tools/phone-sms.md#settings-for-this-call) can
override them for one call.

### Request parameters

- `configId` (string, required) — The phone configuration to update.
- `callSettings` (CallSettings, required) — The new settings. Sections you leave out use their defaults.

### The call settings object

- `speech` (object) — The voice and language for everything the number says (greetings, messages, menus, voicemail greetings, the recording disclosure, the silence prompt, and transfer announcements). `voiceModel` and `voiceName` pick a voice, in the same shape as an agent's voice; leave them out to use the answering agent's voice, or a standard voice when no agent is involved. `language` is a language code such as `en-US` or `es-US`; on AI calls it also sets the language speech recognition listens for. See [`/voice-options`](#list-voice-options) for the values you can use. `vocabulary` — extra words for calls on this number only, added to your company's [speech vocabulary](/docs/guide/agentic/phone-numbers.md#speech-vocabulary): `terms` (words to listen for, up to 200, each 2 to 60 characters) and `replacements` (an object from what is heard to what is meant, up to 200; keys 2 to 60 characters, values 1 to 60). `noiseSuppression` — **Reduce background noise**: removes background noise from the caller's audio before the AI listens to it, on AI calls on this number (default `false`).
- `transcript` (object) — `save` — keep a transcript of each call (default `true`). `retentionDays` — delete each call's transcript and voicemail transcript this many days after the call; leave it out to keep them.
- `recording` (object) — `save` — keep each call's audio (default `false`). `announcement` — the disclosure played before the call connects when recording; defaults to "This call may be recorded." and `""` plays nothing. `retentionDays` — delete each call's recording and voicemail recording this many days after the call; leave it out to keep them. Recording laws vary, and you're responsible for getting any consent they require.
- `redaction` (object) — Call Redaction, which removes personal info from recordings and transcripts before they're saved. Billed at $0.010 per audio minute, or $0.015 with health and national ID types. `enabled` (default `false`); `redact` — what to remove, any of `CARD_NUMBER`, `CARD_EXPIRY`, `CARD_CVV`, `SSN`, `BANK_ACCOUNT`, `ACCOUNT_NUMBER`, `DATE_OF_BIRTH`, `PHONE`, `EMAIL`, `ADDRESS` (default: all); `audioRedaction` — replace removed audio with `SILENCE` or `TONE`. It doesn't change the agent's conversation history, which still contains what was said live.
- `limits` (object) — `maxDurationMinutes` — end calls after this long; `maxDurationWarning` — spoken before that limit; `maxDurationWarningSeconds` — how long before the limit the warning plays (`10` to `300`, default `30`); `silenceTimeoutSeconds` — end the call after this much silence; `silencePrompt` — asked before hanging up on silence (default "Are you still there?"); `silencePromptRepeats` — how many times it's asked before the call ends (`0` to `3`, default `1`; `0` hangs up without asking).
- `callerInfo` (object) — `lookupCallerName` — look up incoming callers' names from carrier caller-ID records. The carrier charges a small fee per lookup, included in the call's price.
- `screening` (object) — Blocks unwanted incoming calls. `blockedNumbers` — phone numbers in E.164 format that can't reach this number; `rejectAnonymous` — also block callers who hide their number (default `false`); `blockedMessage` — spoken to blocked callers before hanging up. Leave `blockedMessage` out and blocked calls get a busy signal without being answered.
- `ai` (object) — How AI agents handle the conversation. `interruptions` — whether the caller can talk over the agent (default `true`); `interruptionSensitivity` — `LOW`, `MEDIUM` (default), or `HIGH`, how easily the caller's voice interrupts; `endOfTurn` — `FAST`, `NORMAL` (default), or `PATIENT`, how long the agent waits after the caller stops talking; `hangUpPhrases` — a list of phrases, and when the agent's reply contains one, the call ends after the reply plays; `passKeypresses` — whether callers can type numbers on the keypad any time (default `false`): `true` is the `ANY_TIME` keypad mode for agents whose own `listening.keypad.mode` is unset, and `false` is `OFF`. An agent's or manager's own [`listening`](/docs/api/poweruser/agents.md#listening-settings) settings win over `endOfTurn`, `passKeypresses`, and `speech.noiseSuppression`.
- `answeringMachine` (object) — Outgoing calls. `detection` — `OFF`, `ON` (tell people and answering machines apart), or `WAIT_FOR_BEEP` (also wait for the machine's beep before leaving a voicemail message); `timeoutSeconds` — how long to listen before deciding (`2` to `60`). Leave the section out and detection turns on by itself for calls that leave a voicemail message or generate their opening line.
- `callLogTableId` (string) — Read-only. Your company's Phone calls table; ignored if sent.

### Response

The updated [phone config object](#the-phone-config-object).

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/update-call-settings \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "callSettings": {
      "speech": {
        "language": "en-US",
        "vocabulary": {
          "terms": ["Dr. Okonkwo"],
          "replacements": { "doctor okon co": "Dr. Okonkwo" }
        },
        "noiseSuppression": true
      },
      "transcript": { "save": true, "retentionDays": 365 },
      "recording": { "save": true, "announcement": "This call may be recorded for quality.", "retentionDays": 90 },
      "redaction": {
        "enabled": true,
        "redact": ["CARD_NUMBER", "CARD_EXPIRY", "CARD_CVV", "SSN"],
        "audioRedaction": "TONE"
      },
      "limits": {
        "maxDurationMinutes": 30,
        "maxDurationWarning": "We need to wrap up in a minute.",
        "maxDurationWarningSeconds": 60,
        "silenceTimeoutSeconds": 20,
        "silencePromptRepeats": 2
      },
      "callerInfo": { "lookupCallerName": true },
      "screening": { "blockedNumbers": ["+15555550123"], "rejectAnonymous": true },
      "ai": {
        "interruptionSensitivity": "LOW",
        "endOfTurn": "PATIENT",
        "hangUpPhrases": ["Have a great day"]
      }
    }
  }'
```

---

## Update the text flow

**POST** `/twilio/update-text-flow`

Sets how texts to the number are handled: by an AI agent or with no AI,
optionally with business hours, auto-replies, and keyword replies. Texts
follow this setting whatever the number's call routing is. See
[Texts](/docs/guide/agentic/phone-numbers.md#texts) for what each setting
does.

Passing `textFlow: null` goes back to the default: if the number sends
calls straight to one AI agent, that agent answers texts; otherwise texts
get no reply and are saved to the
[shared inbox](/docs/guide/agentic/phone-numbers.md#the-shared-inbox) and the
[Text messages table](/docs/guide/agentic/phone-numbers.md#the-text-messages-table).

**STOP**, **START**, and **HELP** are always handled first for compliance,
before keyword replies or anything else, and can't be changed here.

The flow is checked before it's saved, the same way as a
[call flow](#update-the-call-flow): times must be `HH:mm`, the time zone
must be a valid name, and you must be able to use any agent it names. A
flow that fails a check returns `400` with a plain-language message.

### Request parameters

- `configId` (string, required) — The phone configuration to update.
- `textFlow` (TextFlow | null, required) — The text flow, or `null` for the default.

### The text flow object

- `keywordReplies` (array<object>) — Fixed replies to specific words, each `{ keyword, reply }`. A text matches when the whole message equals `keyword`, ignoring capital letters and spaces around it. Checked before `open` or `closed`, at any hour and whoever answers. A matching text gets `reply` and goes no further.
- `businessHours` (object | null) — Hours just for texts: `timezone`, `weekly`, and optional `closedDates`, in the same shape as a call flow's [`businessHours`](#the-call-flow-object), without `closedDestination` (use `closed` instead). Leave out for no hours.
- `useCallFlowHours` (boolean) — `true` uses the business hours of the number's [call flow](#update-the-call-flow) instead of `businessHours`, so the two always match.
- `open` (TextHandling, required) — How texts are handled during business hours, or at all times when there are no hours.
- `closed` (TextHandling) — How texts are handled outside business hours. Leave out to handle them the same as `open`.

### The text handling object

- `type` (string, required) — `AI_AGENT` (an agent answers) or `NO_AI` (texts wait in the shared inbox for your team).
- `resourceId` (string) — `AI_AGENT` — the agent that answers. Leave out to use the agent the number sends calls to directly.
- `autoReply` (object) — `NO_AI` only — an automatic reply: `message` (the text to send) and `onceEveryHours` (send it to the same person at most once in this many hours; default `24`, `0` replies to every text, at most `720`).

### Response

- `config` (object) — The updated [phone config object](#the-phone-config-object), with the new `textFlow`.
- `permission` (string) — Your permission level on the number.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/update-text-flow \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "textFlow": {
      "keywordReplies": [
        { "keyword": "HOURS", "reply": "We are open Monday to Friday, 9 to 5." }
      ],
      "useCallFlowHours": true,
      "open": {
        "type": "NO_AI",
        "autoReply": {
          "message": "Thanks for your message. We will text you back shortly.",
          "onceEveryHours": 24
        }
      },
      "closed": { "type": "AI_AGENT", "resourceId": "V1StGXR8Z5" }
    }
  }'
```

---

## List calls

**POST** `/twilio/get-calls`

Returns the number's calls, newest first, from your company's
[Phone calls table](/docs/guide/agentic/phone-numbers.md#the-phone-calls-table).
Incoming and outgoing calls are both included, with or without AI.

### Request parameters

- `configId` (string, required) — The phone configuration whose calls to list.
- `limit` (integer) — Calls per page, up to `50` (default `10`).
- `after` (string) — The `next` value from the previous page.

### Response

- `tableId` (string | null) — The Phone calls AutessaDB table, or `null` if no call has been logged yet. You can query it with the [AutessaDB API](/docs/api/poweruser/autessadb-tables.md).
- `calls` (array<object>) — The calls on this page. Each has `rowId` (its row in the table), `callId`, `direction` (`INBOUND` or `OUTBOUND`), `businessNumber`, `otherNumber`, `callerName`, `callerLocation`, `forwardedFrom`, `handledBy`, `conversationId` (the agent conversation, for AI calls), `startedAt` and `endedAt` (UTC, ISO-8601), `durationSeconds`, `status`, `answeredBy`, `endedBy`, `transferredTo`, `keypadResponse`, `transcript`, `recordingUrl`, `voicemailRecordingUrl`, `voicemailTranscript`, `redactionStatus`, and `processingError`. The recording links are valid for 10 minutes. See the guide for the [values of each column](/docs/guide/agentic/phone-numbers.md#the-phone-calls-table).
- `next` (string | null) — Pass as `after` to get the next page; `null` on the last page.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/get-calls \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b", "limit": 1 }'
```

```json title="Response"
{
  "tableId": "tB7xQ2mL9k",
  "calls": [
    {
      "rowId": "r8KdW2pQ5n",
      "callId": "c3Vt9LmX2a",
      "direction": "INBOUND",
      "businessNumber": "+12065550142",
      "otherNumber": "+14155550100",
      "callerName": "JANE DOE",
      "callerLocation": "San Francisco, CA, US",
      "forwardedFrom": null,
      "handledBy": "Front desk agent",
      "conversationId": "cv5Hn7Rt2w",
      "startedAt": "2026-10-09T17:02:11Z",
      "endedAt": "2026-10-09T17:05:48Z",
      "durationSeconds": 217,
      "status": "COMPLETED",
      "answeredBy": "HUMAN",
      "endedBy": "AGENT",
      "transferredTo": null,
      "keypadResponse": null,
      "transcript": "Agent: Thanks for calling Acme, how can I help?\nCaller: I'd like to move my appointment...",
      "recordingUrl": "https://...",
      "voicemailRecordingUrl": null,
      "voicemailTranscript": null,
      "redactionStatus": "DONE",
      "processingError": null
    }
  ],
  "next": "eyJzIjoiMjAyNi0xMC0wOVQxNzowMjoxMVoifQ"
}
```

---

## Set an automation

**POST** `/twilio/set-automation`

Turns one of the number's quick automations on or off. Each automation is
a regular trigger on the Phone calls table (or, for forwarding texts, the
Text messages table) that runs a regular tool, so you can see and edit it
like any other. Turning one off disables its trigger
without deleting it, and turning it back on reuses it.

- **`TEXT_BACK_MISSED_CALLS`** — texts the caller from this number when an
  incoming call isn't answered, is busy, or goes to voicemail. The number
  must be able to text.
- **`EMAIL_VOICEMAILS`** — emails the voicemail transcript and a link to
  the call when a caller leaves a voicemail.
- **`FORWARD_TEXTS_SMS`** — texts every incoming text on to up to 5 phones,
  as "From +14155550100: " followed by the message. The forwarded texts
  are sent from this number, so it must be able to text and the phones
  must be allowed to receive texts from it (texting the number once from
  each phone is enough). Texts from those phones are never forwarded.
- **`FORWARD_TEXTS_EMAIL`** — emails every incoming text to up to 5
  people.

### Request parameters

- `configId` (string, required) — The phone configuration.
- `automation` (string, required) — `TEXT_BACK_MISSED_CALLS`, `EMAIL_VOICEMAILS`, `FORWARD_TEXTS_SMS`, or `FORWARD_TEXTS_EMAIL`.
- `enabled` (boolean, required) — Turn the automation on or off.
- `smsMessage` (string) — `TEXT_BACK_MISSED_CALLS` — the text to send.
- `emails` (array<string>) — `EMAIL_VOICEMAILS` and `FORWARD_TEXTS_EMAIL` — who gets the email, up to 5 addresses.
- `phones` (array<string>) — `FORWARD_TEXTS_SMS` — the phones to forward texts to, up to 5, in E.164 format.

### Response

The updated [phone config object](#the-phone-config-object), with the
automation's state in `automations`.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/set-automation \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "automation": "TEXT_BACK_MISSED_CALLS",
    "enabled": true,
    "smsMessage": "Sorry we missed your call. We will call you back shortly."
  }'
```

---

## Get an audio upload link

**POST** `/twilio/audio-upload-link`

Uploads your own recording, such as a greeting, menu prompt, voicemail
greeting, or hold music, for use in a number's call flow. It takes three
steps:

1. **Get a link.** Call this endpoint with the number and the file type.
   The response has an `uploadUrl`, an `audioUri`, and a `contentType`.
2. **Upload the file.** Send the audio file's bytes with an HTTP `PUT` to
   `uploadUrl`, with a `Content-Type` header set to exactly the
   `contentType` from step 1. Any other content type is refused. Upload
   before `expiresInSeconds` runs out, or get a new link.
3. **Use it.** Save `audioUri` into an audio field with
   [`/update-call-flow`](#update-the-call-flow): `greetingAudio`,
   `messageAudio`, a menu's `promptAudio`, a voicemail's `greetingAudio`,
   or a ring's `waitAudio`. Audio fields also accept your own `https://`
   links, so this step-by-step upload is only needed for files you don't
   host.

When an audio field is set, it plays instead of the matching text. The
[phone config object](#the-phone-config-object) returns a playable link for
each uploaded file in `audioPreviewUrls`.

### Request parameters

- `configId` (string, required) — The phone configuration the recording is for.
- `fileType` (string, required) — `mp3` or `wav`.

### Response

- `uploadUrl` (string) — Where to `PUT` the file. It expires after `expiresInSeconds`.
- `audioUri` (string) — The key to save in an audio field once the upload is done. Audio fields also still accept the older `s3://` form.
- `contentType` (string) — The `Content-Type` header to send with the upload, for example `audio/mpeg`.
- `expiresInSeconds` (integer) — How long `uploadUrl` stays valid.

```bash title="1. Get a link"
curl https://api.autessa.com/autessa_poweruser/twilio/audio-upload-link \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b", "fileType": "mp3" }'
```

```json title="Response"
{
  "uploadUrl": "https://...",
  "audioUri": "phone-audio/1024/8f3a2b7c.mp3",
  "contentType": "audio/mpeg",
  "expiresInSeconds": 900
}
```

```bash title="2. Upload the file"
curl "$UPLOAD_URL" \
  -X PUT \
  -H "Content-Type: audio/mpeg" \
  --data-binary @greeting.mp3
```

```bash title="3. Use it as the greeting"
curl https://api.autessa.com/autessa_poweruser/twilio/update-call-flow \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "callFlow": {
      "greeting": "Thanks for calling Acme.",
      "greetingAudio": "phone-audio/1024/8f3a2b7c.mp3",
      "destination": { "type": "AI_AGENT", "resourceId": "V1StGXR8Z5" }
    }
  }'
```

---

## List voice options

**POST** `/twilio/voice-options`

Lists the languages and voices you can use in a number's `speech`
[call settings](#the-call-settings-object). It takes no parameters; send
an empty JSON object.

### Response

- `languages` (array<object>) — The supported languages, each with `code` (the value for `speech.language`, such as `en-US`), `label` (a readable name such as "English (US)"), `liveAi` (`true` when the AI understands callers in it on any call, which is English only), and `liveAiWhenConfigured` (`true` when the AI understands callers in it once the answering agent or manager has it in its `languages`: `en-US`, `en-GB`, `es-US`, and `es-ES` only). Every other language, such as French or Chinese (Mandarin), works for the number's own messages, menus, ringing people, and voicemail, but not for AI conversations.
- `voices` (array<object>) — The voices you can pick, the same list agents offer, including your company's custom voices. Use a voice's model and name as `speech.voiceModel` and `speech.voiceName`.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/voice-options \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

---

## List all phone configs

**POST** `/twilio/get-all-configs`

Lists every phone configuration visible to the linked user.

### Request parameters

None — send an empty object `{}`.

### Response

- `configs` (array<PhoneConfig>) — The phone configurations, each in the [phone config object](#the-phone-config-object) shape.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/get-all-configs \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

```json title="Response"
{
  "configs": [
    {
      "configId": "pH9nR3vC6b",
      "phoneNumber": "+12065550142",
      "routingType": "DIRECT",
      "directResourceType": "AGENT",
      "directResourceId": "V1StGXR8Z5",
      "sharingLevel": "COMPANY",
      "isActive": true,
      "createdAt": "2026-06-01T14:22:05"
    }
  ],
  "errors": []
}
```

---

## Get a phone config

**POST** `/twilio/get-config`

Retrieves one phone configuration, including its full routing details and
the calling user's access level.

### Request parameters

- `configId` (string, required) — The phone configuration to fetch.

### Response

- `config` (PhoneConfig) — The [phone config object](#the-phone-config-object).
- `permission` (string) — The calling user's access level on this config: `READ`, `WRITE`, `PUBLISH`, or `ADMIN`.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/get-config \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b" }'
```

```json title="Response (truncated)"
{
  "config": {
    "configId": "pH9nR3vC6b",
    "phoneNumber": "+12065550142",
    "routingType": "DIRECT",
    "directResourceType": "AGENT",
    "directResourceId": "V1StGXR8Z5",
    "isActive": true
  },
  "permission": "ADMIN",
  "errors": []
}
```

---

## Release a phone number

**POST** `/twilio/release-number`

Releases the number back to the carrier and deactivates the configuration.
Inbound calls to the number stop working immediately, and the number cannot
be recovered — buy a new one with [`/purchase-number`](#purchase-a-phone-number) if
needed. Any monthly texting fee stops from the next month. A hosted number stops being hosted. A number linked from your own
Twilio account is only unlinked — it stays in your Twilio account.

### Request parameters

- `configId` (string, required) — The phone configuration whose number to release.

### Response

- `success` (boolean) — Whether the release succeeded.
- `message` (string) — Human-readable result.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/release-number \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b" }'
```

```json title="Response"
{
  "success": true,
  "message": "Phone number released successfully",
  "errors": []
}
```

---

## Turn on texting for a number

**POST** `/twilio/sms/attach-number`

Turns on texting for a number by adding it to your company's
[Text Messaging registration](/docs/guide/agentic/sms-setup.md). This starts the
number's **monthly texting fee**, charged to your company's card on file — a
card is required, and the call fails with `PAYMENT_METHOD_REQUIRED` without
one. The number texts, and is billed, once the registration is approved; if it
already is, that happens right away. The fee amount is shown on the number's
page in the web app.

Use [`/sms/detach-number`](#turn-off-texting-for-a-number) to turn texting off.

### Request parameters

- `configId` (string, required) — The phone configuration to turn texting on for.

### Response

- `success` (boolean) — Whether texting was turned on.
- `message` (string) — Human-readable result.
- `config` (PhoneConfig) — The number after the change, with its updated texting status.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/sms/attach-number \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b" }'
```

---

## Turn off texting for a number

**POST** `/twilio/sms/detach-number`

Turns texting off for a number. The number keeps working for calls, and its
monthly texting fee stops from the next month.

### Request parameters

- `configId` (string, required) — The phone configuration to turn texting off for.

### Response

Same shape as [`/sms/attach-number`](#turn-on-texting-for-a-number).

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/sms/detach-number \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b" }'
```

---

## Send a text message

**POST** `/twilio/sms/send`

Sends one text from a company number to a US number. The message reaches a
real person, so it's checked first: your company needs a finished
[Text Messaging registration](/docs/guide/agentic/sms-setup.md) (or the number
comes from your own connected Twilio account), and the recipient needs an
approved [consent record](/docs/guide/agentic/sms-consent.md) or a text to you
within the last year. People who replied STOP are never texted. Requires
write access to the phone configuration.

A refused text still returns `200`: `success` is `false`, `errorCode` says why,
and `errorMessage` explains it in plain language. The codes are the same as the
[Send SMS tool's](/docs/tools/phone-sms.md#send-sms-).

### Request parameters

- `configId` (string, required) — The phone configuration to text from.
- `to` (string, required) — The recipient's US number; `(415) 555-0100` and `+14155550100` are both accepted.
- `body` (string, required) — The message text, at most 1600 characters.

### Response

- `success` (boolean) — Whether the carrier accepted the text.
- `messageId` (string) — Autessa's ID for the logged message.
- `twilioMessageSid` (string) — The carrier's identifier for the message.
- `status` (string) — `QUEUED`, `ACCEPTED`, `SENDING`, or `SENT` when accepted; `BLOCKED` or `FAILED` when not sent. Delivery shows later in [`/sms/messages`](#list-text-messages).
- `from` (string) — The sending number in E.164 format.
- `to` (string) — The recipient in E.164 format.
- `segments` (integer) — How many SMS segments the message used, when known.
- `errorCode` (string) — Why the text wasn't sent — only when `success` is `false`.
- `errorMessage` (string) — Plain-language explanation of `errorCode`.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/sms/send \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "configId": "pH9nR3vC6b",
    "to": "+14155550100",
    "body": "Hi Sam, your order has shipped. Reply STOP to opt out."
  }'
```

```json title="Response"
{
  "success": true,
  "messageId": "mS4kT8wQ2n",
  "twilioMessageSid": "SMa1b2c3d4e5f60718293a4b5c6d7e8f90",
  "status": "QUEUED",
  "from": "+12065550142",
  "to": "+14155550100",
  "segments": 1,
  "errors": []
}
```

```json title="Response (refused)"
{
  "success": false,
  "errorCode": "CONSENT_REQUIRED",
  "errorMessage": "This person hasn't agreed to receive texts from you. Submit their consent under Phone & Texting, Who you can text, or wait for them to text you first.",
  "errors": []
}
```

---

## List text messages

**POST** `/twilio/sms/messages`

Lists a number's text messages, newest first — incoming texts, replies, and
sends that were refused, with the reason. The other party's number is masked.
Company owners can omit `configId` to list every company number.

### Request parameters

- `configId` (string) — The phone configuration whose messages to list.
- `pageSize` (integer) — Messages per page (default 25, at most 100).
- `cursor` (string) — The previous page's `nextCursor`; omit for the first page.

### Response

- `messages` (array<object>) — The page of messages: `messageId`, `configId`, `direction` (`INBOUND` or `OUTBOUND`), `origin`, `status`, `ourNumber`, `counterparty` (masked), `body`, `segments`, `errorCode`, `errorMessage`, `twilioMessageSid`, `createdAt`, and `statusUpdatedAt`.
- `nextCursor` (string) — Pass as `cursor` to get the next page; absent on the last page.
- `errors` (array<string>) — Error messages, if any occurred.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/sms/messages \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b", "pageSize": 25 }'
```

```json title="Response (truncated)"
{
  "messages": [
    {
      "messageId": "mS4kT8wQ2n",
      "configId": "pH9nR3vC6b",
      "direction": "OUTBOUND",
      "origin": "SDK",
      "status": "DELIVERED",
      "ourNumber": "+12065550142",
      "counterparty": "+1415•••0100",
      "body": "Hi Sam, your order has shipped. Reply STOP to opt out.",
      "segments": 1,
      "createdAt": "2026-09-22T17:42:10Z"
    }
  ],
  "nextCursor": "eyJvZmZzZXQiOjI1fQ",
  "errors": []
}
```

---

## List text threads

**POST** `/twilio/sms/threads`

Lists the number's [shared inbox](/docs/guide/agentic/phone-numbers.md#the-shared-inbox):
one thread per person who has texted the number or been texted from it,
with the most recent activity first. Read a thread's messages with
[`/sms/thread`](#get-a-text-thread), and reply with
[`/sms/send`](#send-a-text-message).

### Request parameters

- `configId` (string, required) — The phone configuration whose inbox to list.
- `limit` (integer) — Threads per page, up to `50` (default `20`).
- `after` (string) — The `next` value from the previous page.

### Response

- `threads` (array<object>) — The threads on this page. Each has `otherNumber` (the person's number in E.164 format), `lastBody` and `lastDirection` (`INBOUND` or `OUTBOUND`) of the latest text, `lastAt` (UTC, ISO-8601), and `messageCount`.
- `next` (string | null) — Pass as `after` to get the next page; `null` on the last page.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/sms/threads \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b", "limit": 20 }'
```

```json title="Response"
{
  "threads": [
    {
      "otherNumber": "+14155550100",
      "lastBody": "Is the shop open Saturday?",
      "lastDirection": "INBOUND",
      "lastAt": "2026-10-09T17:02:11Z",
      "messageCount": 4
    }
  ],
  "next": null
}
```

---

## Get a text thread

**POST** `/twilio/sms/thread`

Returns the texts between the number and one person, newest first.

### Request parameters

- `configId` (string, required) — The phone configuration.
- `otherNumber` (string, required) — The person's number, as returned in `otherNumber` by [`/sms/threads`](#list-text-threads).
- `limit` (integer) — Messages per page, up to `200` (default `50`).
- `before` (string) — The `next` value from the previous page, to load older messages.

### Response

- `messages` (array<object>) — The messages on this page. Each has `id`, `direction` (`INBOUND` or `OUTBOUND`), `body`, `sentAt` (UTC, ISO-8601), `status`, and `handledBy` (the agent's name, `Auto-reply`, `Keyword reply`, `Staff:` and the teammate's name, or `Automation`).
- `next` (string | null) — Pass as `before` to get older messages; `null` when there are none.

To reply, use [`/sms/send`](#send-a-text-message) with the same `configId`
and `otherNumber` as `to`. The reply is sent as the business number and
shows up in the thread with `handledBy` set to `Staff:` and your name. It's
checked like any other text: the number must be able to text, and the
person must not have opted out and must have texted you within the last
year or have an approved consent record.

```bash title="cURL"
curl https://api.autessa.com/autessa_poweruser/twilio/sms/thread \
  -X POST \
  -H "Authorization: $POWERUSER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "configId": "pH9nR3vC6b", "otherNumber": "+14155550100", "limit": 2 }'
```

```json title="Response"
{
  "messages": [
    {
      "id": "mT7rQ2kW9p",
      "direction": "OUTBOUND",
      "body": "Yes, 10 to 2 on Saturdays.",
      "sentAt": "2026-10-09T17:05:40Z",
      "status": "DELIVERED",
      "handledBy": "Staff: Dana Lee"
    },
    {
      "id": "mS4kT8wQ2n",
      "direction": "INBOUND",
      "body": "Is the shop open Saturday?",
      "sentAt": "2026-10-09T17:02:11Z",
      "status": "RECEIVED",
      "handledBy": null
    }
  ],
  "next": "eyJiIjoiMjAyNi0xMC0wOVQxNzowMjoxMVoifQ"
}
```

---

## Errors

| Status | When |
|--------|------|
| `200` | Success — check `success` and `errors` for operation-level failures (no numbers available, invalid routing target, a refused text). |
| `400` | A call flow, text flow, call settings, or automation request failed a check (for example a phone number not in E.164 format, or an agent you can't use). The message says what to fix. |
| `401` | Invalid or missing poweruser key, or the linked user lacks access to the config. |
| `403` | Scoped key without the endpoint in its allow-list. |
| `408` | Server-side error; `errors` contains the message. |

---

## Related

- [Poweruser API overview](/docs/api/poweruser.md)
- [Agents (Poweruser API)](/docs/api/poweruser/agents.md)
- [SMS Consent (Poweruser API)](/docs/api/poweruser/sms-consent.md)
- [Text Messaging setup](/docs/guide/agentic/sms-setup.md)
- [Phone numbers guide](/docs/guide/agentic/phone-numbers.md)

