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

Get a List by ID



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/{id}

Base url: https://api.sendgrid.com

This endpoint returns data about a specific list. Setting the optional parameter contact_sample=true returns the contact_sample in the response body. Up to 50 of the most recent contacts uploaded or attached to a list will be returned. The full contact count is also returned.


Authentication

authentication page anchor
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
idstringrequired

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

contact_sampleboolean

Setting this parameter to the true will cause the contact_sample to be returned

Default: false
200404
SchemaExample
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

contact_sampleobject

Get a List by ID

get-a-list-by-id page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

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


Rate this page: