Skip to content

Create a draft campaign (M5 content, M3 audience, sender and connection)

POST
/v1/brands/{brand}/campaigns
curl --request POST \
--url https://api.replifier.com/v1/brands/brd_01hx0000000000000000000000/campaigns \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "channel": "email", "subject": "example", "preheader": "example", "fromName": "example", "fromEmail": "hello@example.com", "replyTo": "hello@example.com", "connectionId": "example", "content": { "additionalProperty": "example" }, "senderId": "example", "whatsappTemplate": { "name": "example", "language": "example", "variables": { "additionalProperty": "example" } }, "smsBody": "example", "phoneField": "example", "audience": { "lists": [], "segments": [], "excludeLists": [], "excludeSegments": [] }, "trackingMode": "full", "gdprSafeSwitch": true, "templateVersionId": "example", "localSend": { "mode": "local_time", "date": "example", "time": "example" }, "abTest": { "dimension": "subject", "variants": [ { "subject": "example", "fromName": "example", "fromEmail": "hello@example.com", "content": { "additionalProperty": "example" } } ], "samplePct": 20, "waitMinutes": 240, "criterion": "opens" }, "notifyOnComplete": true, "trackingParams": "example" }'
brand
required
string
/^brd_[a-z0-9]{26}$/

Example

brd_01hx0000000000000000000000
Media typeapplication/json
object
name
required
string
>= 1 characters <= 200 characters /^[^\x00-\x1f\x7f]*$/
channel

Sending channel. Defaults to email.

string
Allowed values: email whatsapp sms
subject
string
>= 1 characters <= 998 characters /^[^\x00-\x1f\x7f]*$/
preheader
string
nullable <= 500 characters /^[^\x00-\x1f\x7f]*$/
fromName
string
nullable <= 120 characters /^[^\x00-\x1f\x7f]*$/
fromEmail
string format: email
<= 254 characters
replyTo
string format: email
nullable <= 254 characters
connectionId
string
<= 64 characters
content

M5 document (schemaVersion 1). Email only.

object
key
additional properties
nullable
senderId

Messaging sender (messaging_senders.id). Required for WhatsApp and SMS.

string
<= 64 characters
whatsappTemplate

WhatsApp template. Required when channel=“whatsapp”.

object
name
required

Name of the approved template in WhatsApp Business

string
>= 1 characters <= 200 characters /^[^\x00-\x1f\x7f]*$/
language
required

Template language code (e.g. “es”, “es_MX”)

string
<= 10 characters /^[a-z]{2,3}(_[A-Z]{2})?$/
variables

Template body variables (key → value)

object
key
additional properties
string
<= 2048 characters
smsBody

SMS body. Required when channel=“sms”.

string
nullable >= 1 characters <= 1600 characters
phoneField

Field in contact.fields holding the E.164 number. Defaults to “phone”.

string
nullable <= 100 characters
audience
object
lists
Array<string>
default: <= 50 items
segments
Array<string>
default: <= 50 items
excludeLists
Array<string>
default: <= 50 items
excludeSegments
Array<string>
default: <= 50 items
trackingMode
string
Allowed values: full anonymous none
gdprSafeSwitch

GDPR safe switch: excludes contacts tagged gdpr that have no current consent. Defaults to true on new campaigns (campaigns that existed before the migration were left as false)

boolean
templateVersionId

Template version (M5.6) the content is taken from: it stays pinned to the campaign. Not sent together with content

string
nullable /^tpv_[a-z0-9]{26}$/
localSend

Send by contact time zone or optimal time (M6.6). Without a known time zone, the brand’s is used. Draft only

object
mode
required

local_time: at the requested local time in each contact’s time zone; optimal: at the hour with the most real opens for the contact in the last 90 days

string
Allowed values: local_time optimal
date
required

Local date, YYYY-MM-DD

string
/^\d{4}-\d{2}-\d{2}$/
time
required

Local time HH:MM; with optimal, the fallback time for contacts without history

string
/^([01]\d|2[0-3]):[0-5]\d$/
abTest

A/B test (M6.5): 2 to 4 variants of subject, sender or content. Draft only

object
dimension
required

What changes between variants: subject, sender (name or email) or content

string
Allowed values: subject from content
variants
required
Array<object>
>= 2 items <= 4 items
object
subject
string
>= 1 characters <= 998 characters /^[^\x00-\x1f\x7f]*$/
fromName
string
>= 1 characters <= 120 characters /^[^\x00-\x1f\x7f]*$/
fromEmail
string format: email
<= 254 characters
content

M5 document (schemaVersion 1)

object
key
additional properties
nullable
samplePct

Percentage of the audience that receives the variants (split evenly); the rest waits for the winner

integer
default: 20 >= 1 <= 50
waitMinutes

Wait time, from when the sample goes out, before picking the winner

integer
default: 240 >= 5 <= 10080
criterion

Opens/clicks: the highest real open or click rate wins; manual: a person picks it (:pick-winner), with no wait limit

string
default: opens
Allowed values: opens clicks manual
notifyOnComplete

Notify the person who launched the campaign by email when it finishes sending (S5.18). Defaults to true

boolean
trackingParams

Query string template appended to the destination of each tracked link (S5.4). Variables: {{brand}}, {{campaign}}, {{brand_id}}, {{campaign_id}}, {{send_id}}, {{org_id}}. Example: utm_source={{brand}}&utm_campaign={{campaign}}

string
nullable <= 2000 characters /^[^\x00-\x1f\x7f]*$/

Campaign

Media typeapplication/json
object
id
required
string
brandId
required
string
name
required
string
kind
required

plan: per-contact send plan (M6.9); its rows are supplied by whoever builds it

string
Allowed values: campaign plan
status
required
string
Allowed values: draft scheduled awaiting_approval preparing sending paused completed cancelled failed
channel
required

Sending channel

string
Allowed values: email whatsapp sms
subject
required
string
nullable
preheader
required
string
nullable
fromName
required
string
nullable
fromEmail
required
string
nullable
replyTo
required
string
nullable
connectionId
required
string
nullable
senderId
required

Messaging sender (messaging_senders.id); null for email campaigns

string
nullable
phoneField
required

Field in contact.fields holding the E.164 number; null for email campaigns

string
nullable
trackingMode
required
string
Allowed values: full anonymous none
gdprSafeSwitch
required

Whether GDPR contacts without current consent are excluded

boolean
plainText
required

Hand-edited plain text; null = generated from the HTML at send time (DAT-3166)

string
nullable
plainTextEdited
required

“Hand-edited” flag: the email is sent with plainText instead of the generated text

boolean
plainTextStale
required

The HTML changed after the plain text was edited: warn and offer to regenerate it (plainText: null) or keep it (save it again)

boolean
notifyOnComplete
required

Whether the person who launched the campaign is notified by email when sending finishes

boolean
trackingParams
required

Query string template appended to the destination of each tracked link (S5.4)

string
nullable
content
required
object
key
additional properties
nullable
templateVersionId
required

Template version it was built from (pinned outside draft)

string
nullable
audience
required
object
lists
Array<string>
default: <= 50 items
segments
Array<string>
default: <= 50 items
excludeLists
Array<string>
default: <= 50 items
excludeSegments
Array<string>
default: <= 50 items
scheduledAt
required
string
nullable
localSend
required
object
mode
required

local_time: at the requested local time in each contact’s time zone; optimal: at the hour with the most real opens for the contact in the last 90 days

string
Allowed values: local_time optimal
date
required

Local date, YYYY-MM-DD

string
/^\d{4}-\d{2}-\d{2}$/
time
required

Local time HH:MM; with optimal, the fallback time for contacts without history

string
/^([01]\d|2[0-3]):[0-5]\d$/
autoPause
required

Custom auto-pause thresholds; null = the defaults (bounces 5%, complaints 0.1%, over 1,000 accepted sends)

object
bounceRate
required

Bounce rate over accepted sends that pauses the campaign (0.05 = 5%)

number
<= 1
complaintRate
required

Complaint rate that pauses the campaign (0.001 = 0.1%)

number
<= 1
minDeliveries
required

Minimum accepted sends before measuring

integer
>= 1 <= 10000000
deferredByWarmup

Only when fetching a single campaign: rows that connection warm-up moved to a later day

number
abTest
required

Normalized A/B test (variants keyed A..D)

object
key
additional properties
nullable
ab
required
object
phase
required
string
nullable
Allowed values: testing decided
winner
required
string
nullable
waitUntil
required
string
nullable
decidedBy
required

system if chosen by the criterion, or the id of whoever picked it manually

string
nullable
reason
required
string
nullable
Allowed values: opens clicks manual tie no_data
decidedAt
required
string
nullable
pauseReason
required
string
nullable
approvalRequestedBy
required
string
nullable
approvalDecidedBy
required
string
nullable
approvalReason
required
string
nullable
approvalAskReason
required

Why preparation requested approval again at start (DAT-2854): audience_changed (never approved and the audience crossed the threshold), audience_grew (approved, but the audience grew by more than 10%) or segment_changed (approved, but the definition of a segment or list changed). Null if the approval was requested by :send or :schedule.

string
nullable
Allowed values: audience_changed audience_grew segment_changed
approvedRecipients
required

Contacts in the audience when it was approved (DAT-2854); with more than 10% above this, or with a changed segment or list, the campaign returns to awaiting_approval at start. Null if not approved.

integer
nullable
failureReason
required

Why it ended up failed (e.g. segment_invalid: a segment in its audience is deleted or no longer exists; list_invalid: a list in its audience is deleted or no longer exists; campaign_tags_unknown: the email uses a tag, field, list or segment that no longer exists)

string
nullable
statusInfo
required

Unified status with reason (if any) and recommended action as i18n keys

object
status
required
string
Allowed values: draft scheduled awaiting_approval preparing sending paused completed cancelled failed
reason
required

Full i18n key of the reason (e.g. campaign.pause_reason.bounce_rate); null if not applicable

string
nullable
recommendedAction
required

Full i18n key of the recommended action (e.g. campaign.action.resume_or_cancel)

string
createdBy
required
string
nullable
counts
object
queued
required
number
sending
required
number
accepted
required
number
skipped
required
number
failed
required
number
attachments

Campaign attachments (S5.6); only returned when fetching a single campaign

Array<object>
object
id
required
string
fileVersionId
required
string
name
required
string
mime
required
string
bytes
required
number
position
required
integer
createdAt
required
string
createdAt
required
string
updatedAt
required
string

Example

{
"kind": "campaign",
"status": "draft",
"channel": "email",
"trackingMode": "full",
"audience": {
"lists": [],
"segments": [],
"excludeLists": [],
"excludeSegments": []
},
"localSend": {
"mode": "local_time"
},
"ab": {
"phase": "testing",
"reason": "opens"
},
"approvalAskReason": "audience_changed",
"statusInfo": {
"status": "draft"
}
}

Invalid data

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

No session, expired session, or invalid, expired or revoked API key

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Not allowed, API key missing the scope, IP not allowed, or request rejected (csrf_rejected)

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Does not exist or is not visible to you

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}

Internal error

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
cause
required
string
fix
required
string
requestId
required
string

Example

{
"error": {
"code": "not_found"
}
}