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. For more information about lists and best practices for building them, see "Building your Contact List".
This endpoint allows you to deletes a specific list.
Optionally, you can also delete contacts associated to the list. The query parameter, delete_contacts=true
, will delete the list and start an asynchronous job to delete associated contacts.
Bearer <<YOUR_API_KEY_HERE>>
The ID of the list on which you want to perform the operation.
Flag indicates that all contacts on the list are also to be deleted.
false
The delete has been accepted and is processing.
job_id of the async job
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const id = "ZGkrHSypTsudrGkmdpJJ";56const request = {7url: `/v3/marketing/lists/${id}`,8method: 'DELETE',910}1112client.request(request)13.then(([response, body]) => {14console.log(response.statusCode);15console.log(response.body);16})17.catch(error => {18console.error(error);19});