Two Filtering Approaches
Inline filters are the simplest way to narrow a result set. You pass afilters query parameter containing a JSON array of filter objects directly in your request URL. Inline filters are ideal for ad-hoc queries or when the filter conditions are dynamic and change per request.
Filter sets let you save a named filter configuration once — via POST /v1/filter-sets — and reuse it across multiple requests by referencing its filter_set_id. Filter sets are recommended for complex, multi-condition criteria that your team uses regularly, such as “all enterprise accounts in the software industry that visited the pricing page in the last 30 days.”
filters and filter_set_id are not mutually exclusive — you can pass both on the same request. When you do, the saved filter set’s conditions are used as the base and your inline filters are appended on top (both must match, as with any other combination of filters).Inline Filter Example
Pass afilters query parameter as a URL-encoded JSON array. Each element in the array is a filter object with key, keyType, condition, and value fields.
filters value for the request above is:
Always URL-encode the JSON array when passing it as a query parameter. Most HTTP client libraries handle this automatically when you pass filter values as a structured parameter rather than building the URL string manually.
AND, returning only records that satisfy every condition.
Filter Key Types
Each filter object must include akeyType that tells Knock2 how to interpret the value field and which condition operators are valid. The conditions below are exhaustive — passing anything else returns a 400 invalid_filters error naming the offending filter index.
string — match text fields exactly or partially
string — match text fields exactly or partially
Use
string for text fields like business_email or crm_deal_name.Example — contacts whose title starts with “VP”:
string_searchable / string_with_id — same conditions as string
string_searchable / string_with_id — same conditions as string
string_searchable (e.g. title, company_name) and string_with_id (e.g. owner, which pairs a display name with an ID) accept the same condition set as string: is, is_not, contains, does_not_contain, starts_with, ends_with, exists, does_not_exist, and (on email fields) exclude_personal_emails.string_arr — match against array-valued fields
string_arr — match against array-valued fields
Use
string_arr for fields that hold a list of values, such as industry or technology_tags.Example — contacts with industry SaaS or Fintech:
boolean — match true/false fields
boolean — match true/false fields
Use
boolean for fields like is_qualified. A value of true or false is required.Example — contacts that are qualified:
number / number_with_id — compare numeric fields
number / number_with_id — compare numeric fields
Use
number for plain numeric fields (e.g. page_visits, crm_deal_value) and number_with_id for numeric fields tied to a model ID (e.g. lead_score, which references a scoring model).There is no
between condition for number — use two filters (gte + lte) if you need a range.Example — accounts with a lead score of at least 80:existence — check whether a field is present
existence — check whether a field is present
Use
existence to filter on whether a field has any value at all. No value field is required.Example — contacts that have a LinkedIn URL on record:
date_range — filter by date or time window
date_range — filter by date or time window
Use
date_range for timestamp fields like last_visit or created_at.For
before/after, pass value as a single date string. For between, pass a two-element array [start, end] (contact filters) — the second element may be null for an open-ended range; account filters also accept an equivalent {start, end} object.Example — accounts whose last visit was after June 1, 2024:employee_range / revenue_range — bucket-based size filters
employee_range / revenue_range — bucket-based size filters
Use
employee_range (employees/company_employees) or revenue_range (annual_revenue/company_annual_revenue) to filter by standardized size buckets rather than raw numbers.Each bucket in the
value array is a JSON-stringified [min, max] tuple (use null for an open-ended upper bound) — not a display-label string. Check the dashboard’s Settings → API → Filter Sets Reference tab for the exact bucket values currently configured.Example — accounts with 51–200 or 201–500 employees:Using a Saved Filter Set
Create a reusable filter set byPOSTing your filter array to /v1/filter-sets:
id as the filter_set_id query parameter on any list endpoint: