Skip to main content
POST
/
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 '{
"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"
]
}'
{
"id": "campaign_6h8DnYrHt4KktCnG8PDO5Z",
"name": "Summer Sale 2024",
"subject": "🌞 Summer Sale - 50% Off Everything!",
"preheader": "Limited time offer - Shop now!",
"sender": "sender_4vK3WFhMgvOwUNyaL4QxCD",
"htmlContent": "<string>",
"textContent": "<string>",
"status": 123,
"isArchived": false,
"campaignScreenshotUrl": "https://cdn.sendx.io/campaigns/screenshot_abc123.png",
"scheduleType": 0,
"scheduleCondition": "2024-12-30",
"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"
],
"includedLists": [
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
],
"includedTags": [
"tag_6GN4DNyrHNt4KktCNG8PDO",
"tag_UhsDkjL772Qbj5lWtT62VK"
],
"excludedSegments": [],
"excludedLists": [
"list_Mn7Op8Qr9St0Uv1Wx2Yz3A"
],
"excludedTags": [
"tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"
],
"created": "2023-11-07T05:31:56Z",
"updated": "2023-11-07T05:31:56Z"
}
🎯 Campaign Features:
  • Target specific lists, tags, and segments
  • Schedule campaigns or send immediately
  • Smart send optimization
  • Time zone aware delivery
  • A/B testing capabilities
πŸ“… Schedule Types:
  • 0 - Schedule for later
  • 1 - Send immediately
πŸ”§ Advanced Options:
  • Smart Send: Optimizes delivery time based on recipient engagement
  • Contact Timezone: Sends at specified time in each contact’s timezone
🎨 Content Requirements:
  • HTML content is required
  • Plain text version recommended for better deliverability
  • Preview text improves open rates
  • Subject line personalization supported

Authorizations

X-Team-ApiKey
string
header
required

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

application/json
name
string
required

Campaign name for internal organization

Maximum length: 255
Example:

"Spring Sale Campaign"

subject
string
required

Email subject line with personalization support.

Features:

  • Supports template variables ({{contact.firstName}})
  • Emoji support for better engagement
  • A/B testing variations supported
Maximum length: 255
Example:

"🌸 Spring Sale - {{contact.firstName}}, Save 30%!"

sender
string
required

Sender identifier.

Note: Sender must be verified before use

Example:

"sender_4vK3WFhMgvOwUNyaL4QxCD"

htmlCode
string
required

HTML content of the email campaign

Example:

"<html><body><h1>Spring Sale!</h1><p>Save 30% on all items</p></body></html>"

previewText
string

Preview text shown in email clients

Maximum length: 255
Example:

"Limited time offer - 30% off everything!"

plainText
string

Plain text version for better deliverability

Example:

"Spring Sale!\n\nSave 30% on all items..."

scheduleType
integer

Campaign scheduling type.

Values:

  • 0 - Schedule for specific date/time
  • 1 - Send immediately
Example:

0

scheduleCondition
string

datetime for scheduled campaigns (required if scheduleType=0)

Example:

"2024-03-20"

timeCondition
string

Time condition for scheduled campaigns in HH:MM PM/AM format

Example:

"9:00 AM"

timezone
string

Timezone for scheduled campaigns (IANA format)

Example:

"America/New_York"

preferredTimezone
string

Preferred timezone for smart send optimization (required for smartSend and sendInContactsTimezone)

Example:

"America/Los_Angeles"

preferredTimeCondition
string

Preferred time optimization setting (required for smartSend and sendInContactsTimezone)

Example:

"10:00 AM"

sendInContactsTimezone
boolean

Send at specified time in each contact's timezone

Example:

true

smartSend
boolean

Enable AI-powered send time optimization

Example:

true

includedSegments
string[]

Segment IDs to include

Example:
["segment_v3nooFn4M423mFomfml4P"]
includedLists
string[]

List IDs to include

Example:
["list_vUCjsUmrVXtSppS8rD0Ssq"]
includedTags
string[]

Tag IDs to include

Example:
["tag_6GN4DNyrHNt4KktCNG8PDO"]
excludedSegments
string[]

Segment IDs to exclude

Example:
["segment_v3nooFn4M423mFomfml4P"]
excludedLists
string[]

List IDs to exclude

Example:
["list_0tOFLp5RgV7s3LNiHrjGYs"]
excludedTags
string[]

Tag IDs to exclude (prefix automatically stripped)

Example:
["tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"]

Response

βœ… Campaign created successfully

name
string
required

Internal campaign name

Example:

"Summer Sale 2024"

subject
string
required

Email subject line

Example:

"🌞 Summer Sale - 50% Off Everything!"

sender
string
required

Sender id

Example:

"sender_4vK3WFhMgvOwUNyaL4QxCD"

scheduleType
integer
default:0
required

Campaign scheduling type.

Values:

  • 0 - Schedule later
  • 1 - Send Now
scheduleCondition
string
required

datetime for scheduled campaigns (required if scheduleType=1)

Example:

"2024-12-30"

timezone
string
required

Campaign timezone

Example:

"America/New_York"

includedLists
string[]
required

Included list IDs with prefix

Example:
[
"list_vUCjsUmrVXtSppS8rD0Ssq",
"list_0tOFLp5RgV7s3LNiHrjGYs"
]
excludedLists
string[]
required

Excluded list IDs with prefix

Example:
["list_Mn7Op8Qr9St0Uv1Wx2Yz3A"]
id
string

Unique ID for the campaign

Example:

"campaign_6h8DnYrHt4KktCnG8PDO5Z"

preheader
string

Email preview text

Example:

"Limited time offer - Shop now!"

htmlContent
string

HTML email content

textContent
string

Plain text email content

status
integer

Campaign status.

Values:

  • 0 - Draft
  • 1 - Scheduled
  • 2 - Sending
  • 3 - Sent
  • 4 - Quarantined
  • 5 - Evaluating
  • 6 - Evaluation Failed
  • 7 - Warming Up
isArchived
boolean

Whether the campaign is archived

Example:

false

campaignScreenshotUrl
string

URL to the campaign screenshot

Example:

"https://cdn.sendx.io/campaigns/screenshot_abc123.png"

timeCondition
string

Time-related condition for the campaign

Example:

"9:00 AM"

smartSend
boolean

Timezone for the scheduled send

Example:

"America/New_York"

sendInContactsTimezone
boolean

Send at specified time in each contact's timezone

Example:

true

preferredTimeCondition
string

Preferred time condition, in case of smartSend and sendInContactTimeZone

Example:

"10:00 AM"

preferredTimezone
string

Preferred timezone for smart send optimization

Example:

"America/Los_Angeles"

strategy
string

Campaign delivery strategy

Example:

"Batch Sending"

includedSegments
string[]

Included segment IDs

Example:
["segment_engaged_30_days"]
includedTags
string[]

Included tag IDs with prefix

Example:
[
"tag_6GN4DNyrHNt4KktCNG8PDO",
"tag_UhsDkjL772Qbj5lWtT62VK"
]
excludedSegments
string[]

Excluded segment IDs

Example:
[]
excludedTags
string[]

Excluded tag IDs with prefix

Example:
["tag_Bv4Wq9Xp6Zn5Ly0Kt8JhQe"]
created
string<date-time>
updated
string<date-time>
⌘I