curl --request POST \
--url https://api.privy.com/v1/contacts/{id}/unsubscribe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "Contact requested removal from mailing list"
}
'import requests
url = "https://api.privy.com/v1/contacts/{id}/unsubscribe"
payload = { "reason": "Contact requested removal from mailing list" }
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({reason: 'Contact requested removal from mailing list'})
};
fetch('https://api.privy.com/v1/contacts/{id}/unsubscribe', 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}/unsubscribe",
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([
'reason' => 'Contact requested removal from mailing list'
]),
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}/unsubscribe"
payload := strings.NewReader("{\n \"reason\": \"Contact requested removal from mailing list\"\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/{id}/unsubscribe")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Contact requested removal from mailing list\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privy.com/v1/contacts/{id}/unsubscribe")
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 \"reason\": \"Contact requested removal from mailing list\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cus_a1b2c3d4e5f6g7h8",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"email_consent": "unsubscribed",
"phone_number": "+15551234567",
"sms_consent": "subscribed",
"tags": [
"vip"
],
"custom_fields": {
"loyalty_tier": "gold"
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-04-01T12:30: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": "not_found",
"message": "Contact not found"
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit exceeded"
}
}Unsubscribe a contact
Deprecated. Use PATCH /v1/contacts/{id} with email_consent: "unsubscribed"
instead. This endpoint will be removed in a future release.
Globally unsubscribe a contact from all email marketing.
If the contact is already unsubscribed, this endpoint returns successfully without making changes.
Responses include Deprecation: true and a Link header pointing to
migration documentation.
Required scope: contacts_write
curl --request POST \
--url https://api.privy.com/v1/contacts/{id}/unsubscribe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "Contact requested removal from mailing list"
}
'import requests
url = "https://api.privy.com/v1/contacts/{id}/unsubscribe"
payload = { "reason": "Contact requested removal from mailing list" }
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({reason: 'Contact requested removal from mailing list'})
};
fetch('https://api.privy.com/v1/contacts/{id}/unsubscribe', 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}/unsubscribe",
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([
'reason' => 'Contact requested removal from mailing list'
]),
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}/unsubscribe"
payload := strings.NewReader("{\n \"reason\": \"Contact requested removal from mailing list\"\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/{id}/unsubscribe")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"Contact requested removal from mailing list\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privy.com/v1/contacts/{id}/unsubscribe")
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 \"reason\": \"Contact requested removal from mailing list\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "cus_a1b2c3d4e5f6g7h8",
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"email_consent": "unsubscribed",
"phone_number": "+15551234567",
"sms_consent": "subscribed",
"tags": [
"vip"
],
"custom_fields": {
"loyalty_tier": "gold"
},
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-04-01T12:30: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": "not_found",
"message": "Contact not found"
}
}{
"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.
Path Parameters
The contact's unique identifier (returned as id in contact responses).
Body
Optional reason for unsubscribing.
500"Contact requested removal from mailing list"
Response
Contact unsubscribed successfully.
Show child attributes
Show child attributes
Was this page helpful?