Skip to content

Make an outbound AI call

You need a secret key (af_sk_test_...) and the id of an assistant (agt_..., listed in the console and at GET /v1/agents).

Terminal window
curl https://api.airfone.app/v1/calls \
-H "Authorization: Bearer af_sk_test_..." \
-H "Idempotency-Key: order-1042-reminder" \
-H "Content-Type: application/json" \
-d '{
"to": "+9779800000001",
"agent_id": "agt_7Qm2",
"context": { "order_id": "1042", "delivery_date": "2026-10-06" },
"metadata": { "crm_ticket": "T-881" }
}'
{ "id": "call_9f3a", "status": "queued", "to": "+9779800000001", "livemode": false }

context is given to the assistant for this call only. metadata is yours. It comes back on every webhook about the call.

In test mode the call is simulated: no phone rings, and the assistant talks to a scripted caller. You get the same webhooks as a real call.

Subscribe to call.started, call.ended and call.transferred (Receive webhooks), or poll GET /v1/calls/call_9f3a. When the call ends, fetch the transcript:

Terminal window
curl https://api.airfone.app/v1/calls/call_9f3a/transcript -H "Authorization: Bearer af_sk_test_..."
  • POST /v1/calls/{id}/transfer with {"to": "+9771..."} hands the call to a person.
  • POST /v1/calls/{id}/end ends it.