curl --request POST \
--url https://cloudapi.mailercloud.com/v1/contacts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"city": "string",
"country": "string",
"custom_fields": {
"enc_id1": "string",
"enc_id2": 0
},
"department": "string",
"email": "string",
"industry": "string",
"job_title": "string",
"last_name": "string",
"lead_source": "string",
"list_id": "string",
"middle_name": "string",
"first_name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"contact_type": "active",
"tags": [
"string"
]
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/contacts"
payload = {
"city": "string",
"country": "string",
"custom_fields": {
"enc_id1": "string",
"enc_id2": 0
},
"department": "string",
"email": "string",
"industry": "string",
"job_title": "string",
"last_name": "string",
"lead_source": "string",
"list_id": "string",
"middle_name": "string",
"first_name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"contact_type": "active",
"tags": ["string"]
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({
city: 'string',
country: 'string',
custom_fields: {enc_id1: 'string', enc_id2: 0},
department: 'string',
email: 'string',
industry: 'string',
job_title: 'string',
last_name: 'string',
lead_source: 'string',
list_id: 'string',
middle_name: 'string',
first_name: 'string',
company_name: 'string',
phone: 'string',
salary: 0,
state: 'string',
postal_code: 'string',
contact_type: 'active',
tags: ['string']
})
};
fetch('https://cloudapi.mailercloud.com/v1/contacts', 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/contacts",
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([
'city' => 'string',
'country' => 'string',
'custom_fields' => [
'enc_id1' => 'string',
'enc_id2' => 0
],
'department' => 'string',
'email' => 'string',
'industry' => 'string',
'job_title' => 'string',
'last_name' => 'string',
'lead_source' => 'string',
'list_id' => 'string',
'middle_name' => 'string',
'first_name' => 'string',
'company_name' => 'string',
'phone' => 'string',
'salary' => 0,
'state' => 'string',
'postal_code' => 'string',
'contact_type' => 'active',
'tags' => [
'string'
]
]),
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/contacts"
payload := strings.NewReader("{\n \"city\": \"string\",\n \"country\": \"string\",\n \"custom_fields\": {\n \"enc_id1\": \"string\",\n \"enc_id2\": 0\n },\n \"department\": \"string\",\n \"email\": \"string\",\n \"industry\": \"string\",\n \"job_title\": \"string\",\n \"last_name\": \"string\",\n \"lead_source\": \"string\",\n \"list_id\": \"string\",\n \"middle_name\": \"string\",\n \"first_name\": \"string\",\n \"company_name\": \"string\",\n \"phone\": \"string\",\n \"salary\": 0,\n \"state\": \"string\",\n \"postal_code\": \"string\",\n \"contact_type\": \"active\",\n \"tags\": [\n \"string\"\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"id": "xc"
}{
"error": {
"field": "email",
"message": "Invalid email"
}
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}Create Contact
API for creating contact. For creating a contact, email and list id is required. If you try to create a contact that already exists, it gives an “already exists” message . You can add custom property data by mapping the property id : value. You can add contacts until your contact quota limit is reached. If you create a contact in a suppressed list and if this contact is also present in the active list, the contact will be removed from the active list to the suppressed list.
curl --request POST \
--url https://cloudapi.mailercloud.com/v1/contacts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"city": "string",
"country": "string",
"custom_fields": {
"enc_id1": "string",
"enc_id2": 0
},
"department": "string",
"email": "string",
"industry": "string",
"job_title": "string",
"last_name": "string",
"lead_source": "string",
"list_id": "string",
"middle_name": "string",
"first_name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"contact_type": "active",
"tags": [
"string"
]
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/contacts"
payload = {
"city": "string",
"country": "string",
"custom_fields": {
"enc_id1": "string",
"enc_id2": 0
},
"department": "string",
"email": "string",
"industry": "string",
"job_title": "string",
"last_name": "string",
"lead_source": "string",
"list_id": "string",
"middle_name": "string",
"first_name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"contact_type": "active",
"tags": ["string"]
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<api-key>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<api-key>'},
body: JSON.stringify({
city: 'string',
country: 'string',
custom_fields: {enc_id1: 'string', enc_id2: 0},
department: 'string',
email: 'string',
industry: 'string',
job_title: 'string',
last_name: 'string',
lead_source: 'string',
list_id: 'string',
middle_name: 'string',
first_name: 'string',
company_name: 'string',
phone: 'string',
salary: 0,
state: 'string',
postal_code: 'string',
contact_type: 'active',
tags: ['string']
})
};
fetch('https://cloudapi.mailercloud.com/v1/contacts', 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/contacts",
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([
'city' => 'string',
'country' => 'string',
'custom_fields' => [
'enc_id1' => 'string',
'enc_id2' => 0
],
'department' => 'string',
'email' => 'string',
'industry' => 'string',
'job_title' => 'string',
'last_name' => 'string',
'lead_source' => 'string',
'list_id' => 'string',
'middle_name' => 'string',
'first_name' => 'string',
'company_name' => 'string',
'phone' => 'string',
'salary' => 0,
'state' => 'string',
'postal_code' => 'string',
'contact_type' => 'active',
'tags' => [
'string'
]
]),
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/contacts"
payload := strings.NewReader("{\n \"city\": \"string\",\n \"country\": \"string\",\n \"custom_fields\": {\n \"enc_id1\": \"string\",\n \"enc_id2\": 0\n },\n \"department\": \"string\",\n \"email\": \"string\",\n \"industry\": \"string\",\n \"job_title\": \"string\",\n \"last_name\": \"string\",\n \"lead_source\": \"string\",\n \"list_id\": \"string\",\n \"middle_name\": \"string\",\n \"first_name\": \"string\",\n \"company_name\": \"string\",\n \"phone\": \"string\",\n \"salary\": 0,\n \"state\": \"string\",\n \"postal_code\": \"string\",\n \"contact_type\": \"active\",\n \"tags\": [\n \"string\"\n ]\n}")
req, _ := http.NewRequest("POST", 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))
}{
"id": "xc"
}{
"error": {
"field": "email",
"message": "Invalid email"
}
}{
"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
The email for the contact. This is required to be a valid email.
Maximum: 200
200The contact list id to which you want to add this contact
1The city of the contact
Maximum: 100
100The country of the contact
Maximum: 50
50Json for custom property
Text - maximum: 100
Textarea - maximum: 500
Number - Numeric values only
Date - maximum: 10,format = 2006-01-02
Show child attributes
Show child attributes
The department of contact
Maximum: 100
1The industry of the contact
Maximum: 100
100The job title of the contact
Maximum: 100
100The last name for the contact
Maximum: 25
25The lead sorce of contact
Maximum: 50
50The middle name of contact
Maximum: 25
25Name of your contact
Maximum: 25
25The company name of your contact
Maximum: 150
150The phone number of your contact
Maximum: 25
1The salary of your contact
Maximum: 15
The state of your contact
Maximum: 100
100The postal code of your contact
Maximum: 25
25Allowed values - active, bounce, abuse, unsubscribe, suppressed, spam complaints
Default: active
The tags of your contact
Open-tracking consent for this contact.
Accepted values are case-insensitive and whitespace-trimmed:
- granted:
granted,yes,true,1,subscribed - denied:
denied,revoked,no,false,0,unsubscribed - unknown:
unknown,never subscribed
The subscribed / unsubscribed / never subscribed aliases let Klaviyo exports be imported unchanged.
An unrecognised or empty value is ignored and leaves any existing consent untouched - it is not a validation error, so a blank field in a re-upload never erases a previously recorded answer.
Setting a value also stamps tracking_consent_date and sets tracking_consent_source to 5 (API). Those two fields cannot be set directly.
Maximum: 20
20Response
Created