> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/data-warehouse/introduction/filtering-parameters.md).

# Filtering Parameters

All endpoints in this API support the following filtering options to customize and refine your queries. Each filter option is designed to provide flexibility and control over the data retrieval process.

Individual endpoints support additional filters beyond the shared ones below. Each endpoint section lists every query parameter that endpoint accepts.

> **Warning:** String filters match partially, not exactly. A string parameter that lists an `enum` in its schema is validated and matched exactly, and an invalid value returns `400 Bad Request`. A string parameter without an `enum` performs a case-insensitive partial match. For example, `?user_email=example.com` returns every record whose email address contains that text, while `?status=400` on the orders endpoint is an enum and matches only orders with that exact status code. Send the complete value when you need one specific record.

> **Warning:** The API ignores query parameters it does not recognize. A misspelled filter name does not return an error. The request succeeds and the filter is silently dropped, so you receive more records than you expect. An unknown `sort` field is ignored the same way. Always verify parameter names against the endpoint section before you rely on the result.

#### **1. ID**

The `id` filter allows you to query records based on their unique identifier. The following lookups are available for this filter:

* `gt`: Greater than
* `gte`: Greater than or equal to
* `lt`: Less than
* `lte`: Less than or equal to
* `exact`: Matches the exact ID

***Example Usage:***

* Retrieve records with IDs greater than 100:\
  `?id__gt=100`
* Retrieve records with IDs less than or equal to 50:\
  `?id__lte=50`
* Retrieve records with the exact ID of 123:\
  `?id=123`

#### **2. Modified Date**

The `modified_date` filter allows you to query records based on the timestamp of their last modification. The following lookups are supported:

* `gt`: Modified after the specified date and time
* `gte`: Modified on or after the specified date and time
* `lt`: Modified before the specified date and time
* `lte`: Modified on or before the specified date and time

***Example Usage:***

* Retrieve records modified after January 10, 2025:\
  `?modified_date__gt=2025-01-10T00:00:00Z`
* Retrieve records modified on or before January 9, 2025:\
  `?modified_date__lte=2025-01-09T23:59:59Z`

**Note:** Provide dates and times in full ISO 8601 date-time format: `YYYY-MM-DDTHH:MM:SSZ`. A date-only value such as `2025-01-10` returns `400 Bad Request` with the message `Enter a valid date/time.`

**Note:** The API returns all timestamps in UTC and expects filter values in UTC. A value sent in local time shifts your results by your local UTC offset, and the response gives no indication of the shift.

#### **3. Sort**

The `sort` parameter is used to order the results of a query based on one or more fields. By default, sorting is in ascending order. Use a hyphen (`-`) before a field to sort in descending order.

***Example Usage:***

* Sort records by `id` in ascending order:\
  `?sort=id`
* Sort records by `modified_date` in descending order:\
  `?sort=-modified_date`

#### **4. Page**

The `page` parameter is used for pagination to retrieve a specific subset of records.

***Example Usage:***

* Retrieve the second page of results: `?page=2`

#### **5. Limit**

The `limit` parameter sets how many records a single page returns, up to a maximum of 1000. It applies to every list endpoint.

***Example Usage:***

* Retrieve 50 records in one page: `?limit=50`
* Retrieve records 51 to 100: `?limit=50&page=2`

**Pagination Behavior**

* The default page size is 10 records. A request without `limit` returns at most 10 records.
* The `page_size` parameter is not supported. The API ignores it and returns the default page size.
* The maximum page size is 1000 records. A `limit` above 1000 is capped at 1000. The request still succeeds and returns 1000 records, so a client that asks for more must page through the rest.
* The response reports the total number of matching records in the `count` field.
* The `next` and `previous` fields contain absolute URLs built from the host that served the request. Behind a proxy, that host may not be the address you called. Build your own `?page=N` requests instead of following these links.

**Example Query Combining Filters**

Retrieve records with the following criteria:

* IDs greater than 100
* Modified on or after January 10, 2025
* Sorted by `modified_date` in descending order
* Display the first page of results

***Example:***

`?id__gt=100&modified_date__gte=2025-01-10T00:00:00Z&sort=-modified_date&page=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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/data-warehouse/introduction/filtering-parameters.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
