Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Delete Contacts



Operation overview

DELETE/v3/marketing/contacts

Base url: https://api.sendgrid.com

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.


Operation details

Authentication

Headers

Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>

Query string

Property nameTypeRequiredDescription
delete_all_contactsstringOptional

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


idsstringOptional

A comma-separated list of contact IDs.

Responses

202400401403404500

The deletion job has been accepted and is being processed.

Schema
Property nameTypeRequiredDescriptionChild properties
job_idobject

The deletion job ID.

Delete All Contacts

Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_21
const client = require('@sendgrid/client');
_21
client.setApiKey(process.env.SENDGRID_API_KEY);
_21
_21
const queryParams = {
_21
"delete_all_contacts": "true"
_21
};
_21
_21
const request = {
_21
url: `/v3/marketing/contacts`,
_21
method: 'DELETE',
_21
qs: queryParams
_21
}
_21
_21
client.request(request)
_21
.then(([response, body]) => {
_21
console.log(response.statusCode);
_21
console.log(response.body);
_21
})
_21
.catch(error => {
_21
console.error(error);
_21
});

Delete Contacts by ids

Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_21
const client = require('@sendgrid/client');
_21
client.setApiKey(process.env.SENDGRID_API_KEY);
_21
_21
const queryParams = {
_21
"ids": "1, 2"
_21
};
_21
_21
const request = {
_21
url: `/v3/marketing/contacts`,
_21
method: 'DELETE',
_21
qs: queryParams
_21
}
_21
_21
client.request(request)
_21
.then(([response, body]) => {
_21
console.log(response.statusCode);
_21
console.log(response.body);
_21
})
_21
.catch(error => {
_21
console.error(error);
_21
});


Rate this page: