Skip to contentSkip to navigationSkip to topbar
On this page

Erase Recipients' Email Data



API Overview

api-overview page anchor

The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' email-related personal data from the Twilio SendGrid Platform. This feature helps customers comply with data privacy regulations.

(information)

Info

The Recipients' Data Erasure API isn't enabled for all customers by default.

  • For customers who signed up after July 25, 2023: This API is already enabled for your account.
  • For customers who signed up before July 25, 2023: Check your account scopes by making a GET /v3/scopes request. If the recipients.erasejob.read and recipients.erasejob.create scopes are missing, contact Support(link takes you to an external page) to enable them.

POST/v3/recipients/erasejob

Base url: https://api.sendgrid.com (for global users and subusers)

Base url: https://api.eu.sendgrid.com (for EU regional subusers)

This operation allows you to delete your recipients' personal email data

The Delete Recipients' Email Data operation accepts a list of 5,000 email_addresses or a total payload size of 256Kb per request, whichever comes first. Upon a successful request with this operation, SendGrid will run a search on the email addresses provided against the SendGrid system to identify matches. SendGrid will then delete all personal data associated with the matched users such as the recipients' names, email addresses, subject lines, categories, and IP addresses.

All email addresses are filtered for uniqueness and tested for structural validity—any invalid addresses will be returned in an error response.

Please note that recipient data is deleted for the account making the request only—deletions do not cascade from a parent account to its Subusers' recipients. To delete a Subuser's recipients' data, you can use the on-behalf-of header.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
authorizationstring
required
Default: Bearer <<YOUR_API_KEY_HERE>>

onBehalfOfstring

Optional

The on-behalf-of header allows you to make API calls from a parent account on behalf of the parent's Subusers or customer accounts. You will use the parent account's API key when using this header. When making a call on behalf of a customer account, the property value should be "account-id" followed by the customer account's ID (e.g., on-behalf-of: account-id <account-id>). When making a call on behalf of a Subuser, the property value should be the Subuser's username (e.g., on-behalf-of: <subuser-username>). See On Behalf Of for more information.

Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
emailAddressesarray[string]
required

List of unique recipient email addresses whose PII will be erased. You may include a maximum of 5,000 addresses or a maximum payload size of 256Kb, whichever comes first.

Min items: 1Max items: 5000
202400401403404429500

The request was accepted for processing

SchemaExample
Property nameTypeRequiredDescriptionChild properties
jobIdstring

Optional

The job ID associated with the data erasure request.

Erase Recipients' Email DataLink to code sample: Erase Recipients' Email Data
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const data = {
5
email_addresses: ["user1@example.com", "user2@example.com"],
6
};
7
8
const request = {
9
url: `/v3/recipients/erasejob`,
10
method: "POST",
11
body: data,
12
};
13
14
client
15
.request(request)
16
.then(([response, body]) => {
17
console.log(response.statusCode);
18
console.log(response.body);
19
})
20
.catch((error) => {
21
console.error(error);
22
});