Publish a revision of a Campaign
POST /v1/campaigns/{campaign_id}/revisions
| Property | Value |
|---|---|
| Operation | create_campaign_revision |
| Group | Campaigns |
| Scope | campaigns:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited campaigns.campaign.revise (mutation) |
| Released in | 1.65.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Freezes the next revision of a running or paused Campaign from the blocks the body names over the revision in force, applied from the next tick and admission (1.65.0; section 3.8), by an owner or admin (owner_or_admin_required), an Audit event. A field fixed at launch is campaign_revision_field_fixed; a Campaign in another status is campaign_conflict. The Idempotency-Key makes a repeated request answer the same revision.
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/cmp_.../revisions" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/campaigns/cmp_.../revisions`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/campaigns/cmp_.../revisions",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
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. |
idempotency-key | header | string | no | 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: CampaignRevisionRequest.
| Field | Type | Required | Description |
|---|---|---|---|
budget | CampaignBudgetInput | no | |
contact_caps | CampaignContactCapsInput | no | |
end_at | RequestTimestamp | no | |
pacing | CampaignPacingInput | no | |
retry | CampaignRetryInput | no | |
windows | CampaignWindowInput | no |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
201 | application/json | CampaignRevision | |
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, idempotency_in_progress, idempotency_key_reused |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 201 answer
The shape is CampaignRevision.
| Field | Type | Required | Description |
|---|---|---|---|
arm_versions | array of CampaignArmVersion | yes | |
campaign_id | CampaignId | yes | |
config | CampaignConfig | yes | |
config_sha256 | string | yes | The SHA-256 of the canonical JSON (RFC 8785) of config, in lowercase hex. |
created_at | Timestamp | yes | |
created_by | ActorRef | yes | |
object | "campaign_revision" | yes | |
revision | integer | yes | From 1, the launch. |