Skip to main content
GET
Search contacts by phone or email

Overview

Search for contacts using their phone number or email address. This endpoint performs fuzzy matching across all communication channels, making it easy to find contacts even with partial information. Perfect for implementing search functionality, verifying contact existence, or looking up customer information before taking action.

Use Cases

  • Contact Lookup: Find a contact before creating a ticket or sending a message
  • Duplicate Detection: Check if a contact already exists before importing
  • Search Interface: Power search bars in your CRM or dashboard
  • Customer Verification: Verify customer identity during support interactions
  • Data Enrichment: Find existing contact data to enrich external records
  • Phone Validation: Check if a phone number is already in your system

Authentication

This endpoint requires authentication using an API key. Include your API key in the request header:

Query Parameters

string
Phone number to search (partial match supported). Numbers are automatically sanitized.Examples: "+56912345678", "56912345678", "12345678"
string
Email address to search (partial match supported, case-insensitive).Examples: "john@example.com", "@example.com", "john"
boolean
Set to true to include the per-contact utm_events array (marketing attribution). Off by default — the key is omitted entirely unless requested.
At least one parameter required: You must provide either phone or email (or both).

Response Structure

Returns an array of matching contact objects (maximum 50 results):

UTM Event Object (utm_events[])

Marketing attribution events recorded for the contact, ordered oldest first. Empty array when the contact has no attribution events.

Example Requests

Search by Phone Number

Search by Email

Search by Both

Search with UTM Events

Example Response

The response below assumes with_utm_events=true was passed — without it, the utm_events key is omitted from every contact entirely.

Common Use Cases

1. Check if Contact Exists Before Creating

2. Search Bar Implementation

3. Verify Customer Before Action

4. Find All Contacts from Same Domain

5. Deduplicate Before Import

Search Behavior

Phone Number Matching

  • Automatic Sanitization: Non-numeric characters are removed (+, -, spaces, etc.)
  • Partial Match: Finds contacts where phone contains the search term
  • Flexible Format: Works with or without country code
Examples:
  • Search "12345678" finds "+56912345678"
  • Search "+569" finds all numbers with that prefix
  • Search "56912345" finds "+56912345678"

Email Matching

  • Case Insensitive: "JOHN@EXAMPLE.COM" matches "john@example.com"
  • Partial Match: Finds contacts where email contains the search term
  • Domain Search: Search "@company.com" finds all contacts from that domain
Examples:
  • Search "john@example.com" finds exact match
  • Search "@example.com" finds all contacts from that domain
  • Search "john" finds "john.doe@anywhere.com", "johnny@test.com", etc.
When both phone and email are provided, returns contacts matching either criteria (OR logic):

Result Limit

  • Maximum 50 results: The endpoint returns up to 50 matching contacts
  • Ordered by recent activity: Results sorted by last_message_at descending
  • Refine search: If you get 50 results, narrow your search criteria

Error Responses

Important Notes

  • At Least One Required: Must provide phone, email, or both
  • Partial Matching: Both phone and email support partial/fuzzy matching
  • Cross-Channel: Searches across ALL channels (WhatsApp, Instagram, SMS, etc.)
  • Case Insensitive: Email search is case-insensitive
  • URL Encoding: Remember to URL-encode parameters (especially + in phone numbers and @ in emails)
  • 50 Result Limit: Only first 50 matches returned

URL Encoding

When using phone numbers with + or emails with @, make sure to URL-encode: Most HTTP libraries handle this automatically with encodeURIComponent().

Best Practices

2. Handle Multiple Results

3. Search with Fallback

Performance Tips

  • Be Specific: More specific searches return faster results
  • Exact Match: Use full phone/email when possible
  • Avoid Wildcards: Searching "@" alone will match too many results
  • Cache Results: Cache frequent searches to reduce API calls

Notes

  • Fuzzy Matching: Uses ILIKE for flexible matching
  • No Wildcards Needed: Partial matching built-in
  • Ordered Results: Most recent activity first
  • All Channels: Returns contacts from any platform

Headers

x-api-key
string
required

API key needed to authorize the request

Query Parameters

phone
string

Phone number to search (partial match supported)

Example:

"+56912345678"

email
string<email>

Email address to search (partial match supported)

Pattern: ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
Example:

"john@example.com"

with_utm_events
boolean

Set to true to include the per-contact utm_events array (marketing attribution). Off by default — the key is omitted entirely unless requested, since it costs an extra lookup. Opt in only if you consume UTM attribution.

Example:

true

Response

Contacts found successfully.

id
string
Example:

"df980fc8-b6db-4820-bf22-2969482d106d"

name
string
Example:

"John Doe"

phone
string
Example:

"+56912345678"

email
string
Example:

"john@example.com"

platform
string
Example:

"whatsapp"

last_message_at
string
Example:

"2024-09-30T10:00:00.000Z"

chat_status
string
Example:

"ATTENDED"

created_at
string
Example:

"2024-01-15T10:00:00.000Z"

updated_at
string
Example:

"2024-01-16T09:30:00.000Z"

client_id
string
Example:

"123e4567-e89b-12d3-a456-426614174000"

ai_customer_id
string | null
Example:

"123e4567-e89b-12d3-a456-426614174000"

default_stage_id
string | null
Example:

"123e4567-e89b-12d3-a456-426614174000"

blocked
boolean
Example:

false

is_chat_read
boolean
Example:

true

utm_events
object[]

Marketing attribution events recorded for this contact, oldest first. Only present when with_utm_events=true; otherwise the key is omitted.