Skip to main content

Filtering

Many list-style Management API endpoints accept a filter query parameter to narrow down results — for example listing users, listing groups, listing Authorisations, and listing user directories, among others.

Syntax

The filter syntax is similar to SCIM/RFC7644 but with some small changes:

  • Attribute names are case sensitive
  • "Complex attribute filter grouping" is not supported
  • Not all attributes are searchable, while some hidden attributes may be searchable. Please complain when you find these issues.

The filter is given with a filter parameter, such as:

filter=username eq "john"

Operators

Supported operators are as listed in RFC7644:

OperatorDescriptionNotes
eqequalThe attribute and operator values must be identical for a match.

This can be used also to search from an array, for example if the parameter's value is an array of strings ["value1", "value2"] and a filter like parameterName eq "value1" is used, then that object would be returned.
nenot equalThe inverse of eq: a match requires the attribute and operator values to differ.
cocontainsThe entire operator value must be a substring of the attribute value for a match.
swstarts withThe attribute value must begin with the entire operator value for a match.
ewend withThe attribute value must end with the entire operator value for a match.
prpresent (has value)Matches if the attribute has any value at all. Used without a value, for example customFields.myKey pr.
gtgreater thanMatch if the attribute value sorts after the operator value — usable with numbers and DateTime values, not just plain strings.
gegreater than or equal toSame comparison as gt, but also matches when the values are equal.
ltless thanMatch if the attribute value sorts before the operator value — usable with numbers and DateTime values, not just plain strings.
leless than or equal toSame comparison as lt, but also matches when the values are equal.
Attribute operatorDescriptionBehavior
andLogical "and"The filter is only a match if both expressions evaluate to true.
orLogical "or"The filter is a match if either expression evaluates to true.
not"Not" functionThe filter is a match if the expression evaluates to false.
Logical operatorDescriptionBehavior
( )Precedence groupingGroups a sub-expression so it's evaluated as a single unit before combining it with and/or/not, the same way parentheses work in most programming languages.
[ ]Complex attribute filter grouping is NOT SUPPORTEDIn standard SCIM, this restricts a filter to values within the same entry of a multi-valued complex attribute (for example emails[type eq "work" and value co "@example.com"]). This API doesn't support that syntax.

Combine operators to filter on more than one condition at once:

filter=(type eq "file_for_permit" or type eq "sales_permit") and not (revoked eq true)

Value types

Quote a value with double quotes to filter on a string; leave boolean and numeric values unquoted:

filter=locked eq true
filter=customFields.my_number gt 5

DateTime filtering

Filter expressions where the value is a string in double quotes and can be parsed as an ISO Instant string, are used as DateTime filters. For example:

Examples

filter=createdDate gt "2017-10-20T07:17:17.606Z"
filter=lastModifiedDate le "2019-05-31T23:59:59.999Z"

Finding filterable fields for an endpoint

Not every field on a resource is filterable, and the operators a field supports can vary — for example, a free-text field may support co (contains) while a boolean field only supports eq/ne/pr. Each endpoint that accepts a filter parameter documents its own filterable fields and their supported operators in that parameter's own description, in your instance's /apidoc page.

Some resources also expose a special, endpoint-specific filter field of their own. For example, listing groups supports searchText, a free-form search field that can be combined with the rest of the filter using a logical and:

filter=searchText eq "myvalue -excludevalue"