Retrieve contacts that had their last message within the specified number of days. Works across all channels (WhatsApp, Instagram, etc.). Optionally filter by custom field values.
| 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 |
pipeline_id | string | No | Pipeline ID (UUID) to filter contacts by pipeline |
| 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) | Contactโs default pipeline stage |
blocked | boolean | Whether the contact is blocked |
is_chat_read | boolean | Whether the chat has been read by an agent |
active_ticket_v2 | object | null | Active ticket information (see below) |
active_ticket_v2)| Field | Type | Description |
|---|---|---|
id | string (UUID) | Unique identifier for the ticket |
current_stage_id | string | null | Current pipeline stage ID for the ticket |
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.pipeline_id parameter filters contacts by the pipeline of their active ticketโs current stage.
| Parameter | Type | Required | Description |
|---|---|---|---|
pipeline_id | string | No | UUID of the pipeline to filter by |
pipeline_id is provided, only contacts with an active
ticket whose current stage belongs to that pipeline are returned. You can combine
pipeline_id with stage_id to filter by both.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 returnedpipeline_id is provided, only contacts with an active ticket in a stage belonging to that pipeline are returneddays, stage_id, and pipeline_id can be used together to narrow down resultsactive_ticket_v2 object contains the current ticketโs id and current_stage_iddays 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"
Pipeline ID to filter contacts by their active ticket stage
"123e4567-e89b-12d3-a456-426614174000"
The key of the custom field to filter by. Must be provided together with custom_field_value.
1"status"
The value to match for the custom field. Must be provided together with custom_field_key.
1"Active"
Specify "ticket" or "customer" to filter only by custom fields of that entity type. Only applies when custom_field_key and custom_field_value are provided.
ticket, customer 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"
"123e4567-e89b-12d3-a456-426614174000"
"123e4567-e89b-12d3-a456-426614174000"
"123e4567-e89b-12d3-a456-426614174000"
false
true