Skip to content

Bulk calls and forms

A campaign calls a list of people with the same purpose. If you attach a form, every call asks its questions and records the answers.

Keys need the campaigns scope for campaigns and the forms scope for forms. Creating and launching need an admin key.

Terminal window
curl https://app.airfone.app/v1/campaigns \
-H "Authorization: Bearer $AIRFONE_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Dashain greetings",
"purpose": "greeting",
"agenda": "Wish the customer a happy Dashain and ask if they need anything.",
"form_id": "FORM_ID"
}'

The campaign starts as a draft. Calls go out between 09:00 and 19:00 Kathmandu time unless you set window_start, window_end and timezone.

Terminal window
curl -X PUT https://app.airfone.app/v1/campaigns/CAMPAIGN_ID/message \
-H "Authorization: Bearer $AIRFONE_KEY" \
-H "Content-Type: application/json" \
-d '{"type": "ai", "instructions": "Be brief and polite.", "goals": ["Ask about delivery"]}'

The message is reviewed before launch. Read review in the response.

Terminal window
curl https://app.airfone.app/v1/campaigns/CAMPAIGN_ID/audience \
-H "Authorization: Bearer $AIRFONE_KEY" \
-H "Idempotency-Key: audience-1" \
-H "Content-Type: application/json" \
-d '{"numbers": ["9801234567", "9807654321"], "groups": ["GROUP_ID"]}'

You get 202. People are added in the background. Read /stats to see total_contacts.

Terminal window
curl -X POST https://app.airfone.app/v1/campaigns/CAMPAIGN_ID/launch \
-H "Authorization: Bearer $AIRFONE_KEY"

Pass {"starts_at": "2026-10-20T04:00:00Z"} to start later. Launching a running campaign again changes nothing.

Bulk calls are paid from added credit, not free credit. Without it, launch returns 402. Test keys cannot launch: they never dial real numbers.

POST /v1/campaigns/CAMPAIGN_ID/pause stops new calls. POST /v1/campaigns/CAMPAIGN_ID/cancel ends the campaign for good.

Terminal window
curl https://app.airfone.app/v1/campaigns/CAMPAIGN_ID/stats \
-H "Authorization: Bearer $AIRFONE_KEY"
curl "https://app.airfone.app/v1/campaigns/CAMPAIGN_ID/results?state=done&limit=50" \
-H "Authorization: Bearer $AIRFONE_KEY"

Results list one row per person with state, attempts, outcome and the call_id. Page with starting_after, as described in pagination.

Terminal window
curl https://app.airfone.app/v1/forms/FORM_ID \
-H "Authorization: Bearer $AIRFONE_KEY"
curl "https://app.airfone.app/v1/forms/FORM_ID/submissions?outcome=completed" \
-H "Authorization: Bearer $AIRFONE_KEY"
curl https://app.airfone.app/v1/form-submissions/SUBMISSION_ID \
-H "Authorization: Bearer $AIRFONE_KEY"

Each submission has an outcome, a summary and answers. An answer has the typed value, a status (answered, declined, unsure, unconfirmed) and the words it came from in evidence.

To get everything as a spreadsheet:

Terminal window
curl https://app.airfone.app/v1/forms/FORM_ID/export \
-H "Authorization: Bearer $AIRFONE_KEY" -o answers.csv