---
title: "Filtering"
description: "Collection endpoints can return large datasets. Use the where query parameter to limit results to records whose fields match your conditions."
canonical: https://docs.ordering.co/api-reference/guides/filtering/
---

# Filtering

Collection endpoints can return large datasets. Use the `where` query parameter to limit results to records whose fields match your conditions.

`where` is JSON encoded as a query-string value. Only fields declared as filterable by the target resource are applied. Check the operation schema for its current `x-ordering-whereable` fields.

## Equality and multiple values

A JSON object applies equality conditions. Multiple properties are combined with `AND`.

```json
{
  "city_id": 1,
  "enabled": true,
  "level": [2, 3]
}
```

An array value matches any listed value for the same attribute. This example requests orders `2`, `3`, and `5` while limiting the returned fields:

```bash
curl --get 'https://api.ordering.co/v400/en/demo/orders' \
  --data-urlencode 'where={"id":[2,3,5]}' \
  --data-urlencode 'params=id,business_id,customer_id'
```

Use credentials appropriate to the selected operation. The example intentionally omits them.

## Comparison conditions

Use the array form to attach a comparison object to a field. The legacy contract documents `=`, `!=`, `>`, `<`, `>=`, `<=`, and `ilike`; support can depend on the underlying field and endpoint.

```json
[
  {
    "attribute": "id",
    "value": {
      "condition": ">=",
      "value": 100
    }
  },
  {
    "attribute": "status",
    "value": [1, 2]
  }
]
```

Objects in this array are combined with `AND`.

## Nested `AND` and `OR` groups

The nested form accepts `conditions` and the literal contract key `conector`. Keep that spelling in request data.

```json
{
  "conditions": [
    {
      "attribute": "enabled",
      "value": true
    },
    {
      "conector": "AND",
      "conditions": [
        {
          "attribute": "level",
          "value": 2
        },
        {
          "attribute": "city_id",
          "value": 1
        }
      ]
    }
  ],
  "conector": "OR"
}
```

This represents `enabled = true OR (level = 2 AND city_id = 1)`.

## Legacy SDK syntax

The archived Ordering API SDK guide used a `where()` helper:

```javascript
const where = [
  {
    attribute: 'id',
    value: {
      condition: '=',
      value: [2, 3, 5]
    }
  }
]

const response = await ordering.orders().where(where).get()
```

Confirm the SDK package and version before using this helper. The HTTP `where` contract above is the maintained integration boundary.
