Unsubscribe subscribers
curl --request POST \
--url https://api.paubox.com/v1/marketing/subscriptions/unsubscribe \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"subscriber_ids": [
"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60"
],
"subscription_list_ids": [
"123e4567-e89b-12d3-a456-426614174000"
]
}
'import requests
url = "https://api.paubox.com/v1/marketing/subscriptions/unsubscribe"
payload = {
"subscriber_ids": ["8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60"],
"subscription_list_ids": ["123e4567-e89b-12d3-a456-426614174000"]
}
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriber_ids: ['8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60'],
subscription_list_ids: ['123e4567-e89b-12d3-a456-426614174000']
})
};
fetch('https://api.paubox.com/v1/marketing/subscriptions/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.paubox.com/v1/marketing/subscriptions/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([
'subscriber_ids' => [
'8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60'
],
'subscription_list_ids' => [
'123e4567-e89b-12d3-a456-426614174000'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <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://api.paubox.com/v1/marketing/subscriptions/unsubscribe"
payload := strings.NewReader("{\n \"subscriber_ids\": [\n \"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60\"\n ],\n \"subscription_list_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<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://api.paubox.com/v1/marketing/subscriptions/unsubscribe")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"subscriber_ids\": [\n \"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60\"\n ],\n \"subscription_list_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paubox.com/v1/marketing/subscriptions/unsubscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriber_ids\": [\n \"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60\"\n ],\n \"subscription_list_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "<string>",
"type": "<string>",
"attributes": {
"email": "jsmith@example.com",
"first_name": "<string>",
"last_name": "<string>",
"unsubscribed": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"custom_fields": [
{
"subscriber_custom_field_type_id": "<string>",
"custom_field_name": "<string>",
"custom_field_value": "<string>"
}
],
"subscription_lists": [
{
"id": "<string>",
"name": "<string>",
"unsubscribed": true
}
],
"statistics": {
"deliveries": 123,
"delivered": 123,
"opened": 123,
"clicked": 123,
"soft_bounced": 123,
"hard_bounced": 123,
"unsubscribed": 123,
"global_unsubscribed": 123
}
}
}
],
"errors": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Marketing · Subscriptions
Unsubscribe subscribers
Unsubscribes one or more subscribers, identified by their UUIDs.
When subscription_list_ids is supplied, the matching subscriptions are stamped with unsubscribed_at and the subscribers remain subscribed to every other list. When it is omitted, the subscribers are globally opted out by stamping opted_out_on, which suppresses all future marketing email to them.
Example curl command:
curl -X POST \
https://api.paubox.com/v1/marketing/subscriptions/unsubscribe \
-H 'authorization: Token token=YOUR_API_KEY' \
-H 'content-type: application/json' \
-d '{
"subscriber_ids": ["8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60"],
"subscription_list_ids": ["123e4567-e89b-12d3-a456-426614174000"]
}'
POST
/
subscriptions
/
unsubscribe
Unsubscribe subscribers
curl --request POST \
--url https://api.paubox.com/v1/marketing/subscriptions/unsubscribe \
--header 'Content-Type: application/json' \
--header 'authorization: <api-key>' \
--data '
{
"subscriber_ids": [
"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60"
],
"subscription_list_ids": [
"123e4567-e89b-12d3-a456-426614174000"
]
}
'import requests
url = "https://api.paubox.com/v1/marketing/subscriptions/unsubscribe"
payload = {
"subscriber_ids": ["8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60"],
"subscription_list_ids": ["123e4567-e89b-12d3-a456-426614174000"]
}
headers = {
"authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriber_ids: ['8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60'],
subscription_list_ids: ['123e4567-e89b-12d3-a456-426614174000']
})
};
fetch('https://api.paubox.com/v1/marketing/subscriptions/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.paubox.com/v1/marketing/subscriptions/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([
'subscriber_ids' => [
'8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60'
],
'subscription_list_ids' => [
'123e4567-e89b-12d3-a456-426614174000'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <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://api.paubox.com/v1/marketing/subscriptions/unsubscribe"
payload := strings.NewReader("{\n \"subscriber_ids\": [\n \"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60\"\n ],\n \"subscription_list_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<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://api.paubox.com/v1/marketing/subscriptions/unsubscribe")
.header("authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"subscriber_ids\": [\n \"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60\"\n ],\n \"subscription_list_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paubox.com/v1/marketing/subscriptions/unsubscribe")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriber_ids\": [\n \"8f14e45f-ceea-467a-9f2c-4b3d2a1e5c60\"\n ],\n \"subscription_list_ids\": [\n \"123e4567-e89b-12d3-a456-426614174000\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "<string>",
"type": "<string>",
"attributes": {
"email": "jsmith@example.com",
"first_name": "<string>",
"last_name": "<string>",
"unsubscribed": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"custom_fields": [
{
"subscriber_custom_field_type_id": "<string>",
"custom_field_name": "<string>",
"custom_field_value": "<string>"
}
],
"subscription_lists": [
{
"id": "<string>",
"name": "<string>",
"unsubscribed": true
}
],
"statistics": {
"deliveries": 123,
"delivered": 123,
"opened": 123,
"clicked": 123,
"soft_bounced": 123,
"hard_bounced": 123,
"unsubscribed": 123,
"global_unsubscribed": 123
}
}
}
],
"errors": "<string>"
}{
"error": "<string>",
"code": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"details": {}
}Authorizations
Token-based authentication. Use format: "Token token=<API_KEY>" where <API_KEY> is your API key
Body
application/json
Response
The affected subscribers. If the operation raises, the response is still 200 but the body contains an errors string.
⌘I