Request data removal (GDPR)
Erase a recipient’s personal data across your account — GDPR right to erasure via one API call.
When a data subject asks you to erase their data, one call handles the wemail side. The erasure runs as a background job and is irreversible and audit-logged. It requires a full_access key (send_only and read_only keys get 403 insufficient_scope).
POST /v3/data-removals
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Required | The data subject’s address (lowercased before matching). |
notify_webhook_url | string | Optional | Optional URL we POST { removal_id, status, completed_at } to when the erasure finishes (best-effort — polling is the source of truth). |
What gets erased
Recipient addresses and message content are stored encrypted, with a separate encryption key per data subject. Erasure is crypto-shredding: the person’s key is destroyed, so every stored copy of their address becomes unreadable at once — it reads back as [erased] everywhere (Activity, events API, exports) without rewriting the encrypted rows.
| Parameter | Type | Required | Description |
|---|---|---|---|
Recipient address | shredded | Optional | The subject’s key is destroyed: their address on every message and event in the account becomes unreadable. Event rows keep their type and timestamp, so your analytics counts stay truthful. |
Message content | shredded when sole recipient | Optional | A message’s body (subject, HTML/text, variables, headers, metadata) is shared by all of its recipients, so its content key is destroyed only when every recipient of that message has been erased. A message that also went to people who were not erased keeps its body for them. |
Verification results | deleted | Optional | Email-verification rows for the address are deleted, cached verdicts invalidated, and the address is redacted from stored bulk-job sources. |
Download logs | cleared | Optional | Hosted-upload download attribution for the recipient is cleared. |
Export files | purged | Optional | Completed export files that contain the address — event exports (POST /v3/events/export) and Console grid exports — are deleted. |
Responses
| Status | Description |
|---|---|
202 | { removal_id, status: "pending" } — poll GET /v3/data-removals/{id}. |
403 | Key scope does not allow mutations (full_access required). |
429 | Rate limit exceeded (10 calls/minute). |
Code examples
cURL
curl -X POST https://api.wemail.io/v3/data-removals \
-H "Authorization: Bearer afn_live_…" \
-H "Content-Type: application/json" \
-d '{ "email": "person@example.com" }'Node.js
import { WemailClient } from "@wemailio/sdk";
const wemail = new WemailClient(process.env.WEMAIL_API_KEY);
const removal = await wemail.dataRemovals.createDataRemoval({
createDataRemovalRequest: { email: "person@example.com" },
});
console.log(removal.removalId); // poll getDataRemoval({ id: removal.removalId })Python
import os
from wemail import WemailClient, CreateDataRemovalRequest
wemail = WemailClient(api_key=os.environ["WEMAIL_API_KEY"])
removal = wemail.data_removals.create_data_removal(
CreateDataRemovalRequest(email="person@example.com"),
)
print(removal.removal_id)PHP
<?php
$wemail = new \Wemail\WemailClient(getenv('WEMAIL_API_KEY'));
$removal = $wemail->dataRemovals()->createDataRemoval(
new \Wemail\Sdk\Model\CreateDataRemovalRequest(['email' => 'person@example.com'])
);
echo $removal->getRemovalId();Ruby
wemail = Wemail::Client.new(api_key: ENV["WEMAIL_API_KEY"])
removal = wemail.data_removals.create_data_removal(
Wemail::CreateDataRemovalRequest.new(email: "person@example.com"))
puts removal.removal_idGo
client, _ := wemail.NewClient(os.Getenv("WEMAIL_API_KEY"))
// Generated layer (client.API.*): pass the key in the context.
ctx := context.WithValue(context.Background(), wemail.ContextAccessToken, os.Getenv("WEMAIL_API_KEY"))
removal, _, err := client.API.DataRemovalsAPI.CreateDataRemoval(ctx).
CreateDataRemovalRequest(wemail.CreateDataRemovalRequest{Email: "person@example.com"}).
Execute()
fmt.Println(removal.RemovalId)Java
WemailClient wemail = new WemailClient(System.getenv("WEMAIL_API_KEY"));
DataRemovalAccepted removal = wemail.dataRemovals().createDataRemoval(
new CreateDataRemovalRequest().email("person@example.com"));
System.out.println(removal.getRemovalId());.NET
var wemail = new WemailClient(Environment.GetEnvironmentVariable("WEMAIL_API_KEY"));
var removal = await wemail.DataRemovals.CreateDataRemovalAsync(
new CreateDataRemovalRequest(email: "person@example.com"));
Console.WriteLine(removal.RemovalId);