REST API reference

Five endpoints: list your numbers, place a call, read its transcript, send a text, and read the thread. Plus the key-management endpoints behind your normal login.

Authentication

Every request carries your API key, in either spelling:

X-API-Key: a2l_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# or, for frameworks that only speak this header:
Authorization: Bearer a2l_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

The key comes from the console or the app (Settings › Your Agent › Agent API key) and is shown exactly once.

Numbers

GET /agent/numbers

Which of your lines this key may act on. Call it first rather than guessing.

{ "numbers": [ { "numberId": "10", "e164": "+14709120899", "label": "Business" } ] }

Calls

POST /agent/calls/outbound

{
  "numberId": "10",
  "to": "+14155551234",
  "objective": "Ask whether they're open Saturday and what time they close."
}

objective is required (up to 2000 characters). It is what the AI works toward and how it knows the call is finished — nobody is on the line to hang up — and it is the record of what your agent phoned someone about.

Optional mode: autonomous (default) or command-gated. Use command-gated only when a human is also joining the call; with no operator present it produces a permanently silent assistant.

201 { "room": "rm_...", "status": "originating", "mode": "autonomous",
      "from": "+14709120899", "to": "+14155551234" }

GET /agent/calls/:room

Status and transcript. Only finalised speech is returned — live transcription revises itself mid-sentence, and an agent acting on interim text acts on words nobody said.

{ "status": "live", "objective": "Ask whether they're open Saturday",
  "transcript": [ { "speaker": "callee", "text": "We close at four.", "at": 1767... } ] }

Messages

POST /agent/messages

{ "numberId": "10", "to": "+14155551234", "body": "Running late, there at 3." }

Goes through the same carrier compliance checks as the app's own send, and lands in the same conversation thread you read in the app. Max 1600 characters.

GET /agent/messages

Read recent SMS/MMS, oldest first. This is how an agent sees replies — without it, sending is a one-way radio, because whatever people text back lands in the app's inbox. Read-only: it does not clear the unread badge in the app.

Query paramMeans
numberIdOnly this line. From /agent/numbers.
counterpartyOnly the thread with this E.164 number.
limit1–100, default 25.
sinceISO 8601 timestamp; only messages after it. Use the at of the last one you saw.
waitSeconds1–45. Long-poll: wait up to this long for a NEW message instead of returning an empty list. Requires since.
{ "messages": [ {
  "id": 812, "direction": "inbound", "channel": "sms",
  "counterparty": "+14155551234", "body": "See you at 3!",
  "at": "2026-11-30T17:04:11.000Z",
  "hasMedia": false, "media": [], "mediaMissing": 0
} ] }

Pictures come back as short-lived URLs in media.

Key management

Key management uses your normal app login, never the key itself — a leaked key must not be able to mint its own replacement and turn into permanent access.

MethodPathDoes
GET/agent-keyWhether a key exists, when it was made, when it was last used. Never returns the key.
POST/agent-keyCreate a key, replacing any existing one. The only time the key is returned.
DELETE/agent-keyRevoke it. Takes effect immediately.

Errors

StatusCodeMeans
401invalid_api_keyMissing, wrong, or revoked key.
400objective_requiredA call with no stated purpose.
400invalid_numberto (or counterparty) isn't a dialable number.
403a2p_registration_requiredThat line isn't cleared for texting yet.
404—The number or call isn't yours. Ownership failures are 404, never 403 — the API does not confirm what exists.
429rate_limited30 calls or 100 texts an hour. Carries retryAfterSeconds.
402ai_minutes_exhaustedYou're out of AI minutes for the month. Top up or wait for renewal.

Prefer tools over HTTP? The whole surface is also an MCP server at https://www.ai2ndline.com/mcp — same key, same rules.