curl --request POST \
--url https://api.privy.com/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe",
"tags": [
"new-contact"
],
"email_consent": "subscribed"
}
'import requests
url = "https://api.privy.com/v1/contacts"
payload = {
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe",
"tags": ["new-contact"],
"email_consent": "subscribed"
}
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: 'jane@example.com',
first_name: 'Jane',
last_name: 'Doe',
tags: ['new-contact'],
email_consent: 'subscribed'
})
};
fetch('https://api.privy.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://api.privy.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([
'email' => 'jane@example.com',
'first_name' => 'Jane',
'last_name' => 'Doe',
'tags' => [
'new-contact'
],
'email_consent' => 'subscribed'
]),
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.privy.com/v1/contacts"
payload := strings.NewReader("{\n \"email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"tags\": [\n \"new-contact\"\n ],\n \"email_consent\": \"subscribed\"\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.privy.com/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"tags\": [\n \"new-contact\"\n ],\n \"email_consent\": \"subscribed\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privy.com/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\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"tags\": [\n \"new-contact\"\n ],\n \"email_consent\": \"subscribed\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cus_x9y8z7w6v5u4t3s2",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"email_consent": "subscribed",
"phone_number": null,
"sms_consent": "never_subscribed",
"tags": [
"new-contact"
],
"custom_fields": {},
"created_at": "2025-04-01T12:00:00Z",
"updated_at": "2025-04-01T12:00:00Z"
}
}{
"error": {
"code": "unauthorized",
"message": "Bearer token is missing or invalid"
}
}{
"error": {
"code": "insufficient_scope",
"message": "Token does not have the required scope"
}
}{
"error": {
"code": "conflict",
"message": "A contact with this email already exists",
"id": "cus_x9y8z7w6v5u4t3s2"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid",
"details": [
{
"field": "email",
"message": "is required"
}
]
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded"
}
}Create a contact
Create a new contact. At least one of email or phone_number is required.
If a contact with the same email or phone number already exists, a 409 Conflict
error is returned with the id of the existing contact in error.id. Use the Update a contact endpoint to modify existing contacts.
If a previously deleted contact matches the provided email or phone number, the contact is restored with the new data.
When sms_consent is subscribed, Privy automatically sends a TCPA-required
welcome SMS to the contact. Pass send_welcome_sms: false to suppress this
message if you have already collected consent outside of Privy.
Required scope: contacts_write
curl --request POST \
--url https://api.privy.com/v1/contacts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe",
"tags": [
"new-contact"
],
"email_consent": "subscribed"
}
'import requests
url = "https://api.privy.com/v1/contacts"
payload = {
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe",
"tags": ["new-contact"],
"email_consent": "subscribed"
}
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: 'jane@example.com',
first_name: 'Jane',
last_name: 'Doe',
tags: ['new-contact'],
email_consent: 'subscribed'
})
};
fetch('https://api.privy.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://api.privy.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([
'email' => 'jane@example.com',
'first_name' => 'Jane',
'last_name' => 'Doe',
'tags' => [
'new-contact'
],
'email_consent' => 'subscribed'
]),
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.privy.com/v1/contacts"
payload := strings.NewReader("{\n \"email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"tags\": [\n \"new-contact\"\n ],\n \"email_consent\": \"subscribed\"\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.privy.com/v1/contacts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"tags\": [\n \"new-contact\"\n ],\n \"email_consent\": \"subscribed\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privy.com/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\": \"jane@example.com\",\n \"first_name\": \"Jane\",\n \"last_name\": \"Doe\",\n \"tags\": [\n \"new-contact\"\n ],\n \"email_consent\": \"subscribed\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cus_x9y8z7w6v5u4t3s2",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"email_consent": "subscribed",
"phone_number": null,
"sms_consent": "never_subscribed",
"tags": [
"new-contact"
],
"custom_fields": {},
"created_at": "2025-04-01T12:00:00Z",
"updated_at": "2025-04-01T12:00:00Z"
}
}{
"error": {
"code": "unauthorized",
"message": "Bearer token is missing or invalid"
}
}{
"error": {
"code": "insufficient_scope",
"message": "Token does not have the required scope"
}
}{
"error": {
"code": "conflict",
"message": "A contact with this email already exists",
"id": "cus_x9y8z7w6v5u4t3s2"
}
}{
"error": {
"code": "validation_failed",
"message": "One or more fields are invalid",
"details": [
{
"field": "email",
"message": "is required"
}
]
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded"
}
}Authorizations
Send either an API token or an OAuth access token as
Authorization: Bearer <token>. See the Authentication page for details.
Headers
Target a subaccount instead of the main connected account.
Pass a subaccount id from get_account's subaccounts list. Only direct subaccounts
of the connected account are reachable — omit this for the main account itself.
Body
At least one of email or phone_number is required.
Use email_consent and sms_consent to set the contact's marketing
consent status at creation time.
Contact's email address.
"jane@example.com"
Contact's phone number in E.164 format.
"+15551234567"
Contact's first name.
"Jane"
Contact's last name.
"Doe"
Tags to apply to the contact.
["vip", "repeat-buyer"]
Flat key-value pairs. Nested objects are not allowed.
Show child attributes
Show child attributes
{ "loyalty_tier": "gold" }
Email marketing consent status. If not provided, defaults to never_subscribed.
compliance_suppressed is read-only and cannot be set on create.
subscribed, unsubscribed, never_subscribed, suppressed "subscribed"
SMS marketing consent status. pending is read-only and cannot be set.
subscribed and single_opt_in require a valid phone_number from a
supported country. Cannot be unsubscribed for new contacts (no existing
consent to revoke).
subscribed, unsubscribed, never_subscribed, single_opt_in "never_subscribed"
When sms_consent is set to subscribed and the contact transitions
to a confirmed SMS opt-in state, Privy sends a TCPA-required welcome
SMS. Set to false to suppress this message when you have already
collected consent outside of Privy.
false
Response
Contact created successfully.
A contact in your Privy account: identity, marketing consent per channel, tags, and custom fields. Email and SMS consent are tracked independently — a contact who opts out of one keeps whatever consent they had for the other.
Show child attributes
Show child attributes
Was this page helpful?