Skip to contentSkip to navigationSkip to topbar
On this page

Delete Contacts



Operation overview

operation-overview page anchor

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.


Authentication

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

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
jobIdobject

Optional

The deletion job ID.

Delete All ContactsLink to code sample: Delete All Contacts
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
});