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

Remove Contacts from a List



API Overview

api-overview page anchor

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

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

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


Authentication

authentication page anchor
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

Remove Contacts from a List

remove-contacts-from-a-list page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

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


Rate this page: