Skip to main content
Use the AgentCallback API to run a CSV-backed outbound campaign from start to finish.

Before you begin

You need an API key, an outbound agent, and an active outbound phone number in your organization. The agent must already contain any variables that you map from the CSV. This guide uses these placeholders:
Only upload contacts you are allowed to call. You are responsible for consent, local calling restrictions, and any applicable do-not-call requirements.
1

Prepare and upload the CSV

Your CSV needs a header row. The phone column and any mapped variable columns must use the same names you send when creating the campaign.
Upload the file with multipart/form-data. The file field must be named file; CSV files can be up to 10 MB.
The response contains the ID you will use as file_upload_id.
You can list the CSV files available to your organization at any time:
2

Create a draft campaign

Create the campaign with the returned file_upload_id. AgentCallback imports the CSV rows into the campaign when it is created.The phone_number_column value must match the CSV phone header. Each key in script_variables must be the name of an agent variable, and its value must match the corresponding CSV header.
The response includes campaign.id. Save it as YOUR_CAMPAIGN_ID for the remaining requests.
Omit scheduled_date and scheduled_time to create a draft. To create a scheduled campaign, provide both fields and optionally set scheduled_timezone_input. Do not send start_immediately; that field is not part of the API.
The working_hours object always uses the shape { weekly: { day: [{ start, end }] } }. Times use 24-hour HH:mm format. working_hours_timezone is optional; when omitted, working hours inherit campaign_timezone.
3

Configure the post-call webhook

Post-call webhooks belong to the agent, so configure the webhook before you start the campaign. It will receive call data for calls that use that agent.In the dashboard, open the agent used by the campaign, open Post-call Webhook, enable it, and set YOUR_WEBHOOK_URL as the destination. Choose POST unless your endpoint specifically requires GET.If you manage agents through the API, include this object in the complete PUT /api/scripts/YOUR_SCRIPT_ID agent configuration:
Keep the agent’s other current fields in that PUT request. See Post-call webhooks for delivery details, trigger conditions, and the default payload.
4

Start the campaign

Starting a draft campaign queues eligible contacts. Calls run only during the configured working hours.
5

Retrieve outcomes and export calls

Calls are asynchronous. Query the campaign’s calls after they begin completing. The response contains call status, phone number, summary, and transcript fields where available.
To download the campaign’s calls as CSV:
You can also review the campaign and webhook delivery details in Call logs.

Next steps