Retrieve contacts that had their last message within the specified number of days. Works across all channels (WhatsApp, Instagram, etc.).
| Parameter | Type | Required | Description |
|---|---|---|---|
days | number | Yes | Number of days to filter contacts (1-365) |
stage_id | string | No | Stage ID (UUID) to filter contacts by stage |
| 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 |
days parameter filters contacts where last_message_at is within the specified number of days from now:
| Days Value | Description | Use Case |
|---|---|---|
1 | Last 24 hours | Today’s activity |
7 | Last week | Weekly engagement report |
30 | Last month | Monthly active contacts |
90 | Last quarter | Quarterly analysis |
180 | Last 6 months | Semi-annual review |
365 | Last year (maximum allowed) | Annual customer base analysis |
stage_id parameter filters contacts by their current pipeline stage. Only contacts with an active ticket in the specified stage will be returned.
| Parameter | Type | Required | Description |
|---|---|---|---|
stage_id | string | No | UUID of the pipeline stage to filter by |
stage_id is provided, only contacts with an active
ticket (active_ticket_v2) in that specific stage are returned. Contacts
without an active ticket or in a different stage are excluded.last_message_at in descending order (most recent first).
| Platform | Description |
|---|---|
whatsapp | WhatsApp Business API |
web-whatsapp | WhatsApp Web (QR) |
instagram | Instagram Direct Messages |
webchat | Web chat widget |
sms | SMS messages |
messenger | Facebook Messenger |
tiktok | TikTok Direct Messages |
voice | Voice calls |
playground | Test/playground channel |
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid days parameter (must be 1-365) |
| 401 | Unauthorized - Invalid or missing API key |
| 500 | Internal Server Error - Something went wrong |
email or phone may be nulldays valuesstage_id is provided, only contacts with an active ticket in that stage are returned. The stage ID must be a valid UUID.days and stage_id can be used together to find contacts active within a time period AND in a specific pipeline stagedays valuesdays values > 90, expect larger response sizes| Feature | New Endpoint (This) | Deprecated Endpoint |
|---|---|---|
| Path | /api/public/contacts | /api/public/whatsapp/contact/contacts |
| Channels | All channels | WhatsApp only |
| Response | AI Contact objects | WhatsApp Contact objects |
| Ordering | By last_message_at DESC | Not specified |
| Future Support | ✅ Active development | ❌ Deprecated |
API key needed to authorize the request
Number of days to filter contacts (1-365)
1 <= x <= 36530
Stage ID to filter contacts
"123e4567-e89b-12d3-a456-426614174000"
Contacts retrieved successfully.
"df980fc8-b6db-4820-bf22-2969482d106d"
"John Doe"
"+56912345678"
"whatsapp"
"2024-09-30T10:00:00.000Z"
"ATTENDED"
"2024-01-15T10:00:00.000Z"