Contacts API - Recipients
Elements that can be shared among more than one endpoint definition.
Search 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.
- Dates:
- "eq", "ne", "lt" (before), "gt" (after)
- You may use MM/DD/YYYY for day granularity or an epoch for second granularity.
- "empty", "not_empty"
- "is within"
- You may use an ISO 8601 date format or the # of days.
- "eq", "ne", "lt" (before), "gt" (after)
- Text: "contains", "eq" (is - matches the full field), "ne" (is not - matches any field where the entire field is not the condition value), "empty", "not_empty"
- Numbers: "eq", "lt", "gt", "empty", "not_empty"
- Email Clicks and Opens: "eq" (opened), "ne" (not opened)
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
- API Key
Headers
Request Body
The conditions by which this segment should be created.
{
"list_id": -27497588,
"conditions": [
{
"and_or": "",
"field": "birthday",
"value": "01/12/1985",
"operator": "eq"
},
{
"and_or": "",
"field": "birthday",
"value": "01/12/1985",
"operator": "eq"
},
{
"and_or": "",
"field": "birthday",
"value": "01/12/1985",
"operator": "eq"
},
{
"and_or": "",
"field": "birthday",
"value": "01/12/1985",
"operator": "eq"
}
]
}
Responses
Need some help?
We all do sometimes. Get help now from the Twilio SendGrid Support Team.
Running into a coding hurdle? Lean on the wisdom of the crowd by browsing the SendGrid tag on Stack Overflow or visiting Twilio's Stack Overflow Collective.