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

Search recipients



API Overview

api-overview page anchor
(warning)

Legacy Marketing Campaigns

You are viewing the Legacy Marketing Campaigns API reference. For guidance migrating to the current version of Marketing Campaigns, see Migrating from Legacy Marketing Campaigns

(information)

Info

For the most up-to-date information on the Contacts API, please visit the new Marketing Campaigns Contacts API.

The Contacts Recipients API allows you to manage your recipients. You can add, retrieve, update, and delete recipients, as well as get a count of all recipients and all billable recipients.


POST/v3/contactdb/recipients/search

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

Search using segment conditions without actually creating a segment. Body contains a JSON object with conditions, a list of conditions as described below, and an optional list_id, which is a valid list ID for a list to limit the search on.

Valid operators for create and update depend on the type of the field for which you are searching.

Field values must all be a string.

Search conditions using "eq" or "ne" for email clicks and opens should provide a "field" of either clicks.campaign_identifier or opens.campaign_identifier.

The condition value should be a string containing the id of a completed campaign.

Search conditions list may contain multiple conditions, joined by an "and" or "or" in the "and_or" field.

The first condition in the conditions list must have an empty "and_or", and subsequent conditions must all specify an "and_or".


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
SchemaExample
Property nameTypeRequiredDescriptionChild properties
list_idinteger<int32>required

conditionsarray[object]required

The conditions by which this segment should be created.

200400
SchemaExample
Property nameTypeRequiredDescriptionChild properties
recipientsarray[object]

recipient_countinteger

Search recipients

search-recipients page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_47
const client = require('@sendgrid/client');
_47
client.setApiKey(process.env.SENDGRID_API_KEY);
_47
_47
const data = {
_47
"list_id": -27497588,
_47
"conditions": [
_47
{
_47
"and_or": "",
_47
"field": "birthday",
_47
"value": "01/12/1985",
_47
"operator": "eq"
_47
},
_47
{
_47
"and_or": "",
_47
"field": "birthday",
_47
"value": "01/12/1985",
_47
"operator": "eq"
_47
},
_47
{
_47
"and_or": "",
_47
"field": "birthday",
_47
"value": "01/12/1985",
_47
"operator": "eq"
_47
},
_47
{
_47
"and_or": "",
_47
"field": "birthday",
_47
"value": "01/12/1985",
_47
"operator": "eq"
_47
}
_47
]
_47
};
_47
_47
const request = {
_47
url: `/v3/contactdb/recipients/search`,
_47
method: 'POST',
_47
body: data
_47
}
_47
_47
client.request(request)
_47
.then(([response, body]) => {
_47
console.log(response.statusCode);
_47
console.log(response.body);
_47
})
_47
.catch(error => {
_47
console.error(error);
_47
});


Rate this page: