Environment:
Skip to main content
This documentation is in BETA version, for any information contact us at api@sibill.it

Filter Results

The Sibill APIs allow filtering results to help clients make more precise queries. There is no default ordering, but results can be sorted using the sort parameter.

Each resource supports a set of fields on which filters can be applied. These are listed in the API reference for each resource and endpoint.

How to use it

Filters must be passed as parameters in the query string in the following form: filter[field__operator]=value Where field is the name of the field you want to filter, followed by __ (2 underscores) and then operator, which represents the filter operator, and finally the value.

Here is an example of how to use the API with filters: GET /api/v1/companies/:company_id/documents?filter[status__eq]=DRAFT

The above call will retrieve all documents that have status equal to DRAFT.

Operator list

Below is a table of the operators that can be used in filters. Some operators can only be used with certain field types.

OperatorDescriptionExample
eq{'=='}filter[status__eq]=DRAFT
neq{'!='}filter[status__neq]=DRAFT
gt{'>'}filter[amount__gt]=10
gte{'>='}filter[amount__gte]=10
lt{'<'}filter[amount__lt]=10
lte{'<='}filter[amount__lte]=10
ininfilter[status__in]=DRAFT,CREATED
notIn!infilter[status__notIn]=DRAFT,CREATED
emptywhether a field is set or notfilter[delivery_status__empty]=true / filter[delivery_status__empty]=false
ilikecase-insensitive text search on a fieldfilter[description__ilike]=inv
warning

Filter values of Enum type (or with a limited set of values) must be passed as uppercase strings.

GET /api/v1/companies/:company_id/documents?filter[creation_date__gte]=2025-02-01&filter[creation_date__lte]=2025-02-28&filter[status__eq]=DRAFT

HTTP/1.1 200 Ok
Content-Type: application/json

{
"data":[
{
"created_at":"2025-02-06T08:21:37.999777Z",
"creation_date":"2025-02-07",
"delivery_date":null,
"delivery_status":null,
"format":"FPR12",
"id":"aa5d3bb5-a8b8-4124-9ce1-47963b56c260",
"number":"document-number-ddonp",
"status":"DRAFT",
"updated_at":"2025-03-06T08:21:37.999777Z"
},
...
],
"page":{
"cursor":"g3QAAAACdwJpZG0AAAAkYzg3ZTNiYmMtYzNhZi00ZmFjLThkNzYtNmE1MTgzMDRhYdw1pY3JvkYXJ3E0NQRjEyAA==",
"size":25
}
}

Retrieves documents that are in DRAFT or CREATED status.

Note that the in and notIn operators expect a comma-separated list.

GET /api/v1/companies/:company_id/documents?filter[status__in]=DRAFT,CREATED

HTTP/1.1 200 Ok
Content-Type: application/json

{
"data":[
{
"created_at":"2025-02-06T08:21:37.999777Z",
"creation_date":"2025-02-07",
"delivery_date":null,
"delivery_status":null,
"format":"FPR12",
"id":"aa5d3bb5-a8b8-4124-9ce1-47963b56c260",
"number":"document-number-ddonp",
"status":"DRAFT",
"updated_at":"2025-03-06T08:21:37.999777Z"
},
...
],
"page":{
"cursor":"g3QAAAACdwJpZG0AAAAkYzg3ZTNiYmMtYzNhZi00ZmFjLThkNzYtNmE1MTgzMDRhYdw1pY3JvkYXJ3E0NQRjEyAA==",
"size":25
}
}

Example with the ilike operator

The ilike operator is very similar to the ilike operator found in most databases. In the example below, all transactions that have the string salary in the clean_description field will be returned, ignoring case.

GET /api/v1/companies/:company_id/transactions?filter[clean_description__ilike]=salary

HTTP/1.1 200 Ok
Content-Type: application/json

{
"data": [
{
"booking_date_time": "2019-08-24T14:15:22Z",
"amount": {
"amount": 1000,
"currency": "EUR"
},
"clean_description": "march salary",
"counterpart_name": "counterpart name",
"created_at": "2019-08-24T14:15:22Z",
"date": "2019-08-24T14:15:22Z",
"description": "March Salary",
"id": "06a5b150-2c10-4127-ab4c-dcab46029910",
"value_date_time": "2019-08-24T14:15:22Z"
},
...
],
"page": {
"cursor": "g3QAAAACdwJpZG0AAAAkYzg3ZTNiYmMtYzNhZi00ZmFjLThkNzYtNmE1MTgzMDRhYdw1pY3JvkYXJ3E0NQRjEyAA==",
"size": 25
}
}