Platform API · Product API · Campaigns
Campaigns
How the Product API models a campaign: the endpoints it exposes, the draft-only contract behind all of them, and the statuses a campaign moves through. Start here before creating, editing, reading, estimating or deleting one.
A campaign is a one-off message sent to a group of contacts: a sale announcement, a service notice, a launch. The Product API lets you assemble one programmatically, change it, price it, read it back and throw it away. What it does not let you do is send it.
This is the surface an integration or an AI assistant uses to turn "message our VIP customers about the sale on Monday" into something a marketer can open, check and confirm.
Drafts only, edited in place
Two properties decide how you design around this whole section.
A draft is edited in place. PATCH /campaign/{id} changes a campaign that is not prepared yet and keeps its id, so a draft can be built up over several calls or corrected after a person has looked at it. Posting again is not editing: it creates a second campaign. An edit takes the updatedAt you last read, so it never overwrites a change someone made in the dashboard in the meantime, and it sends the campaign back to draft without its estimate. Once a person has prepared the campaign, changes happen in the dashboard. See Editing a draft.
The upside of that split is the safety it buys. A programmatic caller, including an agent composing a campaign from a conversation, can go as far as a complete, reviewable draft, priced and checked, without ever being able to spend money or reach a customer by accident.
The endpoints
| Endpoint | What it does | Scope | Rate limit |
|---|---|---|---|
POST /campaign | Creates a draft. See Creating a draft. | PROJECT_CAMPAIGN_WRITE | medium |
PATCH /campaign/{id} | Edits a campaign that is not prepared yet, keeping its id. See Editing a draft. | PROJECT_CAMPAIGN_WRITE | medium |
GET /campaign/{id} | Reads one campaign back. See Reading campaigns. | PROJECT_CAMPAIGN_READ | large |
GET /campaign | Lists the project's campaigns, filtered and paged. | PROJECT_CAMPAIGN_READ | large |
GET /campaign/summary | A digest of the whole project's campaign activity. | PROJECT_CAMPAIGN_READ | large |
PATCH /campaign/{id}/estimate | Prices a draft, asynchronously. See Estimating and deleting. | PROJECT_CAMPAIGN_WRITE | restrictive |
DELETE /campaign/{id} | Removes a campaign that has not gone out. | PROJECT_CAMPAIGN_WRITE | restrictive |
Scopes are chosen when the token is minted, under Project settings → API tokens. See Authentication and Rate limits, where each class ceiling is set by the organization's subscription plan.
The life of a campaign
stateDiagram-v2
[*] --> Draft: created by the API
Draft --> Draft: edited through the API, same id
Draft --> Prepared: audience and message reviewed in the dashboard
Prepared --> Scheduled: confirmed in the dashboard
Scheduled --> Sent: the send runs
Sent --> [*]
Draft --> Deleted: deleted through the API
Prepared --> Deleted: deleted through the API
Scheduled --> Deleted: deleted through the API, up to five minutes before the send
Deleted --> [*]
class Sent success
class Deleted destructive
A draft created through the API lands in the project's campaign list exactly as if it had been started in the panel: same editor, same three steps (Audience, Message, Review & schedule), same estimate and confirmation. The customer-facing walkthrough of what happens from there is Creating a campaign in the Platform guides.
Statuses and phases
Every operation in this section is gated by the campaign's status, and the errors you get are mostly status errors, so it is worth reading the vocabulary once.
There are twenty-odd raw statuses. They collapse into six phases, which is how the product talks about a campaign and what GET /campaign/summary counts by:
| Phase | Raw statuses | What it means |
|---|---|---|
draft | draft, preview, estimating, estimated | Being written. Nothing is committed. |
preparing | quoting, quoted, preparing, prepared, unpreparing | Confirmed by a person and being built. The price is locked and the individual messages are being assembled. |
scheduled | confirmed, scheduled | Armed and waiting for its send time. |
sending | sending, continuing, resuming | Going out now. |
sent | sent | Done. |
stopped | canceled, aborted, unpaid, deleted | Ended without completing, deletions included. |
Two of those mappings are worth internalising, because they are not what the names suggest:
estimatingandestimatedare stilldraft. Pricing happens while a person is still editing, so an estimate does not move a campaign forward. It is not a step towards sending.preparedis alreadypreparing, not a draft. A prepared campaign has been confirmed by a person and has its messages built. This is why estimating a prepared campaign is destructive: it throws that work away.
What's next
The POST contract: the request body, the response, warnings, limits and error codes.
Change a draft keeping its id: what each field replaces, and how a stale read is refused.
Audience targetingSegments, inline filters and how to count the reach before you create anything.
Message contentCopy, template variables, senders, RCS buttons, SMS fallback and languages.
Dates and schedulingThe three date forms, timezones, and why setting a date schedules nothing.
Reading campaignsOne campaign, the filtered list, and the project digest a dashboard is built on.
Estimating and deletingPricing a draft and removing one. Both asynchronous, both gated by status.
Last updated