Skip to Content

Create campaign

POST
/campaigns

Create a new email campaign. Campaigns are created as DRAFT; use POST /campaigns/{id}/send to send or schedule one.

The sender domain must already be verified for this project.

Audience: audienceType decides which companion field is required — SEGMENT requires segmentId, FILTERED requires audienceCondition, and ALL requires neither.

Authorization

ApiKeyAuth
headerAuthorizationBearer <API Key>

API Key authentication. The project is automatically derived from the key.

/v1/track requires a public key (pk_*) — it is the one endpoint intended for client-side use, and a secret key is rejected there with 401.

Every other endpoint requires a secret key (sk_*) and rejects public keys with 401.

So the two key types are not interchangeable in either direction: pick the key that matches the endpoint you are calling.

Request body

application/json
  1. body
name*string

Campaign name

description?string

Campaign description

subject*string

Email subject line

body*string

HTML email body

from*string

Sender email address (must be from verified domain)

Formatemail
fromName?string

Sender name

replyTo?string

Reply-to email address

Formatemail
type?string

Content type of the campaign email. Defaults to MARKETING.

Default"MARKETING"
Value in"TRANSACTIONAL""MARKETING""HEADLESS"
audienceType*string

Target audience type

Value in"ALL""SEGMENT""FILTERED"
segmentId?string

Segment ID. Required when audienceType is SEGMENT.

Formatuuid
audienceCondition?

Audience filter tree. Required when audienceType is FILTERED. Same structure as a segment's condition.

Response body

Campaign created

application/json
  1. response
success?boolean
data?
curl -X POST 'https://api.send.47signals.com/campaigns' \  -H 'Content-Type: application/json' \  -d '{  "name": "March newsletter",  "subject": "What shipped in March",  "body": "<h1>Hello {{firstName}}</h1>",  "from": "news@example.com",  "fromName": "Example",  "audienceType": "ALL"}'
Example response
{  "success": true,  "data": {    "id": "string",    "name": "string",    "description": "string",    "subject": "string",    "body": "string",    "from": "user@example.com",    "fromName": "string",    "replyTo": "user@example.com",    "type": "TRANSACTIONAL",    "status": "DRAFT",    "audienceType": "ALL",    "audienceCondition": {      "logic": "AND",      "groups": [        {          "filters": [            {              "field": "string",              "operator": "equals",              "value": null,              "unit": "days"            }          ],          "conditions": {}        }      ]    },    "segmentId": "string",    "scheduledFor": "2019-08-24T14:15:22Z",    "totalRecipients": 0,    "sentCount": 0,    "deliveredCount": 0,    "openedCount": 0,    "clickedCount": 0,    "bouncedCount": 0,    "projectId": "string",    "sentAt": "2019-08-24T14:15:22Z",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z"  }}