You can apply filters to GET and DELETE requests to operate on a subset of resource records.
Available filters for a resource are listed in the Documentation tab in the Filters section of the API Sandbox.
Filter types overview
| Filter | Usage example | Description |
|---|
fields | fields[owner]=id,name | Limits response data to specified fields. Depends on the include filter if applied to a relation. |
filter | filter[id]=1 | Filters response data by specific field values. Supports operators. |
include | include=[owner,organization] | Includes related resource data in the response. |
page | page[size]=10&page[number]=1 | Controls pagination. |
sort | sort=id or sort=id,-name | Sorts results. Prefix with - for descending order. |
meta | meta=title | Requests additional meta properties for each resource item. |
Fields filter
By default, all fields are returned in the API response. To request only specific fields, use the fields filter.
Always use the fields filter and retrieve only the fields your application needs. This reduces response size and improves performance.
Example: retrieve only username and email
GET /api/users?fields[users]=username,email HTTP/1.1
Accept: application/vnd.api+json
{
"data": [
{
"type": "users",
"id": "1",
"attributes": {
"username": "admin",
"email": "[email protected]"
}
},
{
"type": "users",
"id": "2",
"attributes": {
"username": "sale",
"email": "[email protected]"
}
}
]
}
Data filter
Use the filter query parameter to filter by field values. The syntax is:
filter[field_name][operator]=value
The eq operator is the default and can be omitted: filter[id]=1 and filter[id][eq]=1 are equivalent.
Supported operators
| Operator | Description | Example |
|---|
eq | Equality (fields and to-one); contains any specified element (to-many) | filter[id]=1 |
neq | Inequality (fields and to-one); not contains any specified element (to-many) | filter[id][neq]=2 |
lt | Less than | filter[id][lt]=3 |
lte | Less than or equal | filter[id][lte]=4 |
gt | Greater than | filter[id][gt]=5 |
gte | Greater than or equal | filter[id][gte]=6 |
exists | Not null / not empty (true, 1, yes); null / empty (false, 0, no) | filter[id][exists]=yes |
neq_or_null | Inequal or null (fields, to-one); inequal or empty (to-many) | filter[id][neq_or_null]=test |
contains | Contains text (string); contains all specified elements (to-many) | filter[name][contains]=test |
not_contains | Does not contain text (string); does not contain all specified elements (to-many) | filter[name][not_contains]=test |
starts_with | Starts with text | filter[name][starts_with]=test |
not_starts_with | Does not start with text | filter[name][not_starts_with]=test |
ends_with | Ends with text | filter[name][ends_with]=test |
not_ends_with | Does not end with text | filter[name][not_ends_with]=test |
empty | Empty string or null, empty array or null | filter[name][empty]=yes |
By default, integer filters support: eq, neq, lt, lte, gt, gte, exists, neq_or_null. String filters support: eq, neq, exists, neq_or_null. Operators like contains, starts_with, ends_with, and empty must be explicitly enabled by a developer.
Multiple values (OR)
Separate values with a comma to apply logical OR:
GET /api/users?filter[id]=5,7 HTTP/1.1
This returns users where id = 5 OR id = 7.
Range values
Use from_value..to_value syntax for inclusive ranges:
GET /api/users?filter[id]=5..7 HTTP/1.1
This returns users where id >= 5 AND id <= 7.
Multiple filters (AND)
Multiple filter parameters are combined with logical AND:
GET /api/users?filter[id][gt]=8&filter[name]=a HTTP/1.1
This returns users where id > 8 AND name = 'a'.
You can use the same field with multiple operators: filter[id][gte]=5&filter[id][lte]=7.
Example with operators, pagination, and field selection
GET /api/users?filter[id][gt]=5&page[number]=1&page[size]=2&fields[users]=username,email HTTP/1.1
Accept: application/vnd.api+json
{
"data": [
{
"type": "users",
"id": "6",
"attributes": {
"username": "jimmy.henderson_c4261",
"email": "[email protected]"
}
},
{
"type": "users",
"id": "7",
"attributes": {
"username": "gene.cardenas_c760d",
"email": "[email protected]"
}
}
]
}
Include filter
The include filter extends the response with related resource data. This reduces the number of requests needed to fetch all required data.
Included resources appear in the included section at the end of the response body.
When using the fields filter on the main resource, it must include the field(s) used in the include filter.
Example: include roles with field selection
GET /api/users?fields[users]=username,email,roles&include=roles&page[number]=1&page[size]=1 HTTP/1.1
Accept: application/vnd.api+json
{
"data": [
{
"type": "users",
"id": "1",
"attributes": {
"username": "admin",
"email": "[email protected]"
},
"relationships": {
"userRoles": {
"data": [
{
"type": "userroles",
"id": "3"
}
]
}
}
}
],
"included": [
{
"type": "userroles",
"id": "3",
"attributes": {
"extend_description": null,
"role": "ROLE_ADMINISTRATOR",
"label": "Administrator"
},
"relationships": {
"organization": {
"data": null
}
}
}
]
}
You can also limit fields on included resources using the fields filter:
GET /api/users?fields[userroles]=label&fields[users]=username,email,roles&include=roles&page[number]=1&page[size]=1 HTTP/1.1
Accept: application/vnd.api+json
By default, responses are limited to 10 records starting from page 1.
| Parameter | Type | Default | Description |
|---|
page[size] | integer | 10 | Number of records per page. Set to -1 to disable pagination. |
page[number] | integer | 1 | The page number to retrieve. |
Example: page 2 with 20 records per page
GET /api/users?page[number]=2&page[size]=20 HTTP/1.1
Accept: application/vnd.api+json
Sorting filter
Use the sort parameter with any available field name. Ascending order is the default.
- Ascending:
sort=username
- Descending:
sort=-username
- Multiple fields:
sort=id,-name
Example: sort by username descending
GET /api/users?filter[id][gt]=5&page[number]=1&page[size]=2&fields[users]=username,email&sort=-username HTTP/1.1
Accept: application/vnd.api+json
{
"data": [
{
"type": "users",
"id": "24",
"attributes": {
"username": "william.morrison_247fe",
"email": "[email protected]"
}
},
{
"type": "users",
"id": "31",
"attributes": {
"username": "victor.nixon_54050",
"email": "[email protected]"
}
}
]
}
The meta filter requests additional meta properties for each resource item in the response. Meta properties appear in the item’s meta object.
| Name | Description |
|---|
title | A text representation of the resource. |
Example: retrieve title meta property
GET /api/users?meta=title HTTP/1.1
Accept: application/vnd.api+json
{
"data": [
{
"type": "users",
"id": "1",
"meta": {
"title": "John Doe"
},
"attributes": {
"username": "john.doe"
}
},
{
"type": "users",
"id": "2",
"meta": {
"title": "Ellen Rowell"
},
"attributes": {
"username": "ellen.rowell"
}
}
]
}