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{
"name": "Summer Sale 2024",
"subject": "π Summer Sale - 50% Off Everything!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"scheduleType": 0,
"scheduleCondition": "2024-12-30",
"timezone": "America/New_York",
"includedLists": [
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
],
"excludedLists": [
"list_Mn7Op8Qr9St0Uv1Wx2Yz3A"
],
"id": "campaign_6h8DnYrHt4KktCnG8PDO5Z",
"preheader": "Limited time offer - Shop now!",
"htmlContent": "<string>",
"textContent": "<string>",
"status": 123,
"isArchived": false,
"campaignScreenshotUrl": "https://cdn.sendx.io/campaigns/screenshot_abc123.png",
"timeCondition": "9:00 AM",
"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"
],
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}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{
"name": "Summer Sale 2024",
"subject": "π Summer Sale - 50% Off Everything!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"scheduleType": 0,
"scheduleCondition": "2024-12-30",
"timezone": "America/New_York",
"includedLists": [
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
],
"excludedLists": [
"list_Mn7Op8Qr9St0Uv1Wx2Yz3A"
],
"id": "campaign_6h8DnYrHt4KktCnG8PDO5Z",
"preheader": "Limited time offer - Shop now!",
"htmlContent": "<string>",
"textContent": "<string>",
"status": 123,
"isArchived": false,
"campaignScreenshotUrl": "https://cdn.sendx.io/campaigns/screenshot_abc123.png",
"timeCondition": "9:00 AM",
"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"
],
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}- 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
Internal campaign name
"Summer Sale 2024"
Email subject line
"π Summer Sale - 50% Off Everything!"
Sender id
"sender_4vK3WFhMgvOwUNyaL4QxCD"
Campaign scheduling type.
Values:
0- Schedule later1- Send Now
datetime for scheduled campaigns (required if scheduleType=1)
"2024-12-30"
Campaign timezone
"America/New_York"
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"]
Unique ID for the campaign
"campaign_6h8DnYrHt4KktCnG8PDO5Z"
Email preview text
"Limited time offer - Shop now!"
HTML email content
Plain text email content
Campaign status.
Values:
0- Draft1- Scheduled2- Sending3- Sent4- Quarantined5- Evaluating6- Evaluation Failed7- Warming Up
Whether the campaign is archived
false
URL to the campaign screenshot
"https://cdn.sendx.io/campaigns/screenshot_abc123.png"
Time-related condition for the campaign
"9:00 AM"
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"]
Was this page helpful?