curl --request POST \
--url https://api.sendx.io/api/v1/rest/campaign \
--header 'Content-Type: application/json' \
--header 'X-Team-ApiKey: <api-key>' \
--data @- <<EOF
{
"name": "Flash Sale Announcement",
"subject": "β‘ 24-Hour Flash Sale - {{contact.firstName}}, Save 50%!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"previewText": "Limited time offer - Today only!",
"htmlCode": "<html><body><h1>Flash Sale!</h1><p>Hi {{contact.firstName}},</p><p>Don't miss our 24-hour flash sale!</p><a href='{{sale.url}}'>Shop Now</a></body></html>",
"plainText": "Flash Sale!\n\nHi {{contact.firstName}},\n\nDon't miss our 24-hour flash sale!\n\nShop now: {{sale.url}}",
"scheduleType": 1,
"includedLists": [
"list_0tOFLp5RgV7s3LNiHrjGYs",
"list_vUCjsUmrVXtSppS8rD0Ssq"
],
"excludedTags": [
"tag_unengaged"
]
}
EOF{
"id": "campaign_4vK3WFhMgvOwUNyaL4QxCD",
"name": "Summer Sale 2024",
"subject": "π Summer Sale - 50% Off Everything!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"status": 1,
"scheduleType": 0,
"scheduleCondition": "2024-12-30",
"includedLists": [
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
],
"excludedLists": [
"list_Mn7Op8Qr9St0Uv1Wx2Yz3A"
],
"htmlCode": "<html><body><h1>Summer Sale</h1></body></html>",
"plainText": "Summer Sale",
"previewText": "Limited time offer - Shop now!",
"timeCondition": "9:00 AM",
"timezone": "America/New_York",
"smartSend": "America/New_York",
"sendInContactsTimezone": true,
"preferredTimeCondition": "10:00 AM",
"preferredTimezone": "America/Los_Angeles",
"strategy": "Batch Sending",
"includedSegments": [
"segment_engaged_30_days"
],
"includedTags": [
"tag_6GN4DNyrHNt4KktCNG8PDO",
"tag_UhsDkjL772Qbj5lWtT62VK"
],
"excludedSegments": [],
"excludedTags": [
"tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"
],
"isArchived": false,
"campaignScreenshotUrl": "<string>",
"autowarmup": false,
"autowarmupType": 0,
"autowarmupStartLevel": 0,
"plainwarmup": false,
"plainwarmupStartLevel": 0
}Create campaign
Creates a new email campaign.
curl --request POST \
--url https://api.sendx.io/api/v1/rest/campaign \
--header 'Content-Type: application/json' \
--header 'X-Team-ApiKey: <api-key>' \
--data @- <<EOF
{
"name": "Flash Sale Announcement",
"subject": "β‘ 24-Hour Flash Sale - {{contact.firstName}}, Save 50%!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"previewText": "Limited time offer - Today only!",
"htmlCode": "<html><body><h1>Flash Sale!</h1><p>Hi {{contact.firstName}},</p><p>Don't miss our 24-hour flash sale!</p><a href='{{sale.url}}'>Shop Now</a></body></html>",
"plainText": "Flash Sale!\n\nHi {{contact.firstName}},\n\nDon't miss our 24-hour flash sale!\n\nShop now: {{sale.url}}",
"scheduleType": 1,
"includedLists": [
"list_0tOFLp5RgV7s3LNiHrjGYs",
"list_vUCjsUmrVXtSppS8rD0Ssq"
],
"excludedTags": [
"tag_unengaged"
]
}
EOF{
"id": "campaign_4vK3WFhMgvOwUNyaL4QxCD",
"name": "Summer Sale 2024",
"subject": "π Summer Sale - 50% Off Everything!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"status": 1,
"scheduleType": 0,
"scheduleCondition": "2024-12-30",
"includedLists": [
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
],
"excludedLists": [
"list_Mn7Op8Qr9St0Uv1Wx2Yz3A"
],
"htmlCode": "<html><body><h1>Summer Sale</h1></body></html>",
"plainText": "Summer Sale",
"previewText": "Limited time offer - Shop now!",
"timeCondition": "9:00 AM",
"timezone": "America/New_York",
"smartSend": "America/New_York",
"sendInContactsTimezone": true,
"preferredTimeCondition": "10:00 AM",
"preferredTimezone": "America/Los_Angeles",
"strategy": "Batch Sending",
"includedSegments": [
"segment_engaged_30_days"
],
"includedTags": [
"tag_6GN4DNyrHNt4KktCNG8PDO",
"tag_UhsDkjL772Qbj5lWtT62VK"
],
"excludedSegments": [],
"excludedTags": [
"tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"
],
"isArchived": false,
"campaignScreenshotUrl": "<string>",
"autowarmup": false,
"autowarmupType": 0,
"autowarmupStartLevel": 0,
"plainwarmup": false,
"plainwarmupStartLevel": 0
}- Target specific lists, tags, and segments
- Schedule campaigns or send immediately
- Smart send optimization
- Time zone aware delivery
- A/B testing capabilities
0- Schedule for later1- Send immediately
- Smart Send: Optimizes delivery time based on recipient engagement
- Contact Timezone: Sends at specified time in each contactβs timezone
- HTML content is required
- Plain text version recommended for better deliverability
- Preview text improves open rates
- Subject line personalization supported
Authorizations
Team API key for authentication. Find your API key in SendX Settings β Team API Key.
Example:
X-Team-ApiKey: your_team_api_key_here
Body
Campaign name for internal organization
255"Spring Sale Campaign"
Email subject line with personalization support.
Features:
- Supports template variables ({{contact.firstName}})
- Emoji support for better engagement
- A/B testing variations supported
255"πΈ Spring Sale - {{contact.firstName}}, Save 30%!"
Sender identifier.
Note: Sender must be verified before use
^(sender_)?[a-zA-Z0-9]{22}$"sender_4vK3WFhMgvOwUNyaL4QxCD"
HTML content of the email campaign
"<html><body><h1>Spring Sale!</h1><p>Save 30% on all items</p></body></html>"
Preview text shown in email clients
255"Limited time offer - 30% off everything!"
Plain text version for better deliverability
"Spring Sale!\n\nSave 30% on all items..."
Campaign scheduling type.
Values:
0- Schedule for specific date/time1- Send immediately
0
datetime for scheduled campaigns (required if scheduleType=0)
"2024-03-20"
Time condition for scheduled campaigns in HH:MM PM/AM format
"9:00 AM"
Timezone for scheduled campaigns (IANA format)
"America/New_York"
Preferred timezone for smart send optimization (required for smartSend and sendInContactsTimezone)
"America/Los_Angeles"
Preferred time optimization setting (required for smartSend and sendInContactsTimezone)
"10:00 AM"
Send at specified time in each contact's timezone
true
Enable AI-powered send time optimization
true
Segment IDs to include
^segment_[a-zA-Z0-9]{22}$["segment_v3nooFn4M423mFomfml4P"]
List IDs to include
^(list_)?[a-zA-Z0-9]{22}$["list_vUCjsUmrVXtSppS8rD0Ssq"]
Tag IDs to include
^(tag_)?[a-zA-Z0-9]{22}$["tag_6GN4DNyrHNt4KktCNG8PDO"]
Segment IDs to exclude
^segment_[a-zA-Z0-9]{22}$["segment_v3nooFn4M423mFomfml4P"]
List IDs to exclude
^(list_)?[a-zA-Z0-9]{22}$["list_0tOFLp5RgV7s3LNiHrjGYs"]
Tag IDs to exclude (prefix automatically stripped)
^(tag_)?[a-zA-Z0-9]{22}$["tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"]
Response
β Campaign created successfully
Campaign ID, with prefix
^campaign_[a-zA-Z0-9]{22}$"campaign_4vK3WFhMgvOwUNyaL4QxCD"
Internal campaign name
"Summer Sale 2024"
Email subject line
"π Summer Sale - 50% Off Everything!"
Sender id
"sender_4vK3WFhMgvOwUNyaL4QxCD"
Campaign status.
Values:
0- Draft1- Scheduled2- Sending3- Sent4- Quarantined5- Evaluating6- Evaluation failed7- Warming up8- Warming up paused9- Spread sending paused
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 1
Campaign scheduling type.
Values:
0- Schedule later1- Send Now
0, 1, 2, 3 datetime for scheduled campaigns (required if scheduleType=1)
"2024-12-30"
Included list IDs with prefix
^list_[a-zA-Z0-9]{22}$[
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
]
Excluded list IDs with prefix
^list_[a-zA-Z0-9]{22}$["list_Mn7Op8Qr9St0Uv1Wx2Yz3A"]
HTML email content. Matches the htmlCode field accepted on create/update.
Returned by GET /campaign/{id}, POST /campaign, and PUT /campaign/{id}
only. Omitted from the GET /campaign list response β campaign HTML is
large, so the list endpoint stays lean. Fetch a single campaign to read it.
"<html><body><h1>Summer Sale</h1></body></html>"
Plain text email content. Currently auto-generated from htmlCode on
create/update rather than taken from the request. Omitted from the list
response, like htmlCode.
"Summer Sale"
Email preview text (preheader). Omitted from the list response, like
htmlCode.
"Limited time offer - Shop now!"
Time-related condition for the campaign
"9:00 AM"
Campaign timezone
"America/New_York"
Timezone for the scheduled send
"America/New_York"
Send at specified time in each contact's timezone
true
Preferred time condition, in case of smartSend and sendInContactTimeZone
"10:00 AM"
Preferred timezone for smart send optimization
"America/Los_Angeles"
Campaign delivery strategy
"Batch Sending"
Included segment IDs
^segment_[a-zA-Z0-9]{22}$["segment_engaged_30_days"]
Included tag IDs with prefix
^tag_[a-zA-Z0-9]{22}$[
"tag_6GN4DNyrHNt4KktCNG8PDO",
"tag_UhsDkjL772Qbj5lWtT62VK"
]
Excluded segment IDs
^segment_[a-zA-Z0-9]{22}$[]
Excluded tag IDs with prefix
^tag_[a-zA-Z0-9]{22}$["tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"]
Whether the campaign has been archived
false
URL of the generated campaign preview screenshot. Empty until the screenshot job completes.
Whether autowarmup is enabled for this campaign
false
Autowarmup pacing type
0
Autowarmup starting level
0
Whether plain warmup is enabled for this campaign
false
Plain warmup starting level
0
Was this page helpful?