API reference
Add contacts to a campaign
POST /v1/campaigns/{campaign_id}/contacts
Up to 1,000 more people, to a campaign that is a draft, running or paused. A running campaign starts calling them in its next calling hours. A number the campaign already holds is skipped and listed in already_in_campaign, so sending a batch again is safe. Needs campaigns:write and a live key.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
campaign_id |
path | string (uuid) | Yes |
Body
Sent as JSON. A field this operation does not take is refused, so a typo fails loudly.
| Field | Type | Required | Description |
|---|---|---|---|
contacts |
array of CampaignContactCreate | Yes | The people to add, up to 1,000 in one request. |
Answer
200 with CampaignContactsAdded.
Errors
Every error is a problem document with a stable code.
| Status | When |
|---|---|
401 |
The key is missing, mistyped, unknown, revoked or expired. |
403 |
A test key: a campaign rings real people. |
404 |
This key reaches no such campaign. |
409 |
The campaign has finished: create a new one for a new list. |
422 |
A contact does not fit — errors names each by its place in contacts. |
429 |
Too many requests for this key or its organization; see Retry-After. |
500 |
Something went wrong on our side. Quote the request_id to support. |
Examples
#!/bin/sh
# Add people to a campaign. A number the campaign already holds is skipped, so sending a batch again is safe.
curl -sS --fail-with-body -X POST "https://api.aigently.ai/v1/campaigns/1c3e5a7b-9d0f-4b2c-8e4a-6c8e0a2c4e6b/contacts" \
-H "Authorization: Bearer $AIGENTLY_API_KEY" \
--json '{
"contacts": [
{
"to_number": "+12025550125",
"variables": {
"first_name": "Lina"
},
"external_id": "lead-20933"
}
]
}'
Try it
Sends this request to the API from your browser, with a test key. Nothing it does rings a phone.