Skip to main content
GET
Get contacts by time filters

Overview

Retrieve contacts that had their last message within a specified number of days. This endpoint works across all communication channels (WhatsApp, Instagram, Web Chat, SMS, etc.) providing a unified view of recent contact activity. Perfect for identifying active contacts, tracking engagement, and filtering contacts by recency across your entire customer base.

Use Cases

  • Active Contacts Dashboard: Show contacts who messaged in the last 7, 30, or 90 days
  • Engagement Metrics: Track how many contacts are actively engaging
  • Re-engagement Campaigns: Find contacts who haven’t messaged recently
  • Activity Reports: Generate reports of contact activity over time
  • Cross-Channel Analytics: See all active contacts regardless of channel
  • CRM Sync: Export recently active contacts to external systems

Authentication

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

Query Parameters

At least one time filter is required: you must provide days, created_after, or updated_after.

Response Structure

Returns an array of contact objects:

Active Ticket Object (active_ticket_v2)

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 Request

Basic Request (All Contacts)

Request with Stage Filter

Request with Pipeline Filter

Request 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. Get Contacts from Last 7 Days

2. Track Engagement by Channel

3. Find Unattended Contacts

4. Re-engagement Campaign Data

5. Export to External CRM

6. Filter Contacts by Pipeline Stage

7. Activity Dashboard

Query Parameters Details

Days Parameter

The days parameter filters contacts where last_message_at is within the specified number of days from now:

Stage ID Parameter

The optional stage_id parameter filters contacts by their current pipeline stage. Only contacts with an active ticket in the specified stage will be returned.
Stage Filtering: When 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

The optional pipeline_id parameter filters contacts by the pipeline of their active ticket’s current stage.
Pipeline Filtering: When 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.

Response Ordering

Contacts are returned ordered by last_message_at in descending order (most recent first).

Cross-Channel Support

This endpoint returns contacts from all channels:

Error Responses

Important Notes

  • Days Range: Must be between 1 and 365 days
  • Null Values: Some fields like email or phone may be null
  • Performance: Response time increases with larger days values
  • All Channels: Unlike the deprecated WhatsApp-specific endpoint, this returns contacts from ALL channels
  • Contact Count: No pagination - returns all contacts matching the criteria
  • Stage Filtering: When stage_id is provided, only contacts with an active ticket in that stage are returned
  • Pipeline Filtering: When pipeline_id is provided, only contacts with an active ticket in a stage belonging to that pipeline are returned
  • Combined Filters: days, stage_id, and pipeline_id can be used together to narrow down results
  • Active Ticket: The active_ticket_v2 object contains the current ticket’s id and current_stage_id

Performance Considerations

  • Cache Results: Consider caching responses for frequently used days values
  • Large Datasets: For days values > 90, expect larger response sizes
  • Rate Limiting: Be mindful of rate limits when making frequent requests

Comparison with Deprecated Endpoint

Best Practices

1. Choose Appropriate Days Range

2. Handle Empty Results

3. Filter on Client Side

Headers

x-api-key
string
required

API key needed to authorize the request

Query Parameters

days
number

Filter contacts whose last message was within this many days (1-365)

Required range: 1 <= x <= 365
Example:

30

created_after
string<date-time>

Return only contacts created strictly after this ISO 8601 timestamp. Use for syncing newly created contacts.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
Example:

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

updated_after
string<date-time>

Return only contacts updated strictly after this ISO 8601 timestamp. Use as a sync cursor to pull both new and modified contacts since the last poll.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
Example:

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

limit
number

Maximum number of contacts to return (1-1000)

Required range: 1 <= x <= 1000
Example:

100

offset
number

Number of contacts to skip, for pagination

Required range: 0 <= x <= 9007199254740991
Example:

0

stage_id
string<uuid>

Stage ID to filter contacts

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

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

pipeline_id
string<uuid>

Pipeline ID to filter contacts by their active ticket stage

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Example:

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

custom_field_key
string

The key of the custom field to filter by. Must be provided together with custom_field_value.

Minimum string length: 1
Example:

"status"

custom_field_value
string

The value to match for the custom field. Must be provided together with custom_field_key.

Minimum string length: 1
Example:

"Active"

entity_type
enum<string>

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.

Available options:
ticket,
customer
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 retrieved 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

active_ticket_v2
object | null
utm_events
object[]

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