> For the complete documentation index, see [llms.txt](https://docs.mews.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mews.com/pos-api/guidelines/filtering.md).

# Filtering

**Mews POS API** supports filtering using the JSON:API `filter` query parameter. The `filter` query parameter can be used to filter resources by attributes. Please note that support for filters is endpoint-specific. Visit the documentation of an endpoint to get more details about the supported filters.

> **Unsafe characters**: We recommend you always URI-encode the values of filter query parameters, because filters can contain unsafe URL characters.

### Supported filters

| Property        | Type   | Contract | Description                                                                                                                                                                                                                                                                                    |
| --------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `createdAtGt`   | string | optional | <p>Date-time or date the resource was created, in RFC 3339 format. Gt means greater than.<br>Raw example:<br><code>filter\[createdAtGt]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BcreatedAtGt%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p>                   |
| `createdAtGteq` | string | optional | <p>Date-time or date the resource was created, in RFC 3339 format. Gteq means greater than or equal to.<br>Raw example:<br><code>filter\[createdAtGteq]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BcreatedAtGteq%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p> |
| `createdAtLt`   | string | optional | <p>Date-time or date the resource was created, in RFC 3339 format. Lt means less than.<br>Raw example:<br><code>filter\[createdAtLt]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BcreatedAtLt%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p>                      |
| `createdAtLteq` | string | optional | <p>Date-time or date the resource was created, in RFC 3339 format. Lteq means less than or equal to.<br>Raw example:<br><code>filter\[createdAtLteq]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BcreatedAtLteq%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p>    |
| `updatedAtGt`   | string | optional | <p>Date-time or date the resource was updated, in RFC 3339 format. Gt means greater than.<br>Raw example:<br><code>filter\[updatedAtGt]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BupdatedAtGt%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p>                   |
| `updatedAtGteq` | string | optional | <p>Date-time or date the resource was updated, in RFC 3339 format. Gteq means greater than or equal to.<br>Raw example:<br><code>filter\[updatedAtGteq]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BupdatedAtGteq%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p> |
| `updatedAtLt`   | string | optional | <p>Date-time or date the resource was updated, in RFC 3339 format. Lt means less than.<br>Raw example:<br><code>filter\[updatedAtLt]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BupdatedAtLt%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p>                      |
| `updatedAtLteq` | string | optional | <p>Date-time or date the resource was updated, in RFC 3339 format. Lteq means less than or equal to.<br>Raw example:<br><code>filter\[updatedAtLteq]=2024-07-25T16:29:35+00:00</code><br>Encoded example:<br><code>filter%5BupdatedAtLteq%5D%3D2024-07-25T16%3A29%3A35%2B00%3A00</code></p>    |
| `registerIdEq`  | string | optional | <p>Register id, in Universally unique ID UUID4 format.<br>Raw example:<br><code>filter\[registerIdEq]=f35693cb-cc0c-4c6f-bf16-eb0547444642</code><br>Encoded example:<br><code>filter%5BregisterIdEq%5D%3Df35693cb-cc0c-4c6f-bf16-eb0547444642</code></p>                                      |

* We plan to add support for more filters in future.

### Example request and response

In the example request, we will query the `/invoices` endpoint with filter:

`GET` `[PlatformAddress]/v1/invoices?filter[createdAtGt]=2024-07-25T16%3A29%3A35%2B00%3A00`

It is also possible to combine two filters:

`GET` `[PlatformAddress]/v1/invoices?filter[createdAtGt]=2024-07-25T16%3A29%3A35%2B00%3A00&filter[registerIdEq]=f35693cb-cc0c-4c6f-bf16-eb0547444642`

#### Response

```javascript

{
    "data": [
        {
            "id": "babcf91e-5930-4b90-b929-0fb2b076bd3b",
            "type": "invoices",
            "attributes": {
                "cancelled": false,
                "cancelReason": null,
                "description": null,
                "createdAt": "2024-07-26T07:35:07.817Z",
                "updatedAt": "2024-07-26T07:35:07.836Z",
                "discount": null,
                "tax": "0.00",
                "total": "10.00",
                "subtotal": "10.00",
                "discountAmount": null,
                "itemDiscountAmount": null,
                "tipAmount": null
            },
            "relationships": {
                "user": {
                    "data": {
                        "id": "918a47d1-6553-42ee-8de4-3b5af5edc8e7",
                        "type": "users"
                    }
                },
                "register": {
                    "data": {
                        "id": "f35693cb-cc0c-4c6f-bf16-eb0547444642",
                        "type": "registers"
                    }
                },
                "invoiceItems": {
                    "data": [
                        {
                            "id": "7d87444b-807a-4ea4-8b69-b0e91f5fa174",
                            "type": "invoiceItems"
                        }
                    ]
                }
            }
        }
    ],
    "links": {
        "prev": "[PlatformAddress]/v1/invoices?page[before]=OTMzMw&page[size]=1",
        "next": "[PlatformAddress]/v1/invoices?page[after]=OTMzMw&page[size]=1"
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mews.com/pos-api/guidelines/filtering.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
