Delete or archive a Campaign
DELETE /v1/campaigns/{campaign_id}
| Property | Value |
|---|---|
| Operation | delete_campaign |
| Group | Campaigns |
| Scope | campaigns:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited campaigns.campaign.delete (mutation) |
| Released in | 1.65.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
At the revision If-Match names (1.65.0): removes a draft with its enrollments, or archives a Campaign that ended, keeping its records. A Campaign that has not ended is 409 campaign_conflict (not_ended); cancel it first.
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 DELETE "$VOCAL_API/v1/campaigns/cmp_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"'const response = await fetch(`${process.env.VOCAL_API}/v1/campaigns/cmp_...`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.delete(
f"{os.environ['VOCAL_API']}/v1/campaigns/cmp_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
)
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. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | CampaignDeletion | |
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 |
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 CampaignDeletion.
| Field | Type | Required | Description |
|---|---|---|---|
archived | boolean | yes | True when an ended Campaign was archived. |
id | CampaignId | yes | |
object | "campaign_deletion" | yes | |
removed | boolean | yes | True when a draft was removed. |