Skip to main content
PATCH
Update a campaign

Authorizations

Authorization
string
header
required

Your project's secret key (pk_…, without the pub segment). Server-side only — never ship it to a browser. Get it from Settings → Projects in the dashboard.

Path Parameters

id
string
required
Maximum string length: 128

Body

application/json
name
string

Rename the campaign.

Maximum string length: 80
audience
object

Canonical audience union. null or { "kind": "all" } targets everyone. { "kind": "expression", "expression": { … }, "reason": "…" } authors an inline audience stored as an immutable audience version. { "kind": "segment", "segment": "id-or-key", "version": n? } pins a saved segment version (omitted version = current, resolved atomically; archived segments are refused). Check expressions first with POST /api/v1/audiences/check. Mutually exclusive with the deprecated targeting field.

targeting
object | null
deprecated

Deprecated shorthand for the same audience semantics (strict trait equality + events seen/not_seen, ANDed). Still accepted; normalized into an immutable audience version. Prefer audience.

pages
string[] | null

Web in-app only. Replace path patterns; null or [] clears them. Email campaigns reject this field.

Maximum array length: 20
Maximum string length: 256
goalId
string | null

Link the campaign to a goal in this project; null unlinks. Linking takes effect for target events tracked from then on — it never rewrites past deliveries.

Minimum string length: 1
message
object

Replace the content of a single-variant campaign (400 if the campaign has more than one variant). Mutually exclusive with variants.

variants
object[]

Variant patches: entries with an id update that variant, entries without one create a new variant (message required). Mutually exclusive with message.

Required array length: 1 - 10 elements
deliverFrom

Replace the delivery-window start (epoch milliseconds or ISO-8601 with an explicit timezone offset); null clears it.

deliverUntil

Replace the delivery-window end (must stay after deliverFrom and, when set, be in the future); null clears it.

push
object
sourceChanges
object

Explicit replacement of prepared sources. Requires the current sourceChanges.revision. Omission preserves the declaration and approval. Content and source replacement commit atomically; approval survives edits, but current source coverage is required. Source-managed preparations reject this field with 409 before any copy mutation.

Response

The updated campaign with fresh variants and stats.

campaign
object
required