Create Batch Contact
curl --request POST \
--url https://cloudapi.mailercloud.com/v1/contacts/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"contacts": [
{
"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",
"middle_name": "string",
"name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"tags": [
"string"
]
}
],
"list_id": "string"
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/contacts/batch"
payload = {
"contacts": [
{
"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",
"middle_name": "string",
"name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"tags": ["string"]
}
],
"list_id": "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({
contacts: [
{
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',
middle_name: 'string',
name: 'string',
company_name: 'string',
phone: 'string',
salary: 0,
state: 'string',
postal_code: 'string',
tags: ['string']
}
],
list_id: 'string'
})
};
fetch('https://cloudapi.mailercloud.com/v1/contacts/batch', 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/batch",
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([
'contacts' => [
[
'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',
'middle_name' => 'string',
'name' => 'string',
'company_name' => 'string',
'phone' => 'string',
'salary' => 0,
'state' => 'string',
'postal_code' => 'string',
'tags' => [
'string'
]
]
],
'list_id' => '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/batch"
payload := strings.NewReader("{\n \"contacts\": [\n {\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 \"middle_name\": \"string\",\n \"name\": \"string\",\n \"company_name\": \"string\",\n \"phone\": \"string\",\n \"salary\": 0,\n \"state\": \"string\",\n \"postal_code\": \"string\",\n \"tags\": [\n \"string\"\n ]\n }\n ],\n \"list_id\": \"string\"\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))
}{
"data": {
"inserted": 2,
"skipped": 1,
"submitted": 3,
"updated": 0
},
"message": "Batch contacts processed"
}{
"error": {
"field": "email",
"message": "Invalid email"
}
}{
"errors": [
{
"field": "",
"message": "Authorization failed"
}
]
}Create Batch Contact
Create a Batch contact. You can create a maximum of 50 contact through this API.
POST
/
contacts
/
batch
Create Batch Contact
curl --request POST \
--url https://cloudapi.mailercloud.com/v1/contacts/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: <content-type>' \
--data '
{
"contacts": [
{
"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",
"middle_name": "string",
"name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"tags": [
"string"
]
}
],
"list_id": "string"
}
'import requests
url = "https://cloudapi.mailercloud.com/v1/contacts/batch"
payload = {
"contacts": [
{
"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",
"middle_name": "string",
"name": "string",
"company_name": "string",
"phone": "string",
"salary": 0,
"state": "string",
"postal_code": "string",
"tags": ["string"]
}
],
"list_id": "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({
contacts: [
{
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',
middle_name: 'string',
name: 'string',
company_name: 'string',
phone: 'string',
salary: 0,
state: 'string',
postal_code: 'string',
tags: ['string']
}
],
list_id: 'string'
})
};
fetch('https://cloudapi.mailercloud.com/v1/contacts/batch', 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/batch",
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([
'contacts' => [
[
'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',
'middle_name' => 'string',
'name' => 'string',
'company_name' => 'string',
'phone' => 'string',
'salary' => 0,
'state' => 'string',
'postal_code' => 'string',
'tags' => [
'string'
]
]
],
'list_id' => '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/batch"
payload := strings.NewReader("{\n \"contacts\": [\n {\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 \"middle_name\": \"string\",\n \"name\": \"string\",\n \"company_name\": \"string\",\n \"phone\": \"string\",\n \"salary\": 0,\n \"state\": \"string\",\n \"postal_code\": \"string\",\n \"tags\": [\n \"string\"\n ]\n }\n ],\n \"list_id\": \"string\"\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))
}{
"data": {
"inserted": 2,
"skipped": 1,
"submitted": 3,
"updated": 0
},
"message": "Batch contacts processed"
}{
"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
application/json
⌘I