Skip to contentSkip to navigationSkip to topbar
On this page

Get Batched Contacts by IDs



Operation overview

operation-overview page anchor

POST/v3/marketing/contacts/batch

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

This endpoint is used to retrieve a set of contacts identified by their IDs.

This can be more efficient endpoint to get contacts than making a series of individual GET requests to the "Get a Contact by ID" endpoint.

You can supply up to 100 IDs. Pass them into the ids field in your request body as an array or one or more strings.

Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
idsarray[string]required
200401403404500
Schema
Property nameTypeRequiredDescriptionChild properties
resultarray[object]
Get Batched Contacts by IDsLink to code sample: Get Batched Contacts by IDs
1
const client = require('@sendgrid/client');
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const data = {
5
"ids": [
6
"1234",
7
"1235"
8
]
9
};
10
11
const request = {
12
url: `/v3/marketing/contacts/batch`,
13
method: 'POST',
14
body: data
15
}
16
17
client.request(request)
18
.then(([response, body]) => {
19
console.log(response.statusCode);
20
console.log(response.body);
21
})
22
.catch(error => {
23
console.error(error);
24
});