Filtering

Narrow a list with conditions on fields, combined with and and or.

On this page

The filters parameter is a JSON array. It works on List records, grouped lists and aggregates.

A condition names a field by ID, not by key. Get IDs from Objects and fields.

One condition
[{ "fieldId": "215069ce-4b14-4b0d-b0f9-3d64efeee50e", "operator": "contains", "value": "glob" }]

Send a filter#

cURL
curl --fail-with-body -G "$JEMERO_URL/objects/companies/records" \
  -H "Authorization: Bearer $JEMERO_API_KEY" \
  --data-urlencode "filters=[{\"fieldId\":\"$NAME_FIELD_ID\",\"operator\":\"contains\",\"value\":\"glob\"}]"
Node.js
const filters = [
  { fieldId: process.env.NAME_FIELD_ID, operator: 'contains', value: 'glob' },
];
const url = new URL(`${process.env.JEMERO_URL}/objects/companies/records`);
url.search = new URLSearchParams({ filters: JSON.stringify(filters) });

const response = await fetch(url, {
  headers: { Authorization: `Bearer ${process.env.JEMERO_API_KEY}` },
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
console.log((await response.json()).total);
Python
import json
import os
import requests

filters = [
    {"fieldId": os.environ["NAME_FIELD_ID"], "operator": "contains", "value": "glob"}
]
response = requests.get(
    f"{os.environ['JEMERO_URL']}/objects/companies/records",
    headers={"Authorization": f"Bearer {os.environ['JEMERO_API_KEY']}"},
    params={"filters": json.dumps(filters)},
    timeout=30,
)
response.raise_for_status()
print(response.json()["total"])

Operators by field type#

Field typeOperatorsvalue
text, long_text, email, phone, urlcontains, equals, is_empty, is_not_emptya string of 1–500 characters
full_name, address, rich_text, json, arraycontains, is_empty, is_not_emptya string of 1–500 characters
numberequals, neq, gt, gte, lt, lte, is_empty, is_not_emptya number
currencythe same as numbera number in minor units (cents). The currency code is not compared.
ratingequals, gte, lte, is_empty, is_not_emptya whole number
date, date_timeon, before, after, is_empty, is_not_empty"YYYY-MM-DD"
checkboxistrue or false
selectis_any_of, is_none_of, is_empty, is_not_emptyan array of option IDs
multi_selectcontains_any, contains_all, is_empty, is_not_emptyan array of option IDs
relationis_any_of, is_empty, is_not_emptyan array of linked record IDs
usersis_any_of, is_none_of, is_empty, is_not_emptyan array of user IDs
actoris_any_of, is_empty, is_not_emptyan array of user IDs
  • is_empty and is_not_empty take no value.
  • Text comparisons ignore case.
  • For email, phone and url, contains looks at all the values and equals compares the main one.
  • A date_time field is compared by its calendar day in UTC. There is no time-of-day filter, so you can't ask for "changed since 14:00".
  • Arrays take up to 100 entries.
  • In users and actor filters, the string @me in the array stands for the key's creator.

And, or#

Conditions at the top level must all match. For alternatives, use a group: { "logic": "or", "filters": [...] }. Groups can contain groups.

Industry is A, or the name contains "labs"
[
  {
    "logic": "or",
    "filters": [
      { "fieldId": "3825a193-b3bd-464b-bd45-c8e5396356dd", "operator": "is_any_of", "value": ["dae82246-2e36-455a-8a9b-a406ca34f04e"] },
      { "fieldId": "215069ce-4b14-4b0d-b0f9-3d64efeee50e", "operator": "contains", "value": "labs" }
    ]
  }
]

Each list, at the top level or inside a group, holds at most 20 entries.

Errors#

MessageCause
Must be JSONfilters isn't valid JSON. Check the encoding.
Unknown filter fieldThe fieldId isn't a field of this object.
"gt" is not supported for Text fieldsThe operator doesn't fit the field's type.

All are 400 answers.