Skip to main content
See also: Runs concept and configuration for what this API powers, when to call it, and how it is configured.
Campaigns define recurring batch execution configurations. Each campaign targets a decision flow and customer segment, with schedule, volume, and file settings. Campaign runs are individual execution instances.
See the Campaigns feature page for UI guidance on creating and managing campaigns.

Base path


List campaigns

Returns a paginated list of campaigns with latest run info.

Query parameters

Response 200


Create campaign

Creates a new campaign configuration. Does not trigger execution — use the trigger endpoint to start a run.

Request body

When status is active and scheduleType is not manual, the campaign is picked up by the /api/v1/cron/campaign-scheduler route (5-minute cadence in the in-process maintenance scheduler) and a campaign run is triggered automatically once the schedule is due — see Schedule Configuration for the full firing semantics.

Example request

The fileConfig above is the campaign-owned file output (Run.fileConfig v2) — it drives the file every file-mode channel in the campaign writes. See File Output Configuration for the full field and column-source reference.

Response 201

Returns the created campaign object.

Update campaign

Updates campaign configuration. Accepts any combination of the following fields: name, description, status, scheduleType, scheduleDayOfWeek, scheduleDayOfMonth, scheduleTime, scheduleTimezone, scheduleCron, frequencyCaps, fileConfig, channelIds, decisionFlowId, segmentId.
Unlike most update endpoints, PUT allows changing decisionFlowId and segmentId to retarget a campaign to a different decision flow or customer segment.

Delete campaign

Deletes the campaign and all its runs. Requires admin role.

Get campaign detail

Returns the campaign config with the last 10 runs, resolved offer names in summaries, and enriched per-customer results.

Trigger a campaign run

Creates and starts a new campaign run. The run is enqueued for processing by the worker tier, with inline fallback when the queue is unavailable. The run is reserved under a FOR UPDATE lock on the campaign, so the endpoint is idempotent under concurrency: two racing triggers (a double-click, a retry, or a manual trigger coinciding with a scheduled tick) can’t each mint a run and each execute the full segment. A trigger issued while a run for the campaign is already pending or running returns that in-flight run with 200 (below) rather than starting a second.

Response 201 (new run created)

Response 200 (a run is already in flight)

Returns the existing pending/running campaign run unchanged — no second execution is started.

List campaign runs

Returns execution history for a campaign, ordered by run number descending (max 50).
Each run’s summary.fileOutputs[].filePath is a retrievable download — GET /api/v1/runs/artifacts/:id when it wasn’t uploaded to S3. See Retrieving Generated Files.

Execute a run inline (background)

Fire a run execution in the background and return immediately. The endpoint dispatches the batch executor without awaiting it — the HTTP response is sent before the batch starts producing output, and any per-run failure is recorded in the run’s status and logs rather than surfaced to the caller. This endpoint is for inline triggers from a single-tenant dev environment or a backup path when the worker tier is degraded. Production triggering should use POST /api/v1/runs/:id/campaign-runs so the run gets a campaign-run record, retry semantics, and DLQ visibility.

Request Body

string
required
Identifier of the run record that the executor will update with status, startedAt, and completedAt.
string
required
Decision flow to execute against.
string
required
Customer-segment view name. The executor reads from this Postgres view to enumerate target customers.

Response

Status 200.
The response is sent the moment the executor is dispatched. The caller monitors progress by polling GET /api/v1/runs/:id.

Status codes

Roles

admin, editor.
Errors raised by the batch executor after the response is sent are logged but never surfaced to the caller. The run record’s status and error fields are the source of truth for outcome — poll GET /api/v1/runs/:id to see the final state.

Campaign statuses

Run statuses


Role requirements