curl --request PATCH \
--url https://api.privy.com/v1/contacts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "Janet",
"tags": [
"vip",
"wholesale"
],
"email_consent": "unsubscribed"
}
'import requests
url = "https://api.privy.com/v1/contacts/{id}"
payload = {
"first_name": "Janet",
"tags": ["vip", "wholesale"],
"email_consent": "unsubscribed"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({first_name: 'Janet', tags: ['vip', 'wholesale'], email_consent: 'unsubscribed'})
};
fetch('https://api.privy.com/v1/contacts/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'first_name' => 'Janet',
'tags' => [
'vip',
'wholesale'
],
'email_consent' => 'unsubscribed'
]),
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/{id}"
payload := strings.NewReader("{\n \"first_name\": \"Janet\",\n \"tags\": [\n \"vip\",\n \"wholesale\"\n ],\n \"email_consent\": \"unsubscribed\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.privy.com/v1/contacts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"Janet\",\n \"tags\": [\n \"vip\",\n \"wholesale\"\n ],\n \"email_consent\": \"unsubscribed\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privy.com/v1/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"Janet\",\n \"tags\": [\n \"vip\",\n \"wholesale\"\n ],\n \"email_consent\": \"unsubscribed\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cus_a1b2c3d4e5f6g7h8",
"first_name": "Janet",
"last_name": "Doe",
"email": "jane@example.com",
"email_consent": "unsubscribed",
"phone_number": "+15551234567",
"sms_consent": "subscribed",
"tags": [
"vip",
"wholesale"
],
"custom_fields": {
"loyalty_tier": "gold"
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-04-01T12:15:00Z"
}
}{
"error": {
"code": "malformed_json",
"message": "The request body is not valid JSON."
}
}{
"error": {
"code": "unauthorized",
"message": "Bearer token is missing or invalid"
}
}{
"error": {
"code": "insufficient_scope",
"message": "Token does not have the required scope"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"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"
}
}Update a contact
Update an existing contact identified by its unique id.
Include one or more fields to change. Field updates and consent changes
can be combined in a single request.
Mutable fields: first_name, last_name, email, phone_number, tags, custom_fields.
email and phone_number can only be set when the existing value is
null. Once populated, they cannot be changed or cleared.
Consent fields: email_consent, sms_consent. Use these to subscribe,
unsubscribe, or otherwise manage a contact’s marketing consent.
When sms_consent is set to subscribed and the contact transitions to
a confirmed opt-in state, Privy automatically sends a TCPA-required
welcome SMS. Pass send_welcome_sms: false to suppress this message if
you have already collected consent outside of Privy.
Required scope: contacts_write
curl --request PATCH \
--url https://api.privy.com/v1/contacts/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"first_name": "Janet",
"tags": [
"vip",
"wholesale"
],
"email_consent": "unsubscribed"
}
'import requests
url = "https://api.privy.com/v1/contacts/{id}"
payload = {
"first_name": "Janet",
"tags": ["vip", "wholesale"],
"email_consent": "unsubscribed"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({first_name: 'Janet', tags: ['vip', 'wholesale'], email_consent: 'unsubscribed'})
};
fetch('https://api.privy.com/v1/contacts/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'first_name' => 'Janet',
'tags' => [
'vip',
'wholesale'
],
'email_consent' => 'unsubscribed'
]),
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/{id}"
payload := strings.NewReader("{\n \"first_name\": \"Janet\",\n \"tags\": [\n \"vip\",\n \"wholesale\"\n ],\n \"email_consent\": \"unsubscribed\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.privy.com/v1/contacts/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"first_name\": \"Janet\",\n \"tags\": [\n \"vip\",\n \"wholesale\"\n ],\n \"email_consent\": \"unsubscribed\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privy.com/v1/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"first_name\": \"Janet\",\n \"tags\": [\n \"vip\",\n \"wholesale\"\n ],\n \"email_consent\": \"unsubscribed\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cus_a1b2c3d4e5f6g7h8",
"first_name": "Janet",
"last_name": "Doe",
"email": "jane@example.com",
"email_consent": "unsubscribed",
"phone_number": "+15551234567",
"sms_consent": "subscribed",
"tags": [
"vip",
"wholesale"
],
"custom_fields": {
"loyalty_tier": "gold"
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-04-01T12:15:00Z"
}
}{
"error": {
"code": "malformed_json",
"message": "The request body is not valid JSON."
}
}{
"error": {
"code": "unauthorized",
"message": "Bearer token is missing or invalid"
}
}{
"error": {
"code": "insufficient_scope",
"message": "Token does not have the required scope"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"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
Headers
Path Parameters
Body
Include one or more fields to update. The contact is identified
by the id path parameter. Field updates and consent changes can be
combined in a single request.
Mutable fields: first_name, last_name, email, phone_number, tags, custom_fields.
email and phone_number can only be set when the existing value is
null. Once populated, they cannot be changed or cleared.
Consent fields: email_consent, sms_consent. Use these to manage a
contact's marketing consent instead of the deprecated unsubscribe endpoint.
Update the contact's email marketing consent.
compliance_suppressed is read-only — any write to this field on a
compliance-suppressed contact returns 422. The contact's other
fields, and its sms_consent, stay editable.
For merchant-suppressed contacts, writing any consent value first
unsuppresses, then applies the requested transition (e.g.
subscribed unsuppresses then subscribes).
subscribed, unsubscribed, never_subscribed, suppressed "unsubscribed"
Update the contact's SMS marketing consent. pending is read-only.
subscribed, single_opt_in, and unsubscribed require the contact
to have a phone number. single_opt_in is idempotent when the contact
is already in that state, and returns 422 from terminal states
(pending, subscribed, or unsubscribed).
subscribed, unsubscribed, never_subscribed, single_opt_in "unsubscribed"
Was this page helpful?