Remove Contacts from a List



Lists are static collections of Marketing Campaigns contacts. This API allows you to interact with the list objects themselves. To add contacts to a list, you must use the Contacts API.

You can also manage your lists using the Contacts menu in the Marketing Campaigns UI(link takes you to an external page). For more information about lists and best practices for building them, see "Building your Contact List".


DELETE/v3/marketing/lists/{id}/contacts

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

This endpoint allows you to remove contacts from a given list.

The contacts will not be deleted. Only their list membership will be changed.


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

The ID of the list on which you want to perform the operation.

Property nameTypeRequiredDescription
contact_idsstringrequired

Comma separated list of contact IDs that you want to remove from the specified contacts list.

Min length: 1
202400404

The removal is accepted and processing.

Schema
Property nameTypeRequiredDescriptionChild properties
job_idstring

job_id of the async job

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