Set up filters

A filtering system is available on listing endpoints to let you get resources according to your needs.

How does it work ?

You need to add a filter parameter to your GET request. This parameter has to be a JSON array of objects.
A filter object is always a combination of the three following keys :

NameDescription
fieldThe field of the concerned resource you want to filter by
operatorThe operator you want to compare by
valueThe value of the given field you want to filter by

Available operators

OperatorDescription
eqequal to
not_eqnot equal to
ltlesser than
lteqlesser than or equal to
gtgreater than
gteqgreater than or equal to
infield is included in value (must be an array)
not_infield is not included in value (must be an array)
start_withsearch text (ILIKE '123%')

Example #1 : Filter the invoices per date

Let's say you want to retrieve all invoices from the 2024-01-01. You need the field date, with operator gteq, with value set to 2024-01-01.

filters = [
  { 
    field: 'date', 
    operator: 'gteq', 
    value: '2024-01-01'
  },
].to_json

Example #2 : Filter the invoices per multiple customer id

Now, let's say you want to retrieve all invoices from 2025 of two customers with id is ONE_CUSTOMER_ID and TWO_CUSTOMER_ID. You need 2 filters. When filtering by customer_id, the in operator will return the invoices with customer_id similar to the passed values. See the following example with two filters :

filters = [
  { 
    field: 'date', 
    operator: 'gteq', 
    value: '2025-01-01',
  },
  { 
    field: 'customer_id', 
    operator: 'in', 
    value: '[ONE_CUSTOMER_ID, TWO_CUSTOMER_ID]',
  },
].to_json