curl --request PUT \
--url https://cloudapi.mailercloud.com/v1/campaign/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"email_preheader": "Prime member: You have an unused Prime benefit",
"html": "<html><body> Edited Sample HTML </body></html>"
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/campaign/{id}"
payload = {
"email_preheader": "Prime member: You have an unused Prime benefit",
"html": "<html><body> Edited Sample HTML </body></html>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({
email_preheader: 'Prime member: You have an unused Prime benefit',
html: '<html><body> Edited Sample HTML </body></html>'
})
};
fetch('https://cloudapi.mailercloud.com/v1/campaign/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloudapi.mailercloud.com/v1/campaign/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email_preheader' => 'Prime member: You have an unused Prime benefit',
'html' => '<html><body> Edited Sample HTML </body></html>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloudapi.mailercloud.com/v1/campaign/{id}"
payload := strings.NewReader("{\n \"email_preheader\": \"Prime member: You have an unused Prime benefit\",\n \"html\": \"<html><body> Edited Sample HTML </body></html>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"message": "Campaign has been updated"
}{
"error": {
"field": "string",
"message": "string"
}
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}{
"errors": [
{
"field": "id",
"message": "Record not found with the given Id"
}
]
}Update Campaign
API for updating the campaign. Can’t change or edit the list, segments, pause_rule, rules for the campaigns in sending status. Pause the campaign to edit the scheduled date.
curl --request PUT \
--url https://cloudapi.mailercloud.com/v1/campaign/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"email_preheader": "Prime member: You have an unused Prime benefit",
"html": "<html><body> Edited Sample HTML </body></html>"
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/campaign/{id}"
payload = {
"email_preheader": "Prime member: You have an unused Prime benefit",
"html": "<html><body> Edited Sample HTML </body></html>"
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({
email_preheader: 'Prime member: You have an unused Prime benefit',
html: '<html><body> Edited Sample HTML </body></html>'
})
};
fetch('https://cloudapi.mailercloud.com/v1/campaign/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://cloudapi.mailercloud.com/v1/campaign/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'email_preheader' => 'Prime member: You have an unused Prime benefit',
'html' => '<html><body> Edited Sample HTML </body></html>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://cloudapi.mailercloud.com/v1/campaign/{id}"
payload := strings.NewReader("{\n \"email_preheader\": \"Prime member: You have an unused Prime benefit\",\n \"html\": \"<html><body> Edited Sample HTML </body></html>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"message": "Campaign has been updated"
}{
"error": {
"field": "string",
"message": "string"
}
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}{
"errors": [
{
"field": "id",
"message": "Record not found with the given Id"
}
]
}Authorizations
Your Mailercloud API key (plain text, no Bearer prefix). Create keys in Settings → API.
Headers
application/json
Path Parameters
Campaign Id
Body
Email 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.
1Recipients of your email campaign.
Contact list id. Before setting list id please check your contact count in list.
true - Mailing preference option will be displayed in footer of email campaign template.
false - Mailing preference option will not be dispalyed.
Name of the campaign.
Minimum: 1
Maximum: 150
1Optional
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 permission reminder 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.
Supported contacts_order : first, last.
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.
1Show child attributes
Show child attributes
Subject of the campaign.
Minimum: 1
Maximum: 150
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
OK
1