Create a draft campaign (M5 content, M3 audience, sender and connection)
const url = 'https://api.replifier.com/v1/brands/brd_01hx0000000000000000000000/campaigns';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
brd_01hx0000000000000000000000Request Bodyrequired
Section titled “Request Bodyrequired”object
Sending channel. Defaults to email.
M5 document (schemaVersion 1). Email only.
object
Messaging sender (messaging_senders.id). Required for WhatsApp and SMS.
WhatsApp template. Required when channel=“whatsapp”.
object
Name of the approved template in WhatsApp Business
Template language code (e.g. “es”, “es_MX”)
Template body variables (key → value)
object
SMS body. Required when channel=“sms”.
Field in contact.fields holding the E.164 number. Defaults to “phone”.
object
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)
Template version (M5.6) the content is taken from: it stays pinned to the campaign. Not sent together with content
Send by contact time zone or optimal time (M6.6). Without a known time zone, the brand’s is used. Draft only
object
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
Local date, YYYY-MM-DD
Local time HH:MM; with optimal, the fallback time for contacts without history
A/B test (M6.5): 2 to 4 variants of subject, sender or content. Draft only
object
What changes between variants: subject, sender (name or email) or content
object
M5 document (schemaVersion 1)
object
Percentage of the audience that receives the variants (split evenly); the rest waits for the winner
Wait time, from when the sample goes out, before picking the winner
Opens/clicks: the highest real open or click rate wins; manual: a person picks it (:pick-winner), with no wait limit
Notify the person who launched the campaign by email when it finishes sending (S5.18). Defaults to true
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}}
Responses
Section titled “Responses”Campaign
object
plan: per-contact send plan (M6.9); its rows are supplied by whoever builds it
Sending channel
Messaging sender (messaging_senders.id); null for email campaigns
Field in contact.fields holding the E.164 number; null for email campaigns
Whether GDPR contacts without current consent are excluded
Hand-edited plain text; null = generated from the HTML at send time (DAT-3166)
“Hand-edited” flag: the email is sent with plainText instead of the generated text
The HTML changed after the plain text was edited: warn and offer to regenerate it (plainText: null) or keep it (save it again)
Whether the person who launched the campaign is notified by email when sending finishes
Query string template appended to the destination of each tracked link (S5.4)
object
Template version it was built from (pinned outside draft)
object
object
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
Local date, YYYY-MM-DD
Local time HH:MM; with optimal, the fallback time for contacts without history
Custom auto-pause thresholds; null = the defaults (bounces 5%, complaints 0.1%, over 1,000 accepted sends)
object
Bounce rate over accepted sends that pauses the campaign (0.05 = 5%)
Complaint rate that pauses the campaign (0.001 = 0.1%)
Minimum accepted sends before measuring
Only when fetching a single campaign: rows that connection warm-up moved to a later day
Normalized A/B test (variants keyed A..D)
object
object
system if chosen by the criterion, or the id of whoever picked it manually
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.
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.
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)
Unified status with reason (if any) and recommended action as i18n keys
object
Full i18n key of the reason (e.g. campaign.pause_reason.bounce_rate); null if not applicable
Full i18n key of the recommended action (e.g. campaign.action.resume_or_cancel)
object
Campaign attachments (S5.6); only returned when fetching a single campaign
object
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
object
object
Example
{ "error": { "code": "not_found" }}No session, expired session, or invalid, expired or revoked API key
object
object
Example
{ "error": { "code": "not_found" }}Not allowed, API key missing the scope, IP not allowed, or request rejected (csrf_rejected)
object
object
Example
{ "error": { "code": "not_found" }}Does not exist or is not visible to you
object
object
Example
{ "error": { "code": "not_found" }}Internal error
object
object
Example
{ "error": { "code": "not_found" }}