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
Phone number to search (partial match supported). Numbers are automatically sanitized.Examples:
"+56912345678"
, "56912345678"
, "12345678"
Email address to search (partial match supported, case-insensitive).Examples:
"john@example.com"
, "@example.com"
, "john"
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):Field | Type | Description |
---|---|---|
id | string (UUID) | Unique identifier for the contact |
name | string | Contact’s full name |
phone | string | null | Contact’s phone number |
email | string | null | Contact’s email address |
platform | string | Communication channel (whatsapp, instagram, etc.) |
last_message_at | string (ISO) | Timestamp of the last message sent/received |
chat_status | string | Current chat status (UNATTENDED, ATTENDED, etc.) |
created_at | string (ISO) | Contact creation timestamp |
client_id | string (UUID) | Your organization ID |
ai_customer_id | string (UUID) | Associated customer profile ID |
default_stage_id | string (UUID) | Current pipeline stage |
blocked | boolean | Whether the contact is blocked |
is_chat_read | boolean | Whether the chat has been read by an agent |
Example Requests
Search by Phone Number
Search by Email
Search by Both
Example Response
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
6. Multi-criteria Search
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
- 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
- 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.
Combined Search
When bothphone
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
Status Code | Description |
---|---|
400 | Bad Request - Neither phone nor email provided |
401 | Unauthorized - Invalid or missing API key |
500 | Internal Server Error - Something went wrong |
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:
Character | URL Encoded | Example |
---|---|---|
+ | %2B | +56912345678 → %2B56912345678 |
@ | %40 | john@example.com → john%40example.com |
Space | %20 | john doe → john%20doe |
encodeURIComponent()
.
Related Endpoints
- GET /api/public/contact//info - Get detailed contact info by ID
- POST /api/public/customer/upsert/info - Create or update contact
- GET /api/public/contacts?days= - Get contacts by activity
Best Practices
1. Normalize Input Before Search
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
API key needed to authorize the request
Query Parameters
Phone number to search (partial match supported)
Example:
"+56912345678"
Email address to search (partial match supported)
Example:
"john@example.com"
Response
Contacts found successfully.
Example:
"df980fc8-b6db-4820-bf22-2969482d106d"
Example:
"John Doe"
Example:
"+56912345678"
Example:
"john@example.com"
Example:
"whatsapp"
Example:
"2024-09-30T10:00:00.000Z"
Example:
"ATTENDED"
Example:
"2024-01-15T10:00:00.000Z"