This endpoint allows you to retrieve up to 100 contacts matching the searched identifier values for one type of specified identifier.
identifier_type
must be a valid identifier type: email
, phone_number_id
, external_id
, or anonymous_id
.
This endpoint should be used in place of the Search Contacts endpoint when you can provide exact identifiers and do not need to include other Segmentation Query Language (SGQL) filters when searching.
This endpoint returns a 200
status code when any contacts match the identifiers you supplied. When searching multiple identifiers in a single request, it is possible that some 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 identifiers that are not found.
This endpoint returns a 404
status code when no contacts are found for the provided identifiers.
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.
Bearer <<YOUR_API_KEY_HERE>>
The type of identifier to search for.
email
phone_number_id
external_id
anonymous_id
application/json
One or more more identifier values to search for in your Marketing Campaigns contacts.
An object containing one or more of the identifiers matching the searched identifiers in your contacts.
1const client = require('@sendgrid/client');2client.setApiKey(process.env.SENDGRID_API_KEY);34const identifier_type = "email";5const data = {6"identifiers": [7"contact@example.com"8]9};1011const request = {12url: `/v3/marketing/contacts/search/identifiers/${identifier_type}`,13method: 'POST',14body: data15}1617client.request(request)18.then(([response, body]) => {19console.log(response.statusCode);20console.log(response.body);21})22.catch(error => {23console.error(error);24});