Menu

Expand
Rate this page:

Contacts

Search Contacts

POST /v3/marketing/contacts/search

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

Use this endpoint to locate contacts.

The request body's query field accepts valid SGQL for searching for a contact.

Because contact emails are stored in lower case, using SGQL to search by email address requires the provided email address to be in lower case. The SGQL lower() function can be used for this.

Only the first 50 contacts that meet the search criteria will be returned.

If the query takes longer than 20 seconds, a 408 Request Timeout status will be returned.

Formatting the created_at and updated_at values as Unix timestamps is deprecated. Instead they are returned as ISO format as string.

Authentication

  • API Key

Headers

Authorization
string
default: Bearer <<YOUR_API_KEY_HERE>>
required

Request Body

object
query
string

An SGQL search string or other pattern.

required
{
  "query": "email LIKE 'ENTER_COMPLETE_OR_PARTIAL_EMAIL_ADDRESS_HERE%' AND CONTAINS(list_ids, 'YOUR_LIST_IDs')"
}

Responses

object
result
array[object]
id
string
required
first_name
string
last_name
string
unique_name
string
email
string
phone_number_id
string
external_id
string
anonymous_id
string
alternate_emails
array[string]
address_line_1
string
address_line_2
string
city
string
state_province_region
string
country
string
postal_code
string
phone_number
string
whatsapp
string
line
string
facebook
string
list_ids
array[string]
required
segment_ids
array[string]
required
custom_fields
object
created_at
string
required
updated_at
string
required
_metadata
object
self
string

A link to this object.

_metadata
object
self
string

A link to this object.

contact_count
number

The total number of contacts matched.

required
object
errors
array[object]
field
string
message
string
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
object
errors
array[object]
message
string

the error message

required
field
string or null

the field that generated the error

help
object

helper text or docs for troubleshooting

id
string
{
  "errors": [
    {
      "field": "field_name",
      "message": "error message"
    }
  ]
}
No response body.
object
errors
array[object]
message
string
Loading Code Sample...
        
        

        Search Contacts

        Rate this page:

        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.

        Loading Code Sample...
              
              
              

              Thank you for your feedback!

              Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

              Sending your feedback...
              🎉 Thank you for your feedback!
              Something went wrong. Please try again.

              Thanks for your feedback!

              thanks-feedback-gif