Skip to content

Calls

Calls, recordings and transcripts use three key scopes: calls, recordings and transcripts. A key with only calls:read cannot read recordings or transcripts.

Terminal window
curl "https://app.airfone.app/v1/calls?limit=10&missed=true" \
-H "Authorization: Bearer $AIRFONE_KEY"
{
"data": [
{
"id": "6f1c...",
"kind": "pstn",
"status": "missed",
"started_at": "2026-10-12T04:10:00Z",
"ended_at": "2026-10-12T04:10:20Z",
"duration_seconds": 20,
"number": "+9779800000000",
"contact_id": null,
"contact_name": null,
"transcript_lines": 0
}
],
"has_more": false,
"next_cursor": null
}

Pass next_cursor as cursor to get the next page. q searches words said on the call or part of a number.

Terminal window
curl https://app.airfone.app/v1/calls/$CALL_ID -H "Authorization: Bearer $AIRFONE_KEY"

The assistant calls the number and talks about the agenda. This needs calls:write.

Terminal window
curl https://app.airfone.app/v1/calls \
-H "Authorization: Bearer $AIRFONE_KEY" \
-H "Content-Type: application/json" \
-d '{"to": "+9779800000000", "agenda": "Confirm tomorrow'"'"'s 10am delivery."}'
{ "id": "b2d9...", "to": "+9779800000000", "status": "queued", "call_at": null, "livemode": true }

The id is the id of the request. The call shows up in the list once it is dialled. Calling hours and the do-not-call list apply. If the workspace has no credit to spend, the response is 402 with code insufficient_credit.

With a test key nothing is dialled. The status is simulated and livemode is false.

Terminal window
curl -X POST https://app.airfone.app/v1/calls/$CALL_ID/hangup \
-H "Authorization: Bearer $AIRFONE_KEY"

Returns 204. Needs calls:write.

Needs recordings:read. Recordings are deleted at expires_at.

Terminal window
curl "https://app.airfone.app/v1/recordings?call_id=$CALL_ID" -H "Authorization: Bearer $AIRFONE_KEY"
curl https://app.airfone.app/v1/recordings/$RECORDING_ID/download -H "Authorization: Bearer $AIRFONE_KEY"
{ "url": "https://...", "content_type": "audio/mpeg", "duration_ms": 61250, "expires_in": 300 }

The link is made on each request and stops working after expires_in seconds. Ask again when it expires.

Needs transcripts:read.

Terminal window
curl https://app.airfone.app/v1/transcripts/$CALL_ID -H "Authorization: Bearer $AIRFONE_KEY"
{
"call_id": "6f1c...",
"turns": [
{ "seq": 1, "speaker": "assistant", "text": "Hello, how can I help?", "language": "en",
"confidence": 0.97, "started_at": "2026-10-12T04:10:02Z", "ended_at": "2026-10-12T04:10:05Z" }
]
}

speaker is caller, assistant or agent. Use after_seq to read only new turns while a call is on.