Skip to contentSkip to navigationSkip to topbar
Rate this page:
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

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>>
SchemaExample
Property nameTypeRequiredDescriptionChild properties
idsarray[string]required
200401403404500
Schema
Property nameTypeRequiredDescriptionChild properties
resultarray[object]

Get Batched Contacts by IDs

get-batched-contacts-by-ids page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_24
const client = require('@sendgrid/client');
_24
client.setApiKey(process.env.SENDGRID_API_KEY);
_24
_24
const data = {
_24
"ids": [
_24
"1234",
_24
"1235"
_24
]
_24
};
_24
_24
const request = {
_24
url: `/v3/marketing/contacts/batch`,
_24
method: 'POST',
_24
body: data
_24
}
_24
_24
client.request(request)
_24
.then(([response, body]) => {
_24
console.log(response.statusCode);
_24
console.log(response.body);
_24
})
_24
.catch(error => {
_24
console.error(error);
_24
});


Rate this page: