curl --request POST \
--url https://api.campaigncleaner.com/v1/send_campaign \
--header 'Content-Type: application/json' \
--data '
{
"send_campaign": {
"campaign_html": "<html><body>Your Campaign HTML</body></html>",
"campaign_name": "My Campaign",
"adjust_font_colors": true,
"adjust_font_size": true,
"min_font_size_allowed": 10,
"max_font_size_allowed": 32,
"convert_h_to_p_tags": false,
"convert_tables_to_divs": false,
"custom_info": "",
"host_extensionless_images": false,
"inline_css": true,
"inline_css_important": false,
"media_queries_important": true,
"preserve_media_queries": true,
"relative_links_base_url": "",
"remove_classes_and_ids": true,
"remove_comments": true,
"remove_control_non_printable": false,
"remove_css_inheritance": true,
"remove_image_height": true,
"remove_successive_punctuation": true,
"replace_diacritics": true,
"replace_non_ascii_characters": true,
"resize_and_host": true,
"webhook_url": "",
"surrounding_div": {
"max_width": 600,
"text_align": "left",
"font_size": 15,
"center_to_parent": true
}
}
}
'import requests
url = "https://api.campaigncleaner.com/v1/send_campaign"
payload = { "send_campaign": {
"campaign_html": "<html><body>Your Campaign HTML</body></html>",
"campaign_name": "My Campaign",
"adjust_font_colors": True,
"adjust_font_size": True,
"min_font_size_allowed": 10,
"max_font_size_allowed": 32,
"convert_h_to_p_tags": False,
"convert_tables_to_divs": False,
"custom_info": "",
"host_extensionless_images": False,
"inline_css": True,
"inline_css_important": False,
"media_queries_important": True,
"preserve_media_queries": True,
"relative_links_base_url": "",
"remove_classes_and_ids": True,
"remove_comments": True,
"remove_control_non_printable": False,
"remove_css_inheritance": True,
"remove_image_height": True,
"remove_successive_punctuation": True,
"replace_diacritics": True,
"replace_non_ascii_characters": True,
"resize_and_host": True,
"webhook_url": "",
"surrounding_div": {
"max_width": 600,
"text_align": "left",
"font_size": 15,
"center_to_parent": True
}
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
send_campaign: {
campaign_html: '<html><body>Your Campaign HTML</body></html>',
campaign_name: 'My Campaign',
adjust_font_colors: true,
adjust_font_size: true,
min_font_size_allowed: 10,
max_font_size_allowed: 32,
convert_h_to_p_tags: false,
convert_tables_to_divs: false,
custom_info: '',
host_extensionless_images: false,
inline_css: true,
inline_css_important: false,
media_queries_important: true,
preserve_media_queries: true,
relative_links_base_url: '',
remove_classes_and_ids: true,
remove_comments: true,
remove_control_non_printable: false,
remove_css_inheritance: true,
remove_image_height: true,
remove_successive_punctuation: true,
replace_diacritics: true,
replace_non_ascii_characters: true,
resize_and_host: true,
webhook_url: '',
surrounding_div: {max_width: 600, text_align: 'left', font_size: 15, center_to_parent: true}
}
})
};
fetch('https://api.campaigncleaner.com/v1/send_campaign', 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://api.campaigncleaner.com/v1/send_campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'send_campaign' => [
'campaign_html' => '<html><body>Your Campaign HTML</body></html>',
'campaign_name' => 'My Campaign',
'adjust_font_colors' => true,
'adjust_font_size' => true,
'min_font_size_allowed' => 10,
'max_font_size_allowed' => 32,
'convert_h_to_p_tags' => false,
'convert_tables_to_divs' => false,
'custom_info' => '',
'host_extensionless_images' => false,
'inline_css' => true,
'inline_css_important' => false,
'media_queries_important' => true,
'preserve_media_queries' => true,
'relative_links_base_url' => '',
'remove_classes_and_ids' => true,
'remove_comments' => true,
'remove_control_non_printable' => false,
'remove_css_inheritance' => true,
'remove_image_height' => true,
'remove_successive_punctuation' => true,
'replace_diacritics' => true,
'replace_non_ascii_characters' => true,
'resize_and_host' => true,
'webhook_url' => '',
'surrounding_div' => [
'max_width' => 600,
'text_align' => 'left',
'font_size' => 15,
'center_to_parent' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.campaigncleaner.com/v1/send_campaign"
payload := strings.NewReader("{\n \"send_campaign\": {\n \"campaign_html\": \"<html><body>Your Campaign HTML</body></html>\",\n \"campaign_name\": \"My Campaign\",\n \"adjust_font_colors\": true,\n \"adjust_font_size\": true,\n \"min_font_size_allowed\": 10,\n \"max_font_size_allowed\": 32,\n \"convert_h_to_p_tags\": false,\n \"convert_tables_to_divs\": false,\n \"custom_info\": \"\",\n \"host_extensionless_images\": false,\n \"inline_css\": true,\n \"inline_css_important\": false,\n \"media_queries_important\": true,\n \"preserve_media_queries\": true,\n \"relative_links_base_url\": \"\",\n \"remove_classes_and_ids\": true,\n \"remove_comments\": true,\n \"remove_control_non_printable\": false,\n \"remove_css_inheritance\": true,\n \"remove_image_height\": true,\n \"remove_successive_punctuation\": true,\n \"replace_diacritics\": true,\n \"replace_non_ascii_characters\": true,\n \"resize_and_host\": true,\n \"webhook_url\": \"\",\n \"surrounding_div\": {\n \"max_width\": 600,\n \"text_align\": \"left\",\n \"font_size\": 15,\n \"center_to_parent\": true\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.campaigncleaner.com/v1/send_campaign")
.header("Content-Type", "application/json")
.body("{\n \"send_campaign\": {\n \"campaign_html\": \"<html><body>Your Campaign HTML</body></html>\",\n \"campaign_name\": \"My Campaign\",\n \"adjust_font_colors\": true,\n \"adjust_font_size\": true,\n \"min_font_size_allowed\": 10,\n \"max_font_size_allowed\": 32,\n \"convert_h_to_p_tags\": false,\n \"convert_tables_to_divs\": false,\n \"custom_info\": \"\",\n \"host_extensionless_images\": false,\n \"inline_css\": true,\n \"inline_css_important\": false,\n \"media_queries_important\": true,\n \"preserve_media_queries\": true,\n \"relative_links_base_url\": \"\",\n \"remove_classes_and_ids\": true,\n \"remove_comments\": true,\n \"remove_control_non_printable\": false,\n \"remove_css_inheritance\": true,\n \"remove_image_height\": true,\n \"remove_successive_punctuation\": true,\n \"replace_diacritics\": true,\n \"replace_non_ascii_characters\": true,\n \"resize_and_host\": true,\n \"webhook_url\": \"\",\n \"surrounding_div\": {\n \"max_width\": 600,\n \"text_align\": \"left\",\n \"font_size\": 15,\n \"center_to_parent\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.campaigncleaner.com/v1/send_campaign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"send_campaign\": {\n \"campaign_html\": \"<html><body>Your Campaign HTML</body></html>\",\n \"campaign_name\": \"My Campaign\",\n \"adjust_font_colors\": true,\n \"adjust_font_size\": true,\n \"min_font_size_allowed\": 10,\n \"max_font_size_allowed\": 32,\n \"convert_h_to_p_tags\": false,\n \"convert_tables_to_divs\": false,\n \"custom_info\": \"\",\n \"host_extensionless_images\": false,\n \"inline_css\": true,\n \"inline_css_important\": false,\n \"media_queries_important\": true,\n \"preserve_media_queries\": true,\n \"relative_links_base_url\": \"\",\n \"remove_classes_and_ids\": true,\n \"remove_comments\": true,\n \"remove_control_non_printable\": false,\n \"remove_css_inheritance\": true,\n \"remove_image_height\": true,\n \"remove_successive_punctuation\": true,\n \"replace_diacritics\": true,\n \"replace_non_ascii_characters\": true,\n \"resize_and_host\": true,\n \"webhook_url\": \"\",\n \"surrounding_div\": {\n \"max_width\": 600,\n \"text_align\": \"left\",\n \"font_size\": 15,\n \"center_to_parent\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"campaign": {
"id": "8e754ce1-c2df-11ed-9848-003048d8d533"
}
}Send Campaign
The send_campaign API Endpoint allows you to send in a campaign to be processed and analyzed by Campaign Cleaner. Below is the list of settings that can be set, all optional settings, if not specified will default to the bold/italicized setting.
All submitted campaigns will be sanitized.
Header:
X-CC-API-Key: Your API Key
Request Body:
Required:
send_campaign:
- campaign_html : The full HTML of your campaign
- campaign_name: The name of your campaign - campaign name must pass our sanitization checks.
Campaigns are normally processed in under 2 minutes, in most instances in a few seconds. But in some cases with very large campaigns with lots of images and links it can take longer to check those links for blacklists, redirects. image sizes and more. Depending on the server where those links resources are located it can take longer. The send campaign, will return a campaign ID once we received it, you can use that campaign ID to check on the status, and retrieve your campaign when it’s finished processing or you can supply us a webhook URL and we will send the results to you automatically.
Optional:
send_campaign:
-
adjust_font_colors: (true/false), If true, certain bright colors are spam triggers, like “red” or “#FF0000”, will be adjusted to a slightly different color like “#FF0101”, it will look the same, but won’t trigger some spam filters.
-
adjust_font_size: (true/false) If true, you will be able to define the min and max font size allowed in pixels. If your newsletter contains larger or small font’s it will adjust them to the min/max you define.
-
convert_h_to_p_tags: (true/false) If true, this will change all the H tags to P tags and set the correct font-size.
-
convert_tables_to_divs: (true/false) - This is an experimental feature to convert all the tables to divs, in certain instances with a complicated table structure you might need to edit the HTML. We recommend leaving this as false or not setting it.
-
custom_info: This field is for you to pass any additional data you want to send us, it will also be passed back to you when you call the get_campaign API. It’s limited to 500 characters. - It must pass our sanitization checks.
-
host_extensionless_images: (true/false) If true, images without extensions will be hosted on our CDN when the resize_and_host parameter is set to true.
-
inline_css: (true/false) When set to true, CSS styles are directly applied within the style attribute of each HTML element.
-
inline_css_important: (true/false) When set to true, the !important flag will also be inlined with CSS styles.
-
max_font_size_allowed: (A positive Integer under 100) in pixels, default is 32.
-
media_queries_important: (true/false) When set to true, all media query styles will be marked with the !important flag.
-
min_font_size_allowed: (A positive Integer, under 100) in pixels, default is 10.
-
preserve_media_queries: (true/false) If true, all media queries will be preserved.
-
relative_links_base_url: If set, this needs to be a full base URL, if your email campaign has any relative paths, it will be converted to an absolute URL.
-
remove_classes_and_ids: (true/false) If true, all the class and ID attributes after CSS Inlining will be removed.
-
remove_comments: (true/false) If true, comments will be stripped from both CSS and HTML.
-
remove_control_non_printable: (true/false) If True, all non-printable and control characters are removed.
-
remove_css_inheritance: (true/false) If true, removes all elements of CSS that are inherited.
-
remove_image_height: (true/false) if true, the height style will be removed from all images.
-
remove_large_widths_over: (integer) Experimental: If set, removes all defined widths over the value set on non images and table tags.
-
remove_successive_punctuation: (true/false) if true, this will remove successive punctuation like …, !!!!, $$$ to a single occurrence.
-
replace_diacritics: (true/false) If true, diacritic characters like á will be replaced with normal character equivalents.
-
replace_non_ascii_characters: (true/false) If true, all non-ascii characters will be replaced with their ascii equivalent.
-
resize_and_host: (true/false) If true, all eligible images will be resized, converted, and hosted on our CDN.
-
set_image_max_width: (integer) If set, applies a max-width style to all images in pixels.
-
surrounding_div: A surrounding div added to your html.
- max_width: The max-width style in pixels applied to the surrounding div.
- text_align: (left, center, right) Alignment of content within the div.
- font_size: The pixel size set in the surrounding div.
- center_to_parent: (true/false) If true, centers the div in any parent tags.
-
webhook_url: If provided, the results will be posted to this URL when processing is complete. Must be an absolute URL with no query string.
curl --request POST \
--url https://api.campaigncleaner.com/v1/send_campaign \
--header 'Content-Type: application/json' \
--data '
{
"send_campaign": {
"campaign_html": "<html><body>Your Campaign HTML</body></html>",
"campaign_name": "My Campaign",
"adjust_font_colors": true,
"adjust_font_size": true,
"min_font_size_allowed": 10,
"max_font_size_allowed": 32,
"convert_h_to_p_tags": false,
"convert_tables_to_divs": false,
"custom_info": "",
"host_extensionless_images": false,
"inline_css": true,
"inline_css_important": false,
"media_queries_important": true,
"preserve_media_queries": true,
"relative_links_base_url": "",
"remove_classes_and_ids": true,
"remove_comments": true,
"remove_control_non_printable": false,
"remove_css_inheritance": true,
"remove_image_height": true,
"remove_successive_punctuation": true,
"replace_diacritics": true,
"replace_non_ascii_characters": true,
"resize_and_host": true,
"webhook_url": "",
"surrounding_div": {
"max_width": 600,
"text_align": "left",
"font_size": 15,
"center_to_parent": true
}
}
}
'import requests
url = "https://api.campaigncleaner.com/v1/send_campaign"
payload = { "send_campaign": {
"campaign_html": "<html><body>Your Campaign HTML</body></html>",
"campaign_name": "My Campaign",
"adjust_font_colors": True,
"adjust_font_size": True,
"min_font_size_allowed": 10,
"max_font_size_allowed": 32,
"convert_h_to_p_tags": False,
"convert_tables_to_divs": False,
"custom_info": "",
"host_extensionless_images": False,
"inline_css": True,
"inline_css_important": False,
"media_queries_important": True,
"preserve_media_queries": True,
"relative_links_base_url": "",
"remove_classes_and_ids": True,
"remove_comments": True,
"remove_control_non_printable": False,
"remove_css_inheritance": True,
"remove_image_height": True,
"remove_successive_punctuation": True,
"replace_diacritics": True,
"replace_non_ascii_characters": True,
"resize_and_host": True,
"webhook_url": "",
"surrounding_div": {
"max_width": 600,
"text_align": "left",
"font_size": 15,
"center_to_parent": True
}
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
send_campaign: {
campaign_html: '<html><body>Your Campaign HTML</body></html>',
campaign_name: 'My Campaign',
adjust_font_colors: true,
adjust_font_size: true,
min_font_size_allowed: 10,
max_font_size_allowed: 32,
convert_h_to_p_tags: false,
convert_tables_to_divs: false,
custom_info: '',
host_extensionless_images: false,
inline_css: true,
inline_css_important: false,
media_queries_important: true,
preserve_media_queries: true,
relative_links_base_url: '',
remove_classes_and_ids: true,
remove_comments: true,
remove_control_non_printable: false,
remove_css_inheritance: true,
remove_image_height: true,
remove_successive_punctuation: true,
replace_diacritics: true,
replace_non_ascii_characters: true,
resize_and_host: true,
webhook_url: '',
surrounding_div: {max_width: 600, text_align: 'left', font_size: 15, center_to_parent: true}
}
})
};
fetch('https://api.campaigncleaner.com/v1/send_campaign', 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://api.campaigncleaner.com/v1/send_campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'send_campaign' => [
'campaign_html' => '<html><body>Your Campaign HTML</body></html>',
'campaign_name' => 'My Campaign',
'adjust_font_colors' => true,
'adjust_font_size' => true,
'min_font_size_allowed' => 10,
'max_font_size_allowed' => 32,
'convert_h_to_p_tags' => false,
'convert_tables_to_divs' => false,
'custom_info' => '',
'host_extensionless_images' => false,
'inline_css' => true,
'inline_css_important' => false,
'media_queries_important' => true,
'preserve_media_queries' => true,
'relative_links_base_url' => '',
'remove_classes_and_ids' => true,
'remove_comments' => true,
'remove_control_non_printable' => false,
'remove_css_inheritance' => true,
'remove_image_height' => true,
'remove_successive_punctuation' => true,
'replace_diacritics' => true,
'replace_non_ascii_characters' => true,
'resize_and_host' => true,
'webhook_url' => '',
'surrounding_div' => [
'max_width' => 600,
'text_align' => 'left',
'font_size' => 15,
'center_to_parent' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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://api.campaigncleaner.com/v1/send_campaign"
payload := strings.NewReader("{\n \"send_campaign\": {\n \"campaign_html\": \"<html><body>Your Campaign HTML</body></html>\",\n \"campaign_name\": \"My Campaign\",\n \"adjust_font_colors\": true,\n \"adjust_font_size\": true,\n \"min_font_size_allowed\": 10,\n \"max_font_size_allowed\": 32,\n \"convert_h_to_p_tags\": false,\n \"convert_tables_to_divs\": false,\n \"custom_info\": \"\",\n \"host_extensionless_images\": false,\n \"inline_css\": true,\n \"inline_css_important\": false,\n \"media_queries_important\": true,\n \"preserve_media_queries\": true,\n \"relative_links_base_url\": \"\",\n \"remove_classes_and_ids\": true,\n \"remove_comments\": true,\n \"remove_control_non_printable\": false,\n \"remove_css_inheritance\": true,\n \"remove_image_height\": true,\n \"remove_successive_punctuation\": true,\n \"replace_diacritics\": true,\n \"replace_non_ascii_characters\": true,\n \"resize_and_host\": true,\n \"webhook_url\": \"\",\n \"surrounding_div\": {\n \"max_width\": 600,\n \"text_align\": \"left\",\n \"font_size\": 15,\n \"center_to_parent\": true\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.campaigncleaner.com/v1/send_campaign")
.header("Content-Type", "application/json")
.body("{\n \"send_campaign\": {\n \"campaign_html\": \"<html><body>Your Campaign HTML</body></html>\",\n \"campaign_name\": \"My Campaign\",\n \"adjust_font_colors\": true,\n \"adjust_font_size\": true,\n \"min_font_size_allowed\": 10,\n \"max_font_size_allowed\": 32,\n \"convert_h_to_p_tags\": false,\n \"convert_tables_to_divs\": false,\n \"custom_info\": \"\",\n \"host_extensionless_images\": false,\n \"inline_css\": true,\n \"inline_css_important\": false,\n \"media_queries_important\": true,\n \"preserve_media_queries\": true,\n \"relative_links_base_url\": \"\",\n \"remove_classes_and_ids\": true,\n \"remove_comments\": true,\n \"remove_control_non_printable\": false,\n \"remove_css_inheritance\": true,\n \"remove_image_height\": true,\n \"remove_successive_punctuation\": true,\n \"replace_diacritics\": true,\n \"replace_non_ascii_characters\": true,\n \"resize_and_host\": true,\n \"webhook_url\": \"\",\n \"surrounding_div\": {\n \"max_width\": 600,\n \"text_align\": \"left\",\n \"font_size\": 15,\n \"center_to_parent\": true\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.campaigncleaner.com/v1/send_campaign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"send_campaign\": {\n \"campaign_html\": \"<html><body>Your Campaign HTML</body></html>\",\n \"campaign_name\": \"My Campaign\",\n \"adjust_font_colors\": true,\n \"adjust_font_size\": true,\n \"min_font_size_allowed\": 10,\n \"max_font_size_allowed\": 32,\n \"convert_h_to_p_tags\": false,\n \"convert_tables_to_divs\": false,\n \"custom_info\": \"\",\n \"host_extensionless_images\": false,\n \"inline_css\": true,\n \"inline_css_important\": false,\n \"media_queries_important\": true,\n \"preserve_media_queries\": true,\n \"relative_links_base_url\": \"\",\n \"remove_classes_and_ids\": true,\n \"remove_comments\": true,\n \"remove_control_non_printable\": false,\n \"remove_css_inheritance\": true,\n \"remove_image_height\": true,\n \"remove_successive_punctuation\": true,\n \"replace_diacritics\": true,\n \"replace_non_ascii_characters\": true,\n \"resize_and_host\": true,\n \"webhook_url\": \"\",\n \"surrounding_div\": {\n \"max_width\": 600,\n \"text_align\": \"left\",\n \"font_size\": 15,\n \"center_to_parent\": true\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"campaign": {
"id": "8e754ce1-c2df-11ed-9848-003048d8d533"
}
}Headers
Body
The body is of type object.
Response
OK
The response is of type object.

