Skip to contentSkip to navigationSkip to topbar
On this page

Get All Lists



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


GET/v3/marketing/lists

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

This endpoint returns an array of all of your contact lists.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Property nameTypeRequiredDescription
page_sizenumberOptional

Maximum number of elements to return. Defaults to 100, returns 1000 max

Minimum: 1Maximum: 1000Default: 100

page_tokenstringOptional
200
SchemaExample
Property nameTypeRequiredDescriptionChild properties
resultarray[object]

_metadataobject
Get All ListsLink to code sample: Get All Lists
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const queryParams = {
5
page_size: 100,
6
};
7
8
const request = {
9
url: `/v3/marketing/lists`,
10
method: "GET",
11
qs: queryParams,
12
};
13
14
client
15
.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
});

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.