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
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
delete_all_contactsstringOptional

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


idsstringOptional

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.

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 = {
5
delete_all_contacts: "true",
6
};
7
8
const request = {
9
url: `/v3/marketing/contacts`,
10
method: "DELETE",
11
qs: queryParams,
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
});
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = {
5
ids: "1, 2",
6
};
7
8
const request = {
9
url: `/v3/marketing/contacts`,
10
method: "DELETE",
11
qs: queryParams,
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
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.