Update a Campaign draft
PATCH /v1/campaigns/{campaign_id}
| Property | Value |
|---|---|
| Operation | update_campaign |
| Group | Campaigns |
| Scope | campaigns:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited campaigns.campaign.update (mutation) |
| Released in | 1.65.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Replaces the named fields of a draft at the revision If-Match names and answers the next revision (1.65.0), checked as a create is. A launched Campaign changes only by a revision (create_campaign_revision): its draft update is 409 campaign_conflict (not_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 PATCH "$VOCAL_API/v1/campaigns/cmp_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"' \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/campaigns/cmp_...`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import requests
response = requests.patch(
f"{os.environ['VOCAL_API']}/v1/campaigns/cmp_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
campaign_id | path | CampaignId | yes | The id of a Campaign: cmp_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
if-match | header | string | yes | The revision the change was made against, quoted as the ETag returns it, or * to overwrite. |
Request body
Content type application/json, required: CampaignUpdateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
arms | array of CampaignArmInput | no | |
budget | CampaignBudgetInput | no | |
consent | CampaignConsentInput | no | |
contact_caps | CampaignContactCapsInput | no | |
identity | CampaignIdentityInput | no | |
name | string | no | A label, never PHI (product terms): no patient, condition or appointment. |
numbers | CampaignNumbersInput | no | |
on_exhausted | CampaignOnExhaustedInput | no | |
outcome_routing | CampaignOutcomeRoutingInput | no | |
pacing | CampaignPacingInput | no | |
purpose | CampaignPurpose | no | |
retry | CampaignRetryInput | no | |
schedule | CampaignScheduleInput | no | |
transport | CampaignTransport | no | |
voicemail | CampaignVoicemailInput | no | |
windows | CampaignWindowInput | no |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | 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 | campaign_conflict |
412 | application/json | ErrorEnvelope | revision_mismatch |
422 | application/json | ErrorEnvelope | validation_failed, capability_not_available |
428 | application/json | ErrorEnvelope | precondition_required |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 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 |