Create Campaign
Create a draft campaign.
MethodPOST
/api/v2/campaignsCreates a draft campaign. Permission: campaigns.
Omitted MAILY content gets a default template with an unsubscribe link. Omitted HTML content gets an HTML starter that already includes {{unsubscribeUrl}}. Omitted senderId uses the default sender, then last used, then any available sender. Rendering does not add a footer.
{
"subject": "Product update",
"contentType": "HTML",
"content": "<html><body><table role=\"presentation\"><tr><td>Hello {{name}}</td></tr></table><p><a href=\"{{unsubscribeUrl}}\">Unsubscribe</a></p></body></html>"
}Body Parameters
| Name | Type | Description |
|---|---|---|
subject | string | Required. Email subject line. |
name | string | Campaign name. Default Untitled. Max 100. |
preview | string or null | Preview / preheader text. |
content | unknown | MAILY: TipTap JSON. HTML: a raw HTML string that already includes <a href="{{unsubscribeUrl}}">Unsubscribe</a>. Rendering does not add a footer. |
contentType | "MAILY" | "HTML" | Content format. Default MAILY. |
senderId | string | Email sender id. Defaults to the org default sender. |
replyTo | string or null | Reply-To address. |
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Campaign id. |
name | string | Campaign name. |
subject | string | Subject line. |
preview | string or null | Preview text. |
status | string | Always DRAFT on create. |
contentType | string | MAILY or HTML. |
senderId | string | Assigned sender id. |
replyTo | string or null | Reply-To address. |
createdAt | string | ISO 8601 created timestamp. |
Errors
| Status | name | When |
|---|---|---|
| 401 | missing_api_key | Missing or invalid bearer token |
| 403 | missing_permission | Token lacks the campaigns permission |
| 422 | validation_error | Missing subject or invalid payload |