---
title: "POST /store/find"
method: POST
path: "/store/find"
---

# POST /store/find

`POST /store/find`

Query documents in a collection using a flexible query language. This endpoint supports pagination, sorting, and complex queries to help you efficiently retrieve exactly the data you need.

## Headers

- `X-DITTO-TXN-ID` integer

## Request body

- FindRequest — Request parameters for querying documents in a collection. Supports filtering, pagination, and sorting to help you retrieve exactly the data you need.
  - `args` unknown
  - `collection` string, required — The name of the collection to query
  - `describe` boolean — When true, includes additional metadata about the query execution
  - `formatAttachment` boolean — When true, formats any attachment fields for easier consumption
  - `limit` integer — Maximum number of documents to return. Use with offset for pagination.
  - `offset` integer — Number of documents to skip before starting to return results. Use with limit for pagination.
  - `query` string, required — The query expression that filters which documents to return. Use parameterized values with :param syntax for better security and performance.
  - `serializedAs` 'latestValues' | 'latestValuesAndTypes' — Controls how document values are serialized in responses
  - `sort` Sort[] — Specifies the order in which to return matching documents
    - `direction` 'asc' | 'desc', required — Sort direction for query results. Use 'asc' for ascending order (A to Z, 1 to 9) or 'desc' for descending order (Z to A, 9 to 1).
    - `property` string, required — Document property to sort by

## Response `200`

The query executed successfully. Returns an array of matching documents and the transaction ID of the read operation. If no documents match, the documents array will be empty.

- FindResponse
  - `documents` Document[], required — Array of documents matching the query criteria
    - `fields` unknown, required
    - `id` unknown, required
  - `txnId` integer — The transaction ID at which this query was performed

## Other responses

- `400` — The request was invalid. This could be due to malformed query syntax, invalid collection name, or invalid parameter values. Check the error message for details on how to correct the request.
- `401` — Authentication failed. Verify that you're providing a valid API key or JWT token and that it has appropriate read permissions for the requested collection.
- `500` — An unexpected server error occurred. This could be due to resource constraints or internal errors. The request may succeed if retried after a brief delay.

---

[API](https://skmtc.dev/ditto/apis/ditto-http-rpc-api.md) · [All operations](https://skmtc.dev/ditto/apis/ditto-http-rpc-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ditto/ditto-http-rpc-api/revisions/0f6d8b15f32d/schema)
