curl --request POST \
--url https://cloudapi.mailercloud.com/v1/campaign \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"html": "<html><body> Sample HTML </body></html>",
"list_ids": [
"sCVJ",
"ghy"
],
"name": "Campaign name",
"sender": {
"sender_email": "sender@yourdomain.com",
"sender_name": "Sender Name"
},
"scheduled_at": "2021-04-17 15:48:00",
"subject": "Prime member notification."
}
'{
"id": "hdjh"
}{
"errors": [
{
"field": "sender_email",
"message": "sender_email must be a valid email address"
},
{
"field": "reply_email",
"message": "reply_email must be a valid email address"
}
]
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}Create Campaign
A newer version of this endpoint with more options is available: Create Campaign (v2).
API for creating an email campaign. For creating a campaign, HTML or plain text and list id or segment are mandatory.
curl --request POST \
--url https://cloudapi.mailercloud.com/v1/campaign \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"html": "<html><body> Sample HTML </body></html>",
"list_ids": [
"sCVJ",
"ghy"
],
"name": "Campaign name",
"sender": {
"sender_email": "sender@yourdomain.com",
"sender_name": "Sender Name"
},
"scheduled_at": "2021-04-17 15:48:00",
"subject": "Prime member notification."
}
'{
"id": "hdjh"
}{
"errors": [
{
"field": "sender_email",
"message": "sender_email must be a valid email address"
},
{
"field": "reply_email",
"message": "reply_email must be a valid email address"
}
]
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}Authorizations
Your Mailercloud API key (plain text, no Bearer prefix). Create keys in Settings → API.
Headers
Request body type
Body
Recipients of your email campaign.
List of contact lists ids, to which you want to send your campaign.
Format: Array of strings.
Name of the campaign.
Minimum: 1
Maximum: 150
1Show child attributes
Show child attributes
Subject of the campaign.
Minimum: 1
Maximum: 150
1Email preheader is the summary text that follows a subject line when the email is viewed in an inbox. In many cases, it’s used to provide a short summary of the email, and is typically one sentence long.
Minimum: 1
Maximum: 150
1HTML template content for your email campaign.
1true - Mailing preference option will be displayed in footer of email campaign template.
false - Mailing preference option will not be dispalyed.
Optional
If you want to set a rule for sending a campaign, use this option. Based on the configured rule, the campaign will be sent.
Show child attributes
Show child attributes
The email disclaimer content in your email campaign. If you want give unsubscribe link give %%unsubscribe%%
Minimum: 1
Maximum: 150
1Plain text content of your email campaign.
1Email on which the campaign recipients will be able to reply to. If replay_email empty then sender email will be the reply email.
1Spam reporting enable or disable.
Show child attributes
Show child attributes
Schedule time for your email campaign. Pass your timezone date-time format for accurate results.
Format: 2021-04-23 15:04:05
1Your recipient segment id.
1true: Enable the "View this email in your browser" in Campaign preview page.
false: Disable the "View this email in your browser" in Campaign preview page.
Response
Created