Create a Campaign
POST /v1/campaigns
| Property | Value |
|---|---|
| Operation | create_campaign |
| Group | Campaigns |
| Scope | campaigns:write |
| Route class | control |
| Idempotency | Idempotency-Key required: a retry with the same key replays the first answer |
| Audit | Audited campaigns.campaign.create (mutation) |
| Released in | 1.65.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Creates a draft Campaign at revision 1 and answers it with every default explicit (1.65.0). Its blocks are checked as a launch checks them, but for the attestation and the budget, each issue a detail of 422 validation_failed (CampaignIssueCode); marketing, app and the India cell are capability_not_available (CampaignCapabilityCode). The Idempotency-Key makes a repeated create answer the same draft.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the campaigns:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/campaigns" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"name": "<name>",
"purpose": "informational",
"transport": "phone",
"arms": [
{
"key": "<key>",
"agent_id": "agt_...",
"weight": 1
}
],
"identity": {
"business_name": "<business_name>"
},
"numbers": {
"assignment": "single",
"phone_number_ids": [
"pn_..."
]
},
"windows": {
"weekly": [
{
"days": [
"mon"
],
"from": "<from>",
"to": "<to>"
}
]
},
"schedule": {
"start_at": "2026-10-07T14:02:11.408Z",
"end_at": "2026-10-07T14:02:11.408Z"
},
"pacing": {
"calls_per_minute": 1,
"max_concurrent": 1
}
}'const response = await fetch(`${process.env.VOCAL_API}/v1/campaigns`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "<name>",
"purpose": "informational",
"transport": "phone",
"arms": [
{
"key": "<key>",
"agent_id": "agt_...",
"weight": 1
}
],
"identity": {
"business_name": "<business_name>"
},
"numbers": {
"assignment": "single",
"phone_number_ids": [
"pn_..."
]
},
"windows": {
"weekly": [
{
"days": [
"mon"
],
"from": "<from>",
"to": "<to>"
}
]
},
"schedule": {
"start_at": "2026-10-07T14:02:11.408Z",
"end_at": "2026-10-07T14:02:11.408Z"
},
"pacing": {
"calls_per_minute": 1,
"max_concurrent": 1
}
}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/campaigns",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"name": "<name>",
"purpose": "informational",
"transport": "phone",
"arms": [
{
"key": "<key>",
"agent_id": "agt_...",
"weight": 1,
},
],
"identity": {
"business_name": "<business_name>",
},
"numbers": {
"assignment": "single",
"phone_number_ids": [
"pn_...",
],
},
"windows": {
"weekly": [
{
"days": [
"mon",
],
"from": "<from>",
"to": "<to>",
},
],
},
"schedule": {
"start_at": "2026-10-07T14:02:11.408Z",
"end_at": "2026-10-07T14:02:11.408Z",
},
"pacing": {
"calls_per_minute": 1,
"max_concurrent": 1,
},
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
idempotency-key | header | string | yes | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Request body
Content type application/json, required: CampaignCreateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
arms | array of CampaignArmInput | yes | |
budget | CampaignBudgetInput | no | |
consent | CampaignConsentInput | no | |
contact_caps | CampaignContactCapsInput | no | |
identity | CampaignIdentityInput | yes | |
name | string | yes | A label, never PHI (product terms): no patient, condition or appointment. |
numbers | CampaignNumbersInput | yes | |
on_exhausted | CampaignOnExhaustedInput | no | |
outcome_routing | CampaignOutcomeRoutingInput | no | |
pacing | CampaignPacingInput | yes | |
purpose | CampaignPurpose | yes | |
retry | CampaignRetryInput | no | |
schedule | CampaignScheduleInput | yes | |
transport | CampaignTransport | yes | |
voicemail | CampaignVoicemailInput | no | |
windows | CampaignWindowInput | yes |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
201 | application/json | Campaign | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed, capability_not_available |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 201 answer
The shape is Campaign.
| Field | Type | Required | Description |
|---|---|---|---|
archived | boolean | yes | True once DELETE archived an ended Campaign. |
arms | array of CampaignArm | yes | |
attestation | CampaignAttestation or null | yes | |
budget | CampaignBudget or null | yes | Required at launch. |
consent | CampaignConsent | yes | |
contact_caps | CampaignContactCaps or null | yes | |
created_at | Timestamp | yes | |
current_revision | integer or null | yes | The frozen revision in force; null before launch. |
ended_at | Timestamp or null | yes | |
environment | Environment | yes | |
error_code | string or null | yes | Why a failed Campaign failed; null otherwise. |
id | CampaignId | yes | |
identity | CampaignIdentity | yes | |
launched_at | Timestamp or null | yes | |
name | string | yes | A label, never PHI (product terms): no patient, condition or appointment. |
numbers | CampaignNumbers | yes | |
object | "campaign" | yes | |
on_exhausted | CampaignOnExhausted or null | yes | |
organization_id | OrganizationId | yes | |
outcome_routing | CampaignOutcomeRouting or null | yes | |
pacing | CampaignPacing | yes | |
paused_reason | CampaignPausedReason or null | yes | Why it is paused; null otherwise. |
project_id | ProjectId or null | yes | |
purpose | CampaignPurpose | yes | |
retry | CampaignRetry | yes | |
revision | integer | yes | The draft's revision, the ETag If-Match names. |
schedule | CampaignSchedule | yes | |
spend_micros | integer | yes | The rated charges of the Campaign's Calls so far. |
status | CampaignStatus | yes | |
supervisor_process_id | ProcessInstanceId or null | yes | The supervisor Process instance; null before launch. |
transport | CampaignTransport | yes | |
updated_at | Timestamp | yes | |
voicemail | CampaignVoicemail | yes | |
windows | CampaignWindow | yes |