Skip to content

Campaigns API

All endpoints accept both cookie auth and API key auth (Authorization: Bearer sk_...).

Create Campaign

POST /api/v1/projects/{id}/campaigns
json
{
  "template_id": "uuid",
  "name": "April Newsletter",
  "scheduled_at": "2026-04-20T09:00:00Z"
}
FieldTypeRequiredDescription
template_idstring (UUID)YesThe template to send
namestringYesCampaign name for identification
scheduled_atstring (RFC 3339)YesWhen to send (must be in the future)

Response 201

json
{
  "id": "uuid",
  "project_id": "uuid",
  "template_id": "uuid",
  "name": "April Newsletter",
  "status": "scheduled",
  "scheduled_at": "2026-04-20T09:00:00Z",
  "sent_at": null,
  "created_at": "2026-04-16T12:00:00Z",
  "updated_at": "2026-04-16T12:00:00Z"
}

List Campaigns

GET /api/v1/projects/{id}/campaigns

Response

json
{
  "campaigns": [
    {
      "id": "uuid",
      "project_id": "uuid",
      "template_id": "uuid",
      "name": "April Newsletter",
      "status": "scheduled",
      "scheduled_at": "2026-04-20T09:00:00Z",
      "sent_at": null,
      "created_at": "2026-04-16T12:00:00Z",
      "updated_at": "2026-04-16T12:00:00Z"
    }
  ]
}

Delete / Cancel Campaign

DELETE /api/v1/projects/{id}/campaigns/{campaignId}

Deletes a campaign. Only campaigns with scheduled status can be deleted. Attempting to delete a campaign that is sending, sent, or failed returns 400 Bad Request.

Response 204 No Content

Campaign Statuses

StatusDescription
scheduledWaiting for the scheduled time to arrive
sendingCurrently broadcasting to subscribers
sentAll emails have been delivered
failedAn error occurred during sending

The background worker checks for due campaigns every 30 seconds. When a campaign's scheduled_at time has passed, it broadcasts the selected template to all active subscribers in the project, with per-subscriber variable replacement.

Released under the AGPL-3.0 License.