Filter Contacts
POST/accounts/:account_id/contacts/filter
Advanced filtering of contacts with a list of conditions.
Each condition is combined with the next one using its query_operator (and / or). The last condition has query_operator: null. Results come 10 per page by default, with the same paging and sorting options as List Contacts.
| Setting | Value |
|---|---|
| Method | POST |
| Path | /api/v1/accounts/{account_id}/contacts/filter |
| Authorization | User token. Legacy: any agent. New rules: Contacts → read. Agent-bot tokens: not allowed. |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | integer | Yes | Account ID. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
page, per_page, sort, include_contact_inboxes | No | Same as List Contacts. | |
include_conversations | boolean | No | Also return each contact's conversations. Default false. |
Body parameters (JSON)
| Name | Type | Required | Description |
|---|---|---|---|
payload | array | Yes | List of conditions. |
payload[].attribute_key | string | Yes | Attribute to filter on (table below), or the key of a contact custom attribute. |
payload[].filter_operator | string | Yes | Operator (table below). |
payload[].values | array | Yes | Values to compare. Most operators use values[0]. Send [] for is_present / is_not_present. |
payload[].query_operator | string | Yes | and / or to join with the next condition; null on the last one. Any other value returns 422. |
Filterable attributes
attribute_key | Operators |
|---|---|
name | equal_to, not_equal_to, contains, does_not_contain |
phone_number | equal_to, not_equal_to, contains, does_not_contain, is_present, is_not_present (the value may be sent with or without +) |
email | equal_to, not_equal_to, contains, does_not_contain, is_present, is_not_present |
identifier | equal_to, not_equal_to |
country_code | equal_to, not_equal_to |
city | equal_to, not_equal_to, contains, does_not_contain |
browser_language | equal_to, not_equal_to, contains, does_not_contain |
company, company_name | equal_to, not_equal_to, contains, does_not_contain, is_present, is_not_present |
labels | equal_to (has any of the labels), not_equal_to (has none of them), is_present, is_not_present |
created_at, last_activity_at | is_greater_than, is_less_than (value YYYY-MM-DD), days_before (value = number of days) |
blocked | equal_to, not_equal_to (value true / false) |
| custom attribute key | Key of a contact custom attribute defined in Settings → Custom attributes. Operators depend on the attribute type: text equal_to / not_equal_to / contains / does_not_contain; number and date equal_to / not_equal_to / is_greater_than / is_less_than; plus is_present / is_not_present. |
Text comparisons are case-insensitive.
A condition with an unsupported operator (for example contains on labels) or an unknown attribute key is silently ignored, so the filter returns more results than expected. Stick to the operators in the table.
Example: email contains X or phone equals Y
curl -X POST 'https://online.99digital.co.il/api/v1/accounts/12/contacts/filter?page=1&include_contact_inboxes=false' \
-H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"payload": [
{ "attribute_key": "email", "filter_operator": "contains", "values": ["dana.cohen"], "query_operator": "or" },
{ "attribute_key": "phone_number", "filter_operator": "equal_to", "values": ["972521234567"], "query_operator": null }
]
}'
Response (200 OK). The two contacts are shown by ID and name only; each item is a full contact object.
{
"meta": { "count": 2, "current_page": "1" },
"payload": [
{ "id": 801, "name": "Dana Cohen" },
{ "id": 802, "name": "Avi Levi" }
]
}
Example: city equals Tel Aviv and created after a date
curl -X POST 'https://online.99digital.co.il/api/v1/accounts/12/contacts/filter?include_contact_inboxes=false' \
-H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"payload": [
{ "attribute_key": "city", "filter_operator": "equal_to", "values": ["Tel Aviv"], "query_operator": "and" },
{ "attribute_key": "created_at", "filter_operator": "is_greater_than", "values": ["2026-11-11"], "query_operator": null }
]
}'
Response (200 OK):
{
"meta": {
"count": 1,
"current_page": 1
},
"payload": [
{
"additional_attributes": {
"company_name": "Example Ltd",
"city": "Tel Aviv"
},
"availability_status": "offline",
"email": "dana.cohen@example.com",
"id": 801,
"name": "Dana Cohen",
"phone_number": "+972501234567",
"identifier": "crm-801",
"thumbnail": "",
"custom_attributes": {
"customer_tier": "gold"
},
"blocked": false,
"is_whatsapp_contact": false,
"created_at": 1794470500
}
]
}
Error responses
| Status | When | Body |
|---|---|---|
422 | query_operator is not and / or / null. | {"error": "Query operator must be either \"AND\" or \"OR\"."} |
Remarks
meta.current_pagemay come back as a string (for example"1"), so parse it before comparing.
Request
Responses
- 200
- 401
- 403
- 422
A page of the contacts that match the conditions.
The access token is missing or wrong, or its user does not belong to this account.
The token's role does not have the permission this endpoint needs, or the endpoint is not open to agent-bot tokens. See Authorization.
A query_operator is not and, or or null.