Contacts
Get Contacts by Emails
POST /v3/marketing/contacts/search/emails
Base url: https://api.sendgrid.com
This endpoint allows you to retrieve up to 100 contacts matching the searched email
address(es), including any alternate_emails
.
Email addresses are unique to a contact, meaning this endpoint can treat an email address as a primary key to search by. The contact object associated with the address, whether it is their email
or one of their alternate_emails
will be returned if matched.
Email addresses in the search request do not need to match the case in which they're stored, but the email addresses in the result will be all lower case. Empty strings are excluded from the search and will not be returned.
This endpoint should be used in place of the "Search Contacts" endpoint when you can provide exact email addresses and do not need to include other Segmentation Query Language (SGQL) filters when searching.
If you need to access a large percentage of your contacts, we recommend exporting your contacts with the "Export Contacts" endpoint and filtering the results client side.
This endpoint returns a 200
status code when any contacts match the address(es) you supplied. When searching multiple addresses in a single request, it is possible that some addresses will match a contact while others will not. When a partially successful search like this is made, the matching contacts are returned in an object and an error message is returned for the email address(es) that are not found.
This endpoint returns a 404
status code when no contacts are found for the provided email address(es).
A 400
status code is returned if any searched addresses are invalid.
Twilio SendGrid recommends exporting your contacts regularly as a backup to avoid issues or lost data.
Authentication
- API Key
Headers
Request Body
One or more primary and/or alternate email addresses to search for in your Marketing Campaigns contacts.
{
"emails": [
"jane_doe@example.com",
"john_doe@example.com",
"joann_doe@example.com"
]
}
Responses
An object containing one or more of the email addresses matching the searched addresses in your contacts.
An email address matching a searched address in your contacts that conforms to the above regex string.
A link to this object.
{
"result": {
"jane_doe@example.com": {
"contact": {
"address_line_1": "",
"address_line_2": "",
"alternate_emails": [
"janedoe@example1.com"
],
"city": "",
"country": "",
"email": "jane_doe@example.com",
"first_name": "Jane",
"id": "asdf-Jkl-zxCvBNm",
"last_name": "Doe",
"list_ids": [],
"segment_ids": [],
"postal_code": "",
"state_province_region": "",
"phone_number": "",
"whatsapp": "",
"line": "",
"facebook": "",
"unique_name": "",
"custom_fields": {},
"created_at": "2021-03-02T15:25:47Z",
"updated_at": "2021-03-30T15:26:16Z",
"_metadata": {
"self": "<metadata_url>"
}
}
},
"john_doe@example.com": {
"contact": {
"address_line_1": "",
"address_line_2": "",
"alternate_emails": [],
"city": "",
"country": "",
"email": "john_doe@example.com",
"first_name": "Jane",
"id": "asdf-Jkl-qWeRTy",
"last_name": "Doe",
"list_ids": [],
"segment_ids": [],
"postal_code": "",
"state_province_region": "",
"phone_number": "",
"whatsapp": "",
"line": "",
"facebook": "",
"unique_name": "",
"custom_fields": {},
"created_at": "2020-01-02T15:25:47Z",
"updated_at": "2020-12-20T15:26:16Z",
"_metadata": {
"self": "<metadata_url>"
}
}
},
"joann_doe@example.com": {
"error": "contact not found"
}
}
}
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
the error message
the field that generated the error
helper text or docs for troubleshooting
{
"errors": [
{
"field": "field_name",
"message": "error message"
}
]
}
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.