Erase Recipients
curl --request POST \
--url https://api.example.com/email/lists/{list_id}/recipients/erase \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"<string>"
],
"external_ids": [
"<string>"
]
}
'import requests
url = "https://api.example.com/email/lists/{list_id}/recipients/erase"
payload = {
"emails": ["<string>"],
"external_ids": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({emails: ['<string>'], external_ids: ['<string>']})
};
fetch('https://api.example.com/email/lists/{list_id}/recipients/erase', 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.example.com/email/lists/{list_id}/recipients/erase",
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([
'emails' => [
'<string>'
],
'external_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/email/lists/{list_id}/recipients/erase"
payload := strings.NewReader("{\n \"emails\": [\n \"<string>\"\n ],\n \"external_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/email/lists/{list_id}/recipients/erase")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"<string>\"\n ],\n \"external_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/email/lists/{list_id}/recipients/erase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"<string>\"\n ],\n \"external_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"erased": 123,
"suppressed": 123,
"not_found": [
"<string>"
]
}Mailing Lists
Erase Recipients
Permanently delete recipients — for when one of your users asks to be forgotten
POST
/
email
/
lists
/
{list_id}
/
recipients
/
erase
Erase Recipients
curl --request POST \
--url https://api.example.com/email/lists/{list_id}/recipients/erase \
--header 'Content-Type: application/json' \
--data '
{
"emails": [
"<string>"
],
"external_ids": [
"<string>"
]
}
'import requests
url = "https://api.example.com/email/lists/{list_id}/recipients/erase"
payload = {
"emails": ["<string>"],
"external_ids": ["<string>"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({emails: ['<string>'], external_ids: ['<string>']})
};
fetch('https://api.example.com/email/lists/{list_id}/recipients/erase', 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.example.com/email/lists/{list_id}/recipients/erase",
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([
'emails' => [
'<string>'
],
'external_ids' => [
'<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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.example.com/email/lists/{list_id}/recipients/erase"
payload := strings.NewReader("{\n \"emails\": [\n \"<string>\"\n ],\n \"external_ids\": [\n \"<string>\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/email/lists/{list_id}/recipients/erase")
.header("Content-Type", "application/json")
.body("{\n \"emails\": [\n \"<string>\"\n ],\n \"external_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/email/lists/{list_id}/recipients/erase")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"emails\": [\n \"<string>\"\n ],\n \"external_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"erased": 123,
"suppressed": 123,
"not_found": [
"<string>"
]
}Use this when a person asks you to erase their data (GDPR Article 17). Unlike a removal, which keeps the row so the contact can be restored, an erase deletes the recipient outright — email, name,
At least one of the two, at most 1000 identifiers in total.
external_id and attributes — in any status.
One thing survives on purpose: if the person had unsubscribed, Shipstar keeps a one-way SHA-256 hash of their address on that list. A later upsert or add of the same address is then still skipped as unsubscribed, so erasing someone can never quietly re-subscribe them. The hash can’t be turned back into the address.
Up to 1000 identifiers per call; emails match case-insensitively. A repeated call reports everything as not_found.
Authentication
This endpoint requires an API token passed as a Bearer token in theAuthorization header.
Authorization: Bearer YOUR_API_TOKEN
Path Parameters
string
required
The mailing list’s unique identifier (UUID).
Body
string[]
Email addresses to erase
string[]
External ids to erase
Request
cURL
curl -X POST "https://api.shipstar.ai/api/v1/email/lists/a1b2c3d4-e5f6-7890-abcd-ef1234567890/recipients/erase" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"external_ids": ["usr_42"], "emails": ["former@example.com"]}'
Response
integer
required
Recipients permanently deleted
integer
required
Of those, recipients who had unsubscribed — kept only as a hash so their opt-out holds
string[]
required
Identifiers that matched nothing on this list
200
{"erased": 2, "suppressed": 1, "not_found": []}
Errors
| Status | Meaning |
|---|---|
| 401 | Missing or invalid API token |
| 404 | The list doesn’t exist or belongs to another project |
| 422 | No identifiers, or more than 1000 |
| 429 | Rate limited (30 write calls per minute) |
Was this page helpful?