Skip to content

Outbound calls ​

1 endpoint. Every path below is relative to the API base URL and already includes the /api/v1 prefix — see conventions for authentication, pagination, errors and idempotency.

Endpoint
POST/telephony/callsOriginate an outbound call directly through the carrier after policy, routing, caller-ID and concurrency checks

Endpoints ​

Originate an outbound call directly through the carrier after policy, routing, caller-ID and concurrency checks ​

POST/telephony/calls
  • No scope is enforced in the handler — any valid key may call it.
  • Request body is camelCase (assistantId, phoneNumberId, callerId, answeringMachineDetection, idempotencyKey); the response is snake_case. Also returns 429 on concurrency limit

Request body

FieldTypeRequiredNotes
assistantIdstring | null—max 32 chars
squadIdstring | null—max 32 chars
phoneNumberIdstring | null—
phoneNumberstring | null—max 32 chars
sipTrunkIdstring | null—
customerIdstring | null—max 32 chars
campaignIdstring | null—max 32 chars
customerobject—
customer.numberstring | null—max 64 chars
customer.namestring | null—max 255 chars
tostring | null—max 64 chars
callerIdstring | null—max 32 chars
variablesstring[] | null—
metadatastring[] | null—
assistantOverridesstring[] | null—
customSipHeadersstring[] | null—
answeringMachineDetectionboolean | null—
recordingModedisabled · mono · dual_channel · inherit · null | null—
timeoutSecondsinteger | null—min 5. max 600
scheduledAtstring | null—date-time
idempotencyKeystring | null—max 128 chars
bash
curl -X POST "$CALLAGENT_API_URL/telephony/calls" \
  -H "Authorization: Bearer $CALLAGENT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
       "phoneNumberId": "+40712345678",
       "phoneNumber": "+40712345678",
       "customer": {
         "number": "+40712345678",
         "name": "Support Line"
       },
       "to": "+40712345678",
       "answeringMachineDetection": true,
       "recordingMode": "disabled",
       "timeoutSeconds": 30
     }'
js
const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/calls`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "phoneNumberId": "+40712345678",
    "phoneNumber": "+40712345678",
    "customer": {
      "number": "+40712345678",
      "name": "Support Line"
    },
    "to": "+40712345678",
    "answeringMachineDetection": true,
    "recordingMode": "disabled",
    "timeoutSeconds": 30
  }),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`${error.type}: ${error.message}`);
}

const { data } = await response.json();
php
<?php

$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/calls');

curl_setopt_array($handle, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
        'Accept: application/json',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
    'phoneNumberId' => '+40712345678',
    'phoneNumber' => '+40712345678',
    'customer' => [
        'number' => '+40712345678',
        'name' => 'Support Line',
    ],
    'to' => '+40712345678',
    'answeringMachineDetection' => true,
    'recordingMode' => 'disabled',
    'timeoutSeconds' => 30,
]),
]);

$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);

if ($status >= 400) {
    throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}

$data = $body['data'];
python
import os, requests

response = requests.post(
    f"{os.environ['CALLAGENT_API_URL']}/telephony/calls",
    headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
    json={
      "phoneNumberId": "+40712345678",
      "phoneNumber": "+40712345678",
      "customer": {
        "number": "+40712345678",
        "name": "Support Line"
      },
      "to": "+40712345678",
      "answeringMachineDetection": True,
      "recordingMode": "disabled",
      "timeoutSeconds": 30
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()["data"]

Responses

StatusBody
200JSON object
201data-wrapped object

Errors

StatusWhen it happens
403Destination policy or an outbound route blocks it, or the caller ID is not owned
404The given phoneNumberId or sipTrunkId does not exist in this organization
422Validation failed, no destination was given, or nothing routes to the destination
501The resolved telephony provider has no outbound-call implementation
502The carrier rejected or failed the origination request

Example response, generated from the schema:

json
"string"

Documented against the code. Anything not yet implemented is labelled, never described as working.