cURL
curl --request POST \
--url https://letterby.com/api/v4/contacts \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"email": "<string>",
"listId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"data": {},
"address": "<string>",
"isGDPR": true,
"name": "<string>",
"instagram": "<string>",
"twitter": "<string>",
"website": "<string>",
"company": "<string>",
"country": "<string>",
"city": "<string>",
"sendVerificationEmail": true
}
'import requests
url = "https://letterby.com/api/v4/contacts"
payload = {
"email": "<string>",
"listId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"data": {},
"address": "<string>",
"isGDPR": True,
"name": "<string>",
"instagram": "<string>",
"twitter": "<string>",
"website": "<string>",
"company": "<string>",
"country": "<string>",
"city": "<string>",
"sendVerificationEmail": True
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '<string>',
listId: '<string>',
firstName: '<string>',
lastName: '<string>',
phoneNumber: '<string>',
data: {},
address: '<string>',
isGDPR: true,
name: '<string>',
instagram: '<string>',
twitter: '<string>',
website: '<string>',
company: '<string>',
country: '<string>',
city: '<string>',
sendVerificationEmail: true
})
};
fetch('https://letterby.com/api/v4/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://letterby.com/api/v4/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' => '<string>',
'listId' => '<string>',
'firstName' => '<string>',
'lastName' => '<string>',
'phoneNumber' => '<string>',
'data' => [
],
'address' => '<string>',
'isGDPR' => true,
'name' => '<string>',
'instagram' => '<string>',
'twitter' => '<string>',
'website' => '<string>',
'company' => '<string>',
'country' => '<string>',
'city' => '<string>',
'sendVerificationEmail' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <api-key>"
],
]);
$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://letterby.com/api/v4/contacts"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"listId\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"data\": {},\n \"address\": \"<string>\",\n \"isGDPR\": true,\n \"name\": \"<string>\",\n \"instagram\": \"<string>\",\n \"twitter\": \"<string>\",\n \"website\": \"<string>\",\n \"company\": \"<string>\",\n \"country\": \"<string>\",\n \"city\": \"<string>\",\n \"sendVerificationEmail\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://letterby.com/api/v4/contacts")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"listId\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"data\": {},\n \"address\": \"<string>\",\n \"isGDPR\": true,\n \"name\": \"<string>\",\n \"instagram\": \"<string>\",\n \"twitter\": \"<string>\",\n \"website\": \"<string>\",\n \"company\": \"<string>\",\n \"country\": \"<string>\",\n \"city\": \"<string>\",\n \"sendVerificationEmail\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://letterby.com/api/v4/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"listId\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"data\": {},\n \"address\": \"<string>\",\n \"isGDPR\": true,\n \"name\": \"<string>\",\n \"instagram\": \"<string>\",\n \"twitter\": \"<string>\",\n \"website\": \"<string>\",\n \"company\": \"<string>\",\n \"country\": \"<string>\",\n \"city\": \"<string>\",\n \"sendVerificationEmail\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"contact": {
"id": "<string>",
"email": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"points": 123,
"referrals": 123,
"listId": "<string>",
"isVerified": true,
"unsubscribed": true,
"data": {},
"address": "<string>",
"isGDPR": true,
"name": "<string>",
"instagram": "<string>",
"twitter": "<string>",
"website": "<string>",
"company": "<string>",
"country": "<string>",
"city": "<string>",
"list": {
"id": "<string>",
"name": "<string>",
"url": "<string>",
"mode": "<string>",
"referrals": true,
"color": "<string>",
"title": "<string>",
"desc": "<string>"
},
"audiences": "<array>",
"referralLink": "<string>",
"privateLink": "<string>",
"position": 123
}
}
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}Contacts
Create Contact
Creates a new contact
POST
/
contacts
cURL
curl --request POST \
--url https://letterby.com/api/v4/contacts \
--header 'Content-Type: application/json' \
--header 'apiKey: <api-key>' \
--data '
{
"email": "<string>",
"listId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"data": {},
"address": "<string>",
"isGDPR": true,
"name": "<string>",
"instagram": "<string>",
"twitter": "<string>",
"website": "<string>",
"company": "<string>",
"country": "<string>",
"city": "<string>",
"sendVerificationEmail": true
}
'import requests
url = "https://letterby.com/api/v4/contacts"
payload = {
"email": "<string>",
"listId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"data": {},
"address": "<string>",
"isGDPR": True,
"name": "<string>",
"instagram": "<string>",
"twitter": "<string>",
"website": "<string>",
"company": "<string>",
"country": "<string>",
"city": "<string>",
"sendVerificationEmail": True
}
headers = {
"apiKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apiKey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '<string>',
listId: '<string>',
firstName: '<string>',
lastName: '<string>',
phoneNumber: '<string>',
data: {},
address: '<string>',
isGDPR: true,
name: '<string>',
instagram: '<string>',
twitter: '<string>',
website: '<string>',
company: '<string>',
country: '<string>',
city: '<string>',
sendVerificationEmail: true
})
};
fetch('https://letterby.com/api/v4/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://letterby.com/api/v4/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' => '<string>',
'listId' => '<string>',
'firstName' => '<string>',
'lastName' => '<string>',
'phoneNumber' => '<string>',
'data' => [
],
'address' => '<string>',
'isGDPR' => true,
'name' => '<string>',
'instagram' => '<string>',
'twitter' => '<string>',
'website' => '<string>',
'company' => '<string>',
'country' => '<string>',
'city' => '<string>',
'sendVerificationEmail' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apiKey: <api-key>"
],
]);
$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://letterby.com/api/v4/contacts"
payload := strings.NewReader("{\n \"email\": \"<string>\",\n \"listId\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"data\": {},\n \"address\": \"<string>\",\n \"isGDPR\": true,\n \"name\": \"<string>\",\n \"instagram\": \"<string>\",\n \"twitter\": \"<string>\",\n \"website\": \"<string>\",\n \"company\": \"<string>\",\n \"country\": \"<string>\",\n \"city\": \"<string>\",\n \"sendVerificationEmail\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apiKey", "<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://letterby.com/api/v4/contacts")
.header("apiKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"<string>\",\n \"listId\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"data\": {},\n \"address\": \"<string>\",\n \"isGDPR\": true,\n \"name\": \"<string>\",\n \"instagram\": \"<string>\",\n \"twitter\": \"<string>\",\n \"website\": \"<string>\",\n \"company\": \"<string>\",\n \"country\": \"<string>\",\n \"city\": \"<string>\",\n \"sendVerificationEmail\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://letterby.com/api/v4/contacts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apiKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"<string>\",\n \"listId\": \"<string>\",\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phoneNumber\": \"<string>\",\n \"data\": {},\n \"address\": \"<string>\",\n \"isGDPR\": true,\n \"name\": \"<string>\",\n \"instagram\": \"<string>\",\n \"twitter\": \"<string>\",\n \"website\": \"<string>\",\n \"company\": \"<string>\",\n \"country\": \"<string>\",\n \"city\": \"<string>\",\n \"sendVerificationEmail\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"contact": {
"id": "<string>",
"email": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"phoneNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"points": 123,
"referrals": 123,
"listId": "<string>",
"isVerified": true,
"unsubscribed": true,
"data": {},
"address": "<string>",
"isGDPR": true,
"name": "<string>",
"instagram": "<string>",
"twitter": "<string>",
"website": "<string>",
"company": "<string>",
"country": "<string>",
"city": "<string>",
"list": {
"id": "<string>",
"name": "<string>",
"url": "<string>",
"mode": "<string>",
"referrals": true,
"color": "<string>",
"title": "<string>",
"desc": "<string>"
},
"audiences": "<array>",
"referralLink": "<string>",
"privateLink": "<string>",
"position": 123
}
}
}{
"error": 123,
"message": "<string>"
}{
"error": 123,
"message": "<string>"
}Authorizations
API key to authorize requests
Body
application/json
Email address of the contact
ID of the list this contact belongs to
First name of the contact
Last name of the contact
Phone number of the contact
Custom data associated with the contact
Contact's address
Whether the contact has GDPR consent
Full name of the contact
Instagram handle
Twitter handle
Personal website URL
Company name
Country of residence
City of residence
Whether to send a verification email to the contact (defaults to true)
Response
Contact created successfully
Show child attributes
Show child attributes