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

# Filtering

> Every list takes a filter, written in a small part of CEL.

The `filter` parameter on every list is an expression in [CEL](https://cel.dev), the Common Expression Language. CEL is an open-source language from Google for short expressions that are safe to evaluate. Kubernetes and Google Cloud use it for policies and filters. Its syntax looks like a condition in JavaScript, Go or Java:

```
status == "open" && dueAt < timestamp("2026-12-01T00:00:00Z")
```

The API supports only a small part of CEL. You do not need to learn the full language: this page lists everything that a filter can contain.

## Supported syntax

| Syntax | Meaning |
| - | - |
| `==`, `!=` | Equal, not equal |
| `<`, `<=`, `>`, `>=` | Before or after, on time fields |
| `&&`, `\|\|`, `!`, `( )` | And, or, not, grouping |
| `field in ["a", "b"]` | The field is one of the values in the list |
| `timestamp("2026-10-01T00:00:00Z")` | A time. Write it in RFC 3339 with a time zone, to the millisecond at most. |
| `field == null`, `field != null` | The field has no value, or has a value. Only on fields that can be empty. |

Each comparison has one field and one value. The value can come first: `timestamp("2026-10-01T00:00:00Z") < updatedAt` is the same as `updatedAt > timestamp("2026-10-01T00:00:00Z")`.

The API refuses any other CEL. This includes:

* Functions and methods, such as `startsWith()`, `contains()`, `matches()`, `size()` and `has()`.
* Arithmetic, such as `+` and `-`.
* A comparison of two fields, such as `createdAt < updatedAt`.
* The `? :` conditional.
* Number and boolean values. Every value is a string in double quotes, `timestamp("…")` or `null`.
* `in []`. Send at least one value.

Each list has its own filter fields. They are on each endpoint's page.

A filter can have at most 20 comparisons. It can put `&&`, `||` and `!` at most 4 levels deep: `!!!!(status == "open")` is allowed, and `!!!!!(status == "open")` is not. A chain such as `a && b && c` is one level, and parentheses do not add a level.

The field kind decides which operators you can use:

| Field kind | Operators | Value |
| - | - | - |
| Enum | `==`, `!=`, `in` | One of the field's values, in double quotes |
| Time | `==`, `!=`, `<`, `<=`, `>`, `>=` | `timestamp("…")` |
| ID | `==`, `!=`, `in` | An ID with the right prefix, in double quotes |
| Exact text | `==`, `!=`, `in` | The whole value, in double quotes. The endpoint's page says if case matters. |

On a field that can be empty, only `== null` and `!= null` match a record with no value. Any other comparison is false for that record, `!=` included. For example, `dueAt < timestamp("2026-12-01T00:00:00Z")` does not match an assignment with no due date.

## Examples

Open assignments that are due before 1 December 2026:

```
status == "open" && dueAt < timestamp("2026-12-01T00:00:00Z")
```

Assignments that are open or scheduled and have a due date:

```
status in ["open", "scheduled"] && dueAt != null
```

Assignments that are not drafts:

```
!(status == "draft")
```

Enrollments that changed after 1 October 2026:

```
updatedAt > timestamp("2026-10-01T00:00:00Z")
```

Learners in one assignment who have not started. This filter is for [List an assignment's enrollments](https://solidroad.mintlify.site/api-reference/v2/endpoint/assignments/enrollments.md):

```
status == "not_started"
```

The same learners, in one group only:

```
status == "not_started" && groupId == "grp_00000000-0000-4000-8000-000000000001"
```

## URL-encode the filter

Encode the filter before you put it in the URL. With curl, `--get --data-urlencode` does this for you:

```bash theme={null}
curl --get https://api.solidroad.com/v2/assignments \
  -H "Authorization: Bearer $SOLIDROAD_API_KEY" \
  --data-urlencode 'filter=status == "open" && dueAt < timestamp("2026-12-01T00:00:00Z")'
```

This is the same request with the filter encoded by hand:

```
https://api.solidroad.com/v2/assignments?filter=status%20%3D%3D%20%22open%22%20%26%26%20dueAt%20%3C%20timestamp%28%222026-12-01T00%3A00%3A00Z%22%29
```

## Errors

A filter that the API cannot read returns `400` with `code` `invalid_request`. The `detail` says what to fix:

```json theme={null}
{
  "type": "https://docs.solidroad.com/api/errors/invalid_request",
  "title": "The request is not valid",
  "status": 400,
  "detail": "nme is not a filter field here. Fields: status, createdAt, updatedAt, startAt, dueAt.",
  "instance": "abc12-1793279628409-14eba17502cd",
  "code": "invalid_request"
}
```


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