Launch Campaign
Campaigns
Launch Campaign
Validate and launch a campaign. Kicks off the background execution task for a draft campaign.
POST
Launch Campaign
CLI:
After a successful launch:
Overview
The call is synchronous about validation (returns 400 if the campaign isn’t ready) but asynchronous about sending — once it returns200, a Trigger.dev task owns the work. Poll GET /api/campaigns/:id for progress.
The status transitions atomically via compare-and-swap: draft → launching, then (inside the background task) launching → active. Only one launch can run at a time; a second concurrent call returns 409.
Error reference
| Status | When |
|---|---|
400 | Campaign is not in draft status — the message names the current status |
400 | Campaign has no sender accounts, no pending leads, or no sendable sequence nodes |
400 | Sequence contains nodes with missing content — message lists the positions |
400 | Email senders not in active status (warmup incomplete) or missing a configured sending inbox |
400 | LinkedIn: connected account no longer exists upstream — reconnect required |
400 | All leads were skipped by dedup — nothing to send |
401 | Missing or invalid Bearer token |
404 | Campaign doesn’t exist or isn’t owned by the authenticated user |
409 | A launch is already in progress (started within the last 2 min), or campaign state changed concurrently |
500 | Message resolution or Trigger.dev dispatch failed. Status rolled back to draft; retry is safe |
503 | LinkedIn: transient sender verification error. Retry after 30 s |
AI agent notes
Before calling this endpoint, verify the campaign is ready:
GET /api/campaigns/:id→statusmust be"draft"- At least one sender account is attached
- At least one lead is in
"pending"status - Every sendable sequence node has non-empty content
- For email: senders are
active(warmup complete) and have a configured sending inbox - For LinkedIn: the connected account resolves through the sending backend
GET /api/campaigns/{id} first when you need to inspect the draft before launch; this endpoint still performs final readiness checks and returns a specific blocker when launch is not allowed.- Status is
"launching"immediately — do not re-launch (that’s the 409 path) - Within ~2 min the background task transitions to
"active"and begins staggered sends - Poll
GET /api/campaigns/:idevery 30 s until status is"active", then at 1–5 min cadence for progress (readstats) stats.totalis set at launch; counters (sent,replied,bounced, etc.) increment as leads execute
draft on the next attempt.
Credits: launching itself is free. AI message generation and LinkedIn enrichment can deduct credits earlier in the setup flow; use Get Credits to inspect public credit costs before starting paid prep work.
Idempotency: retrying the same call is safe — the background task is keyed by campaignId + updated_at, and on any failure the server rolls back all writes (status returns to draft; promoted message drafts revert; new pending messages are deleted).
Stopping: use POST /api/campaigns/:id/pause to halt mid-flight; POST /api/campaigns/:id/resume to continue.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Campaign UUID
Response
Launch dispatched. Background task is running.
Available options:
true Always "Campaign launch started" on success
Trigger.dev run identifier.
Required range:
0 <= x <= 9007199254740991Required range:
0 <= x <= 9007199254740991