Advanced Filtering
The Advanced Filtering API finds objects matching a structured query sent to
Search objects with filters
(POST /api/v1/data/search/). It’s the API behind the filters on the Leads,
Contacts and Opportunities pages in Close.
This page is a short tutorial. The endpoint reference explains how to build queries and documents every parameter, query type and condition, as well as dates, results and pagination. Advanced Filtering Fields lists the fields you can filter by for each object type.
Tutorial
Let’s find all Contacts with “CEO” in their title. The request body looks like this:
The and query combines an object_type query, which asks for Contacts, with
a field_condition query, which asks for Contacts whose title contains the
word “CEO”. _fields asks for the Contacts’ id, name and title.
Here’s an example response:
Filtering by related objects and custom fields
To filter by fields of another object, use a has_related query. For example,
here are CEOs with at least one email address, at Leads whose Industry custom
field is “Software as a service”:
This query introduces a few more concepts:
- A
number_rangecondition for a number field.gte: 1means greater than or equal to 1. - A
custom_field, which references a custom field by its ID. Find custom field IDs with the custom field endpoints, e.g. List Lead Custom Fields. - A
termcondition, which matches one of the choices of a choice custom field. - A
has_relatedquery, which matches Contacts whose Lead matches therelated_query. Fields in therelated_querybelong to the related object type. Use it the other way around too, e.g. to find Leads with a Contact who has a title, or Leads with a call in the last week (activity.call).
Visual Query Builder
Instead of writing the JSON query by hand, you can build your query visually on the Leads Page or Contacts page in Close, and then copy the JSON query by clicking the triple-dot menu on the top right and selecting “Copy Filters”.

Query types
Field conditions
Which condition to use depends on the field’s value type, which Advanced Filtering Fields lists for every field.