Skip to main content
POST
/
api
/
v1
/
campaigns
Create a campaign
curl --request POST \
  --url https://api.railmail.app/api/v1/campaigns \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data @- <<EOF
{
  "name": "June Newsletter",
  "subject": "Your June update",
  "previewText": "What's new this month",
  "contentJson": "{\"blocks\":[]}",
  "fromEmail": "news@example.com",
  "fromName": "Example",
  "topicIds": [
    "7b9c1f2e-2a1d-4d8a-9b1f-7e6c5d4b3a2f"
  ],
  "segmentIds": [],
  "sendStrategy": "DRAFT"
}
EOF
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "campaignKey": "<string>",
  "name": "<string>",
  "subject": "<string>",
  "previewText": "<string>",
  "contentJson": "<string>",
  "contentText": "<string>",
  "status": "<string>",
  "sendStrategy": "<string>",
  "topicIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "segmentIds": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "estimatedRecipientCount": 123,
  "scheduledAt": "2023-11-07T05:31:56Z",
  "completedAt": "2023-11-07T05:31:56Z",
  "fromEmail": "<string>",
  "fromName": "<string>",
  "preSendScore": 123,
  "preSendStatus": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z"
}

Authorizations

X-API-Key
string
header
required

Project-scoped API key, format rm_(live|test)_... . May also be sent as Authorization: Bearer rm_....

Body

application/json
name
string
required
Maximum string length: 200
subject
string
required
Maximum string length: 500
previewText
string | null
contentJson
string | null

Rich text content as a JSON string.

contentText
string | null
fromEmail
string | null
fromName
string | null
topicIds
string<uuid>[] | null
segmentIds
string<uuid>[] | null
sendStrategy
enum<string> | null
Available options:
DRAFT,
IMMEDIATE,
SCHEDULED
scheduledAt
string<date-time> | null

Response

Campaign created

id
string<uuid>
campaignKey
string | null
name
string
subject
string | null
previewText
string | null
contentJson
string | null
contentText
string | null
status
string
sendStrategy
string | null
topicIds
string<uuid>[] | null
segmentIds
string<uuid>[] | null
estimatedRecipientCount
integer<int64> | null
scheduledAt
string<date-time> | null
completedAt
string<date-time> | null
fromEmail
string | null
fromName
string | null
preSendScore
integer | null
preSendStatus
string | null
createdAt
string<date-time>
updatedAt
string<date-time>