> ## Documentation Index
> Fetch the complete documentation index at: https://docs.followr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Filtering, sorting and including

> Narrow lists with filter, order them with sort, add related data with include.

Lists share three query parameters. Each endpoint's page lists the filters, sort fields and includes it accepts.

## Filter

One parameter per filter, `filter[name]=value`. All filters in a request must match.

```bash cURL theme={null}
curl --globoff "https://api.followr.ai/api/companies/1287/postGroups?filter[draft]=false&filter[title]=launch" \
  --header "Authorization: Bearer $FOLLOWR_API_KEY" \
  --header "Accept: application/json"
```

| Kind | Example | Matches |
| - | - | - |
| Exact | `filter[draft]=true` | Equal to the value. |
| Several values | `filter[id]=88412,88413` | Equal to any of them. |
| Partial | `filter[title]=launch` | Contains the value, any case. |
| Date range | `filter[created_at_after]=2026-12-01T00:00:00Z` | On or after (`_after`) or on or before (`_before`). Both inclusive. |
| Relation | `filter[tags.id]=731` | Related to that resource. |

> [!TIP]
>
> A date without a time means midnight UTC: `filter[created_at_before]=2026-12-31` stops at the start of December 31. Send `2026-12-31T23:59:59Z` for the whole day.

With `curl`, pass `--globoff` (`-g`) or encode the brackets (`filter%5Bdraft%5D=false`). Most HTTP libraries do it for you.

## Sort

One or more fields, comma-separated. A `-` prefix sorts descending.

```text theme={null}
sort=-publish_at,id
```

Newest `publish_at` first, then by `id`. Without `sort`, the order isn't guaranteed.

## Include

Adds related resources to each item. Separate with commas; use dots for deeper relations.

```text theme={null}
include=posts,posts.assets.image,tags
```

```json theme={null}
{
  "data": {
    "id": 88412,
    "title": "Winter menu launch",
    "posts": [
      {
        "id": 240551,
        "social_network_type": "instagram",
        "assets": [
          {
            "id": 66120,
            "image": { "id": 908112, "url": "https://cdn.followr.ai/..." }
          }
        ]
      }
    ],
    "tags": [{ "id": 731, "name": "Launch" }]
  }
}
```

A nested include brings the levels above it too: `posts.assets.image` includes `posts` and their `assets`. Include only what you use: each relation makes the response bigger and slower.

## Unknown parameters

A filter, sort field or include the endpoint doesn't accept gets `400`, with the allowed values in the message. It is never ignored, so a typo can't turn into a list of everything.

```json theme={null}
{
  "message": "Requested filter(s) `colour` are not allowed. Allowed filter(s) are `id, draft, auto_publish, user_id, title`."
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.