> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.docs.modulards.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.docs.modulards.com/_mcp/server.

# Filtering and sorting

Listings accept five query parameters: `page`, `filter`, `sort`, `include` and `fields`. Any other query parameter answers `422`.

Each endpoint documents the filters, sorts and includes it accepts.

## Filtering

Filters go under `filter`:

```text
filter[connected]=1
filter[team][]=12&filter[team][]=15
filter[s]=shop
```

* A list filter takes several values with `[]`. A row matches when it matches any of them.
* Several filters combine: a row must match all of them.
* Boolean filters take `1` or `0` (`true` and `false` also work).
* An empty value is ignored: `filter[team]=` does not filter.

## Sorting

`sort` takes a comma-separated list of fields. A leading `-` sorts that field in descending order:

```text
sort=-created_at,name
```

Without `sort`, each listing uses the default order its endpoint documents.

## Mistakes: 400 or 422

| Mistake                                                                         | Answer                                                                                                                    |
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| A filter, sort or include the endpoint does not offer                           | `400 Invalid Query Parameter`; `source.parameter` is `filter`, `sort` or `include`, and `detail` lists the allowed values |
| A value that is not valid for a filter, such as text where a number is expected | `422 Validation Error`; `source.parameter` names the filter, for example `filter[core_version]`                           |
| A query parameter other than `page`, `filter`, `sort`, `include` and `fields`   | `422 Validation Error`                                                                                                    |

The allowed values are listed in full in the real answer:

```json
{
  "errors": [
    {
      "status": "400",
      "title": "Invalid Query Parameter",
      "detail": "Requested filter(s) `colour` are not allowed. Allowed filter(s) are `...`.",
      "source": { "parameter": "filter" }
    }
  ],
  "jsonapi": { "version": "1.1" }
}
```