TotalBase
Reference

Query Language

The whole query language on one page: parameters, operators, variables and limits.

The Data API's query language, on one page. The same filter grammar is used by a request's where, a role's row filters and payload checks, a DataView's filter, a page's Resources, a column's conditions and workflow steps. The guides explain each part: Reading, Filtering, Aggregating.

Parameters

ParameterExample
fieldscolumns and relation paths to return; without it, every column you may readfields=number,status,site.name
wherewhich rowswhere[status][_eq]=NEW
search, search_fieldsrows containing words, and where to looksearch=compressor
order_byorder; - for descendingorder_by=-priority,due_at
limit, offsetpagination: 50 by default, 500 at mostlimit=50&offset=100
countalso return the total in meta.countcount=true
flagsnamed conditions checked per row, in meta.flagsflags[overdue][due_at][_lt]=$CURRENT_TIMESTAMP
group_bygroupsgroup_by=status
_count, _sum, _avg, _min, _maxaggregates_count[*]=n&_sum[total]=amount
havingfilter on aggregateshaving[n][_gt]=10

Operators

OperatorMeansValue
_eq, _neqequal, differentone value
_gt, _gte, _lt, _ltegreater, at least, less, at mostone value
_like, _ilikepattern (% any text, _ one character); _ilike ignores casea pattern
_regexPOSIX regular expressiona regular expression
_in, _ninone of, none ofvalues separated by commas
_betweenbetween two values, both includedtwo values separated by a comma
_null, _nnullhas no value, has a valuetrue
_contains, _contained_by, _overlaparray or jsonb containment{A,B} or JSON
_and, _or, _notcombine conditionsa list, or one condition

In a stored filter (JSON), a value is a string, a number or a boolean: {"quantity": {"_lte": 20}}, {"active": {"_eq": true}}. _in, _nin and _between take a list, {"status": {"_in": ["NEW", "ASSIGNED"]}}, or the same values as comma-separated text, "NEW,ASSIGNED". In a query string, repeat the key for a list: where[status][_in][]=NEW&where[status][_in][]=ASSIGNED.

{ "_or": [
  { "priority": { "_eq": "URGENT" } },
  { "_and": [ { "status": { "_eq": "NEW" } }, { "reported_at": { "_lt": "$INTERVAL.24h" } } ] }
] }

Relation paths

A dotted path follows a foreign key: site.name, site.customer.name, technician.user.email. It works in fields, where, order_by and search_fields, and needs a READ field grant on the path. Paths go one way, from the table holding the foreign key; up to 3 levels.

Variables

Variable
$USER.<column>a column of the caller's own user row: $USER.id, $USER.branch
$CURRENT_TIMESTAMP, $CURRENT_DATE, $CURRENT_TIMEnow, today, the current time, PostgreSQL's
$INTERVAL.<n><unit>now minus a duration: 15m, 24h, 7d, 2w, 1y
$PERIOD.<period>.from, .toa calendar period's start (included) and end (excluded): today, yesterday, this_week, last_week, this_month, last_month, this_quarter, last_quarter, this_year, last_year
$ROW.<column>another column of the same row

PostgreSQL computes them, in the caller's time zone. $INTERVAL.7d always means "seven days ago", never an interval to add. Inside _in and _nin, only literal values and $USER.*.

Limits

LimitDefaultError
Filter depth10QUERY_DEPTH_LIMIT_EXCEEDED
Query nodes200QUERY_COMPLEXITY_LIMIT_EXCEEDED
Query parameters200QUERY_PARAMETER_LIMIT_EXCEEDED
Query string32 KBQUERY_STRING_TOO_LARGE
Request body5 MBREQUEST_BODY_TOO_LARGE
Relation depth3

All in Settings › Data API › Limits. A request past a limit is refused before any SQL runs.

Next steps