Create a contact
curl --request POST \
--url https://api.emailr.dev/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"subscribed": true,
"metadata": {
"source": "website",
"plan": "pro",
"active": true,
"score": 100,
"signup_date": "2024-01-15"
},
"tags": [
"newsletter",
"vip"
]
}
'import requests
url = "https://api.emailr.dev/v1/contacts"
payload = {
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"subscribed": True,
"metadata": {
"source": "website",
"plan": "pro",
"active": True,
"score": 100,
"signup_date": "2024-01-15"
},
"tags": ["newsletter", "vip"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
first_name: 'John',
last_name: 'Doe',
subscribed: true,
metadata: {
source: 'website',
plan: 'pro',
active: true,
score: 100,
signup_date: '2024-01-15'
},
tags: ['newsletter', 'vip']
})
};
fetch('https://api.emailr.dev/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://api.emailr.dev/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([
'email' => '[email protected]',
'first_name' => 'John',
'last_name' => 'Doe',
'subscribed' => true,
'metadata' => [
'source' => 'website',
'plan' => 'pro',
'active' => true,
'score' => 100,
'signup_date' => '2024-01-15'
],
'tags' => [
'newsletter',
'vip'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.emailr.dev/v1/contacts"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"subscribed\": true,\n \"metadata\": {\n \"source\": \"website\",\n \"plan\": \"pro\",\n \"active\": true,\n \"score\": 100,\n \"signup_date\": \"2024-01-15\"\n },\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.emailr.dev/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"subscribed\": true,\n \"metadata\": {\n \"source\": \"website\",\n \"plan\": \"pro\",\n \"active\": true,\n \"score\": 100,\n \"signup_date\": \"2024-01-15\"\n },\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emailr.dev/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"subscribed\": true,\n \"metadata\": {\n \"source\": \"website\",\n \"plan\": \"pro\",\n \"active\": true,\n \"score\": 100,\n \"signup_date\": \"2024-01-15\"\n },\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]",
"first_name": "<string>",
"last_name": "<string>",
"metadata": {},
"subscribed": true,
"unsubscribed_at": "2023-11-07T05:31:56Z",
"tags": [
"newsletter",
"vip"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}contacts
Create a contact
Create a new contact in your organization
POST
/
v1
/
contacts
Create a contact
curl --request POST \
--url https://api.emailr.dev/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"subscribed": true,
"metadata": {
"source": "website",
"plan": "pro",
"active": true,
"score": 100,
"signup_date": "2024-01-15"
},
"tags": [
"newsletter",
"vip"
]
}
'import requests
url = "https://api.emailr.dev/v1/contacts"
payload = {
"email": "[email protected]",
"first_name": "John",
"last_name": "Doe",
"subscribed": True,
"metadata": {
"source": "website",
"plan": "pro",
"active": True,
"score": 100,
"signup_date": "2024-01-15"
},
"tags": ["newsletter", "vip"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
first_name: 'John',
last_name: 'Doe',
subscribed: true,
metadata: {
source: 'website',
plan: 'pro',
active: true,
score: 100,
signup_date: '2024-01-15'
},
tags: ['newsletter', 'vip']
})
};
fetch('https://api.emailr.dev/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://api.emailr.dev/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([
'email' => '[email protected]',
'first_name' => 'John',
'last_name' => 'Doe',
'subscribed' => true,
'metadata' => [
'source' => 'website',
'plan' => 'pro',
'active' => true,
'score' => 100,
'signup_date' => '2024-01-15'
],
'tags' => [
'newsletter',
'vip'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.emailr.dev/v1/contacts"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"subscribed\": true,\n \"metadata\": {\n \"source\": \"website\",\n \"plan\": \"pro\",\n \"active\": true,\n \"score\": 100,\n \"signup_date\": \"2024-01-15\"\n },\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.emailr.dev/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"subscribed\": true,\n \"metadata\": {\n \"source\": \"website\",\n \"plan\": \"pro\",\n \"active\": true,\n \"score\": 100,\n \"signup_date\": \"2024-01-15\"\n },\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emailr.dev/v1/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"subscribed\": true,\n \"metadata\": {\n \"source\": \"website\",\n \"plan\": \"pro\",\n \"active\": true,\n \"score\": 100,\n \"signup_date\": \"2024-01-15\"\n },\n \"tags\": [\n \"newsletter\",\n \"vip\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "123e4567-e89b-12d3-a456-426614174000",
"organization_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"email": "[email protected]",
"first_name": "<string>",
"last_name": "<string>",
"metadata": {},
"subscribed": true,
"unsubscribed_at": "2023-11-07T05:31:56Z",
"tags": [
"newsletter",
"vip"
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}{
"error": "An error occurred",
"code": "VALIDATION_ERROR",
"details": "<unknown>"
}Authorizations
API key authentication. Use your API key as the bearer token.
Body
application/json
Example:
Example:
"John"
Example:
"Doe"
Example:
true
Custom properties for the contact. Supports string, number, boolean, and date (as ISO string) values.
Show child attributes
Show child attributes
Example:
{
"source": "website",
"plan": "pro",
"active": true,
"score": 100,
"signup_date": "2024-01-15"
}
Tags for categorization. Lowercase, max 50 chars each, max 20 tags.
Example:
["newsletter", "vip"]
Response
Contact created
Example:
"123e4567-e89b-12d3-a456-426614174000"
Custom properties for the contact. Supports string, number, boolean, and date (as ISO string) values.
Show child attributes
Show child attributes
Tags for categorization.
Example:
["newsletter", "vip"]
⌘I