POST
Author a marketing campaign

Authorizations

Authorization
string
header
required

A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.

Headers

Idempotency-Key
string
required

A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.

Body

application/json

A campaign ALWAYS lands as a draft and this route can never mail anybody: arming it is a second, explicitly named call. status is refused by name for that reason.

name
string
required

What the merchant sees in their own dashboard. Unique per store, so a repeat is 409 name_taken rather than a second send nobody can tell apart.

channel
enum<string>
required

Which transport the message spine dispatches on. It cannot be inferred and has no default.

Available options:
email,
sms,
push
segment_id
string
required

The audience, RESOLVED AT SEND TIME rather than now, so widening the segment later widens who receives this. The segment must already exist in the store; anything else is 400 segment_not_found, which is also what another tenant's segment id looks like.

subject
string

The subject line, at most 500 bytes.

body
string

The message copy, at most 500 KB. It is served by the single-campaign read and deliberately withheld from the list.

template_id
string | null

When set, the renderer supplies the content and subject and body are the fallback. null means this campaign carries its own copy.

Response

Created

data
object