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

# Filtering

> Narrow Dealroom API results with filter expressions. Supports comparison operators, logical AND/OR, and 90+ fields across entities.

Filters use a single `filter` query parameter with an expression string:

```text theme={null}
filter=<expression>
```

## Expression syntax

| Form      | Syntax                      | Example                                                                        |
| --------- | --------------------------- | ------------------------------------------------------------------------------ |
| Single    | `field[op]:value`           | `total_funding[gte]:1000000`                                                   |
| AND       | `and(expr,expr,...)`        | `and(total_funding[gte]:1000000,location[eq]:233)`                             |
| OR        | `or(expr,expr,...)`         | `or(location[eq]:118871,location[eq]:1297711)`                                 |
| Nested    | `and(or(...),expr)`         | `and(or(location[eq]:118871,location[eq]:1297711),total_funding[gte]:1000000)` |
| Cross-ref | `relation__field[op]:value` | `investor__total_invested[gte]:100000000`                                      |

## Operators

| Operator  | Description                                 |
| --------- | ------------------------------------------- |
| `eq`      | Exact match                                 |
| `neq`     | Not equal                                   |
| `gt`      | Greater than                                |
| `gte`     | Greater than or equal                       |
| `lt`      | Less than                                   |
| `lte`     | Less than or equal                          |
| `in_any`  | Matches any of the given values             |
| `nin_any` | Matches none of the given values            |
| `in_all`  | Matches all values (relation filters only)  |
| `nin_all` | Excludes all values (relation filters only) |

<Note>
  `in` and `nin` are legacy aliases for `in_any` and `nin_any`. Prefer the
  canonical names.
</Note>

## Examples

### Filter by HQ country

Locations are matched by numeric ID from the Dealroom location taxonomy, not by
country name. Look up an ID once via `GET /api/reference/filters/location/values` and
reuse it:

```bash theme={null}
# Discover the ID (returns { id: 233, name: "United States", ... })
curl "https://api-next.dealroom.co/api/reference/filters/location/values?q=United+States" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Then filter
curl "https://api-next.dealroom.co/api/data/entities?sort=-launch_date&filter=location[eq]:233" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "X-Client-Id: YOUR_CLIENT_ID"
```

### Filter by industry (match any)

Industries (and other taxonomy values) live behind the `tag_id` filter. Pass
`?type=industry` on the values endpoint to scope the lookup, then pipe-separate
the resulting IDs in the filter expression:

```bash theme={null}
# Discover IDs first — returns { id: 42, name: "Fintech", ... } etc.
curl "https://api-next.dealroom.co/api/reference/filters/tag_id/values?q=fintech&type=industry" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# Then filter
curl "https://api-next.dealroom.co/api/data/entities?sort=-latest_valuation&filter=tag_id[in_any]:42|99" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "X-Client-Id: YOUR_CLIENT_ID"
```

### Combine multiple filters

Use `and()` to require all conditions:

```bash theme={null}
# 165 = Netherlands (discover via /api/reference/filters/location/values)
curl "https://api-next.dealroom.co/api/data/entities?sort=-launch_date&filter=and(location[eq]:165,launch_date[gte]:2018,total_funding[gte]:1000000)" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "X-Client-Id: YOUR_CLIENT_ID"
```

### Cross-reference filter

Filter companies by their investors' total invested amount:

```bash theme={null}
filter=investor__total_invested[gte]:100000000
```

## Sorting

Use the `sort` parameter with a field name. Prefix with `-` for descending order.

```text theme={null}
sort=-launch_date      # newest first
sort=-total_funding    # highest funded first
```

The full list of accepted sort keys per resource is in the
[Filters & Sorting Reference](/mintlify/references/filters-and-sorting).

## Available filters

For a complete list of all filters and sort keys grouped by scope, see the
[Filters & Sorting Reference](/mintlify/references/filters-and-sorting).

You can also fetch available filters programmatically:

```bash theme={null}
curl "https://api-next.dealroom.co/api/reference/filters?scope=companies" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "X-Client-Id: YOUR_CLIENT_ID"
```
