Skip to contentSkip to navigationSkip to topbar
On this page

Update 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".


PATCH/v3/marketing/lists/{id}

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

This endpoint updates the name of a list.


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.

Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
namestringOptional

Your name for your list.

200400404
SchemaExample
Property nameTypeRequiredDescriptionChild properties
idstring

The generated ID for your list.

Min length: 36Max length: 36

namestring

The name you gave your list.


contact_countinteger

The number of contacts currently stored on the list.


_metadataobject
Update ListLink to code sample: Update List
1
const client = require('@sendgrid/client');
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const id = "ZGkrHSypTsudrGkmdpJJ";
5
const data = {
6
"name": "updated-list-name"
7
};
8
9
const request = {
10
url: `/v3/marketing/lists/${id}`,
11
method: 'PATCH',
12
body: data
13
}
14
15
client.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
});