Create a contact
Create a new contact owned by the authenticated client. Email must be unique per client.
POST
/
client
/
contacts
Create a contact
curl --request POST \
--url https://api.mailerpath.com/api/v1/client/contacts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"client_contact_id": "crm-001",
"company": "Acme Corp",
"custom_fields": {},
"email": "jane@example.com",
"external_id": "crm-001",
"first_name": "Jane",
"is_subscribed": true,
"last_name": "Doe",
"last_purchase_at": "<string>",
"phone": "+1-555-0100",
"signup_source": "organic",
"timezone": "America/New_York",
"unsubscribe_reason": "<string>",
"unsubscribed_at": "<string>"
}
'import requests
url = "https://api.mailerpath.com/api/v1/client/contacts"
payload = {
"client_contact_id": "crm-001",
"company": "Acme Corp",
"custom_fields": {},
"email": "jane@example.com",
"external_id": "crm-001",
"first_name": "Jane",
"is_subscribed": True,
"last_name": "Doe",
"last_purchase_at": "<string>",
"phone": "+1-555-0100",
"signup_source": "organic",
"timezone": "America/New_York",
"unsubscribe_reason": "<string>",
"unsubscribed_at": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_contact_id: 'crm-001',
company: 'Acme Corp',
custom_fields: {},
email: 'jane@example.com',
external_id: 'crm-001',
first_name: 'Jane',
is_subscribed: true,
last_name: 'Doe',
last_purchase_at: '<string>',
phone: '+1-555-0100',
signup_source: 'organic',
timezone: 'America/New_York',
unsubscribe_reason: '<string>',
unsubscribed_at: '<string>'
})
};
fetch('https://api.mailerpath.com/api/v1/client/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://api.mailerpath.com/api/v1/client/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([
'client_contact_id' => 'crm-001',
'company' => 'Acme Corp',
'custom_fields' => [
],
'email' => 'jane@example.com',
'external_id' => 'crm-001',
'first_name' => 'Jane',
'is_subscribed' => true,
'last_name' => 'Doe',
'last_purchase_at' => '<string>',
'phone' => '+1-555-0100',
'signup_source' => 'organic',
'timezone' => 'America/New_York',
'unsubscribe_reason' => '<string>',
'unsubscribed_at' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.mailerpath.com/api/v1/client/contacts"
payload := strings.NewReader("{\n \"client_contact_id\": \"crm-001\",\n \"company\": \"Acme Corp\",\n \"custom_fields\": {},\n \"email\": \"jane@example.com\",\n \"external_id\": \"crm-001\",\n \"first_name\": \"Jane\",\n \"is_subscribed\": true,\n \"last_name\": \"Doe\",\n \"last_purchase_at\": \"<string>\",\n \"phone\": \"+1-555-0100\",\n \"signup_source\": \"organic\",\n \"timezone\": \"America/New_York\",\n \"unsubscribe_reason\": \"<string>\",\n \"unsubscribed_at\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.mailerpath.com/api/v1/client/contacts")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client_contact_id\": \"crm-001\",\n \"company\": \"Acme Corp\",\n \"custom_fields\": {},\n \"email\": \"jane@example.com\",\n \"external_id\": \"crm-001\",\n \"first_name\": \"Jane\",\n \"is_subscribed\": true,\n \"last_name\": \"Doe\",\n \"last_purchase_at\": \"<string>\",\n \"phone\": \"+1-555-0100\",\n \"signup_source\": \"organic\",\n \"timezone\": \"America/New_York\",\n \"unsubscribe_reason\": \"<string>\",\n \"unsubscribed_at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailerpath.com/api/v1/client/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_contact_id\": \"crm-001\",\n \"company\": \"Acme Corp\",\n \"custom_fields\": {},\n \"email\": \"jane@example.com\",\n \"external_id\": \"crm-001\",\n \"first_name\": \"Jane\",\n \"is_subscribed\": true,\n \"last_name\": \"Doe\",\n \"last_purchase_at\": \"<string>\",\n \"phone\": \"+1-555-0100\",\n \"signup_source\": \"organic\",\n \"timezone\": \"America/New_York\",\n \"unsubscribe_reason\": \"<string>\",\n \"unsubscribed_at\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"active_states": 123,
"active_workflow_count": 123,
"client_contact_id": "<string>",
"client_id": 123,
"company": "<string>",
"created_at": "<string>",
"created_by": 123,
"custom_fields": [
123
],
"email": "<string>",
"external_id": "<string>",
"first_name": "<string>",
"health_score": 123,
"id": 123,
"is_subscribed": true,
"last_activity_at": "<string>",
"last_email_opened_at": "<string>",
"last_name": "<string>",
"last_purchase_at": "<string>",
"last_workflow_at": "<string>",
"phone": "<string>",
"signup_source": "<string>",
"tags": [
"<string>"
],
"timezone": "<string>",
"total_emails_clicked": 123,
"total_emails_opened": 123,
"total_emails_sent": 123,
"unsubscribe_reason": "<string>",
"unsubscribed_at": "<string>",
"updated_at": "<string>"
},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}{
"data": {},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}{
"data": {},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}{
"data": {},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}Authorizations
JWT Bearer token or raw API key via Authorization header
Body
application/json
Contact data
Example:
"crm-001"
Example:
"Acme Corp"
Example:
"jane@example.com"
Example:
"crm-001"
Example:
"Jane"
Example:
"Doe"
Example:
"+1-555-0100"
Example:
"organic"
Source: accepted as string ("api", "import", "form", "app", "unknown") or integer (0-4).
Available options:
unknown, api, import, form, app Example:
"America/New_York"
⌘I
Create a contact
curl --request POST \
--url https://api.mailerpath.com/api/v1/client/contacts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"client_contact_id": "crm-001",
"company": "Acme Corp",
"custom_fields": {},
"email": "jane@example.com",
"external_id": "crm-001",
"first_name": "Jane",
"is_subscribed": true,
"last_name": "Doe",
"last_purchase_at": "<string>",
"phone": "+1-555-0100",
"signup_source": "organic",
"timezone": "America/New_York",
"unsubscribe_reason": "<string>",
"unsubscribed_at": "<string>"
}
'import requests
url = "https://api.mailerpath.com/api/v1/client/contacts"
payload = {
"client_contact_id": "crm-001",
"company": "Acme Corp",
"custom_fields": {},
"email": "jane@example.com",
"external_id": "crm-001",
"first_name": "Jane",
"is_subscribed": True,
"last_name": "Doe",
"last_purchase_at": "<string>",
"phone": "+1-555-0100",
"signup_source": "organic",
"timezone": "America/New_York",
"unsubscribe_reason": "<string>",
"unsubscribed_at": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
client_contact_id: 'crm-001',
company: 'Acme Corp',
custom_fields: {},
email: 'jane@example.com',
external_id: 'crm-001',
first_name: 'Jane',
is_subscribed: true,
last_name: 'Doe',
last_purchase_at: '<string>',
phone: '+1-555-0100',
signup_source: 'organic',
timezone: 'America/New_York',
unsubscribe_reason: '<string>',
unsubscribed_at: '<string>'
})
};
fetch('https://api.mailerpath.com/api/v1/client/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://api.mailerpath.com/api/v1/client/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([
'client_contact_id' => 'crm-001',
'company' => 'Acme Corp',
'custom_fields' => [
],
'email' => 'jane@example.com',
'external_id' => 'crm-001',
'first_name' => 'Jane',
'is_subscribed' => true,
'last_name' => 'Doe',
'last_purchase_at' => '<string>',
'phone' => '+1-555-0100',
'signup_source' => 'organic',
'timezone' => 'America/New_York',
'unsubscribe_reason' => '<string>',
'unsubscribed_at' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.mailerpath.com/api/v1/client/contacts"
payload := strings.NewReader("{\n \"client_contact_id\": \"crm-001\",\n \"company\": \"Acme Corp\",\n \"custom_fields\": {},\n \"email\": \"jane@example.com\",\n \"external_id\": \"crm-001\",\n \"first_name\": \"Jane\",\n \"is_subscribed\": true,\n \"last_name\": \"Doe\",\n \"last_purchase_at\": \"<string>\",\n \"phone\": \"+1-555-0100\",\n \"signup_source\": \"organic\",\n \"timezone\": \"America/New_York\",\n \"unsubscribe_reason\": \"<string>\",\n \"unsubscribed_at\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.mailerpath.com/api/v1/client/contacts")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"client_contact_id\": \"crm-001\",\n \"company\": \"Acme Corp\",\n \"custom_fields\": {},\n \"email\": \"jane@example.com\",\n \"external_id\": \"crm-001\",\n \"first_name\": \"Jane\",\n \"is_subscribed\": true,\n \"last_name\": \"Doe\",\n \"last_purchase_at\": \"<string>\",\n \"phone\": \"+1-555-0100\",\n \"signup_source\": \"organic\",\n \"timezone\": \"America/New_York\",\n \"unsubscribe_reason\": \"<string>\",\n \"unsubscribed_at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mailerpath.com/api/v1/client/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"client_contact_id\": \"crm-001\",\n \"company\": \"Acme Corp\",\n \"custom_fields\": {},\n \"email\": \"jane@example.com\",\n \"external_id\": \"crm-001\",\n \"first_name\": \"Jane\",\n \"is_subscribed\": true,\n \"last_name\": \"Doe\",\n \"last_purchase_at\": \"<string>\",\n \"phone\": \"+1-555-0100\",\n \"signup_source\": \"organic\",\n \"timezone\": \"America/New_York\",\n \"unsubscribe_reason\": \"<string>\",\n \"unsubscribed_at\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"active_states": 123,
"active_workflow_count": 123,
"client_contact_id": "<string>",
"client_id": 123,
"company": "<string>",
"created_at": "<string>",
"created_by": 123,
"custom_fields": [
123
],
"email": "<string>",
"external_id": "<string>",
"first_name": "<string>",
"health_score": 123,
"id": 123,
"is_subscribed": true,
"last_activity_at": "<string>",
"last_email_opened_at": "<string>",
"last_name": "<string>",
"last_purchase_at": "<string>",
"last_workflow_at": "<string>",
"phone": "<string>",
"signup_source": "<string>",
"tags": [
"<string>"
],
"timezone": "<string>",
"total_emails_clicked": 123,
"total_emails_opened": 123,
"total_emails_sent": 123,
"unsubscribe_reason": "<string>",
"unsubscribed_at": "<string>",
"updated_at": "<string>"
},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}{
"data": {},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}{
"data": {},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}{
"data": {},
"errors": [
{
"condition": "format",
"error": "Invalid email format",
"key": "email"
}
],
"message": "Operation successful",
"meta": {},
"success": true
}
