Add contacts to a campaign
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/campaigns/{id}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"name": "John Smith",
"phone_number": "+447700900123",
"custom_vars": {
"plan": "Basic"
}
},
{
"phone_number": "+14155550199"
}
]
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/campaigns/{id}/items"
payload = { "items": [{
"name": "John Smith",
"phone_number": "+447700900123",
"custom_vars": { "plan": "Basic" }
}, { "phone_number": "+14155550199" }] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{
name: 'John Smith',
phone_number: '+447700900123',
custom_vars: {plan: 'Basic'}
},
{phone_number: '+14155550199'}
]
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/campaigns/{id}/items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"items": [
{
"id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
"campaign_id": "3f1c2a8e-6b0d-4f6e-9a51-0d2b7c9e4a10",
"name": "John Smith",
"phone_number": "+447700900123",
"channel": "voice",
"country": "GB",
"agent_id": null,
"callback": false,
"custom_vars": {
"plan": "Basic"
},
"status": "scheduled",
"failed_reason": null,
"attempt_count": 0,
"conversation_id": null,
"start_time": null,
"next_attempt_at": null,
"callback_requested": false,
"callback_origin_item_id": null,
"callback_target_item_id": null,
"created_at": "2026-02-28T10:05:00.000Z",
"updated_at": "2026-02-28T10:05:00.000Z"
}
]
}{
"error": "<string>",
"code": "<string>"
}{
"error": "Invalid or revoked token"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "Items can only be edited while a campaign is draft or scheduled (status: running)"
}{
"error": "<string>",
"message": "<string>",
"issues": [
{
"path": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"details": [
"<unknown>"
]
}Campaigns
Add contacts to a campaign
Adds one or more contacts to a draft or scheduled campaign. Each contact may override the campaign’s agent and callback setting, and carries custom_vars the agent can use during the call. Numbers that cannot be parsed are stored with status invalid and never dialed.
POST
/
v1
/
projects
/
{projectId}
/
campaigns
/
{id}
/
items
Add contacts to a campaign
curl --request POST \
--url https://voice-api.onclarity.com/v1/projects/{projectId}/campaigns/{id}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"name": "John Smith",
"phone_number": "+447700900123",
"custom_vars": {
"plan": "Basic"
}
},
{
"phone_number": "+14155550199"
}
]
}
'import requests
url = "https://voice-api.onclarity.com/v1/projects/{projectId}/campaigns/{id}/items"
payload = { "items": [{
"name": "John Smith",
"phone_number": "+447700900123",
"custom_vars": { "plan": "Basic" }
}, { "phone_number": "+14155550199" }] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
items: [
{
name: 'John Smith',
phone_number: '+447700900123',
custom_vars: {plan: 'Basic'}
},
{phone_number: '+14155550199'}
]
})
};
fetch('https://voice-api.onclarity.com/v1/projects/{projectId}/campaigns/{id}/items', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"items": [
{
"id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
"campaign_id": "3f1c2a8e-6b0d-4f6e-9a51-0d2b7c9e4a10",
"name": "John Smith",
"phone_number": "+447700900123",
"channel": "voice",
"country": "GB",
"agent_id": null,
"callback": false,
"custom_vars": {
"plan": "Basic"
},
"status": "scheduled",
"failed_reason": null,
"attempt_count": 0,
"conversation_id": null,
"start_time": null,
"next_attempt_at": null,
"callback_requested": false,
"callback_origin_item_id": null,
"callback_target_item_id": null,
"created_at": "2026-02-28T10:05:00.000Z",
"updated_at": "2026-02-28T10:05:00.000Z"
}
]
}{
"error": "<string>",
"code": "<string>"
}{
"error": "Invalid or revoked token"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "<string>",
"code": "<string>"
}{
"error": "Items can only be edited while a campaign is draft or scheduled (status: running)"
}{
"error": "<string>",
"message": "<string>",
"issues": [
{
"path": "<string>",
"code": "<string>",
"message": "<string>"
}
],
"details": [
"<unknown>"
]
}Authorizations
Your organization API key (it starts with anek_org_). The same key works on the Voice API and the Support API. See Authentication.
Body
application/json
Minimum array length:
1Show child attributes
Show child attributes
Response
The contacts that were added
Show child attributes
Show child attributes