> For the complete documentation index, see [llms.txt](https://docs.one-record.fr/one-record/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.one-record.fr/one-record/about-the-api/filtering-and-sorting.md).

# Filtering and Sorting

## Filtering

As dataset can be large and not all data relevant, it is possible to use filter parameters to get more precise results and reduce bandwidth. It is possible to apply multiple filters and to do search by exact match or with conditions:

<table><thead><tr><th width="163">Operator Name</th><th>Syntax</th><th width="251">Description</th><th>Example</th></tr></thead><tbody><tr><td>Equal</td><td>eq</td><td>Finds records where the value is exactly equal to the specified value.</td><td>/country?filter[code][<code>eq</code>]=US</td></tr><tr><td>Not Equal</td><td>ne</td><td>Finds records where the value is exactly not equal to the specified value.</td><td>/country?filter[code][<code>ne</code>]=US</td></tr><tr><td>Greater Than</td><td>gt</td><td>Finds values where the numeric or date column's value is greater than the specified value.</td><td>/shipment?filter[quantityReal][<code>gt</code>]=10</td></tr><tr><td>Greater Than Or Equal</td><td>gte</td><td>Finds values where the numeric or date column's value is greater than or equal to a specified value.</td><td>/shipment?filter[quantityReal][<code>gte</code>]=10</td></tr><tr><td>Less Than</td><td>lt</td><td>Finds values where the numeric or date column's value is less than the specified value.</td><td>/shipment?filter[quantityReal][<code>lt</code>]=10</td></tr><tr><td>Less Than Or Equal</td><td>lte</td><td>Finds values where the numeric or date column's value is less than or equal to a specified value.</td><td>/shipment?filter[quantityReal][<code>lte</code>]=10</td></tr><tr><td>Between</td><td>between</td><td>Finds values where the numeric or date column's values fall within a specified range.</td><td>/shipment?filter[quantityReal][<code>between</code>]=5,10</td></tr><tr><td>Not Between</td><td>notBetween</td><td>Finds values where the numeric or date column's values do not fall within the specified range.</td><td>/shipment?filter[quantityReal][<code>notBetween</code>]=5,10</td></tr><tr><td>In</td><td>in</td><td>Finds any of the specified values in a list.</td><td>/country?filter[code][<code>in</code>]=FR,US,BE</td></tr><tr><td>Not In</td><td>notIn</td><td>Finds values that do not match any of the specified values in a list.</td><td>/country?filter[code][<code>notIn</code>]=FR,US,BE</td></tr><tr><td>Like</td><td>like</td><td>Finds values where the column content match the specified wildcard.<br>You must use the "<strong>%</strong>" symbol at the beginning, end, or both, depending on the desired match</td><td>/country?filter[name][<code>like</code>]=%France%</td></tr><tr><td>Not Like</td><td>notLike</td><td>Finds values where the column content does not match the specified wildcard.<br>You must use the "<strong>%</strong>" symbol at the beginning, end, or both, depending on the desired match</td><td>/country?filter[name][<code>notLike</code>]=%France%</td></tr><tr><td>Starts With</td><td>startsWith</td><td>Finds values that start with a specified string.</td><td>/country?filter[name][<code>startsWith</code>]=Fra</td></tr><tr><td>Ends With</td><td>endsWith</td><td>Finds values that end with a specified string.</td><td>/country?filter[name][<code>endsWith</code>]=ance</td></tr></tbody></table>

**Combining Filters for Advanced Queries**

Advanced queries enable the combination of multiple filters, applying different criteria across several fields to refine search results precisely.

<details>

<summary><code>/shipment?filter[departure][eq]=TLS&#x26;filter[goodsDescription][startsWith]=AC</code></summary>

search for shipments which departure from TLS and having the goodsDescription starting with "AC".

</details>

<details>

<summary><code>/shipment?filter[quantityReal][gt]=10&#x26;filter[orderReference][like]=%123456%</code></summary>

Search for shipments which quantity real is greather than 10 and order reference contain "123456".

</details>

### Condition

By default, the filter will match all the criteria, the equivalent of logical `AND` operator. It is possible to match only some criteria using conditional `OR` operator.

#### Example

<details>

<summary><code>/shipment?filter[orderReference][like]=S%&#x26;filter[orderReference][like]=P%&#x26;filter[orderReference][condition]=OR</code></summary>

search for shipments which orderReference is like `S%` or `P%`. The `%` is a wild char, in this example, `filter[orderReference][like]=S%` would be equivalent as `filter[orderReference][startWith]=S`.

</details>

## Sorting

The data can come in random order or with a default sorting, e.g. `code` for country or `orderReference` for shipment. One Record API offers the `order` option to arrange data through any sortable field.

#### Example

<details>

<summary><code>/country?order[column]=region</code></summary>

sort data by country's region (Africa, Americas,…).

</details>

### Reverse sorting

By default the sorting will be ascending (`ASC`), e.g. alphabetically `[a..z]` for characters, growing `[-∞..+∞]` for numbers, etc. One Record API has the `DESC` option to flip the sorting order.

#### Example

<details>

<summary><code>/country?order[column]=region&#x26;order[direction]=DESC</code></summary>

sort data by country's region in reverse alphabetically order (Oceania, Europe,…).

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.one-record.fr/one-record/about-the-api/filtering-and-sorting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
