Delete Contacts



DELETE/v3/marketing/contacts

Base url: https://api.sendgrid.com (The Twilio SendGrid v3 API)

This endpoint can be used to delete one or more contacts.

The query parameter ids must set to a comma-separated list of contact IDs for bulk contact deletion.

The query parameter delete_all_contacts must be set to "true" to delete all contacts.

You must set either ids or delete_all_contacts.

Deletion jobs are processed asynchronously.

Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.


Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
delete_all_contactsstring

Optional

Must be set to "true" to delete all contacts.


idsstring

Optional

A comma-separated list of contact IDs.

202400401403404500

The deletion job has been accepted and is being processed.

Schema
Property nameTypeRequiredDescriptionChild properties
job_idobject

The deletion job ID.

1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = { delete_all_contacts: "true" };
5
6
const request = {
7
url: `/v3/marketing/contacts`,
8
method: "DELETE",
9
qs: queryParams,
10
};
11
12
client
13
.request(request)
14
.then(([response, body]) => {
15
console.log(response.statusCode);
16
console.log(response.body);
17
})
18
.catch((error) => {
19
console.error(error);
20
});
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = { ids: "1, 2" };
5
6
const request = {
7
url: `/v3/marketing/contacts`,
8
method: "DELETE",
9
qs: queryParams,
10
};
11
12
client
13
.request(request)
14
.then(([response, body]) => {
15
console.log(response.statusCode);
16
console.log(response.body);
17
})
18
.catch((error) => {
19
console.error(error);
20
});