Skip to main content

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.

SettingValue
MethodPOST
Path/api/v1/accounts/{account_id}/contacts/filter
AuthorizationUser token. Legacy: any agent. New rules: Contacts → read. Agent-bot tokens: not allowed.

Path parameters

NameTypeRequiredDescription
account_idintegerYesAccount ID.

Query parameters

NameTypeRequiredDescription
page, per_page, sort, include_contact_inboxesNoSame as List Contacts.
include_conversationsbooleanNoAlso return each contact's conversations. Default false.

Body parameters (JSON)

NameTypeRequiredDescription
payloadarrayYesList of conditions.
payload[].attribute_keystringYesAttribute to filter on (table below), or the key of a contact custom attribute.
payload[].filter_operatorstringYesOperator (table below).
payload[].valuesarrayYesValues to compare. Most operators use values[0]. Send [] for is_present / is_not_present.
payload[].query_operatorstringYesand / or to join with the next condition; null on the last one. Any other value returns 422.

Filterable attributes

attribute_keyOperators
nameequal_to, not_equal_to, contains, does_not_contain
phone_numberequal_to, not_equal_to, contains, does_not_contain, is_present, is_not_present (the value may be sent with or without +)
emailequal_to, not_equal_to, contains, does_not_contain, is_present, is_not_present
identifierequal_to, not_equal_to
country_codeequal_to, not_equal_to
cityequal_to, not_equal_to, contains, does_not_contain
browser_languageequal_to, not_equal_to, contains, does_not_contain
company, company_nameequal_to, not_equal_to, contains, does_not_contain, is_present, is_not_present
labelsequal_to (has any of the labels), not_equal_to (has none of them), is_present, is_not_present
created_at, last_activity_atis_greater_than, is_less_than (value YYYY-MM-DD), days_before (value = number of days)
blockedequal_to, not_equal_to (value true / false)
custom attribute keyKey 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.

warning

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

StatusWhenBody
422query_operator is not and / or / null.{"error": "Query operator must be either \"AND\" or \"OR\"."}

Remarks​

  • meta.current_page may come back as a string (for example "1"), so parse it before comparing.

Request​

Responses​

A page of the contacts that match the conditions.