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

# POST /store/findbyid

`POST /store/findbyid`

Retrieve a single document by its unique identifier. This is the most efficient way to fetch a specific document when you know its ID.

## Headers

- `X-DITTO-TXN-ID` integer

## Request body

- FindByIdRequest — Request parameters for retrieving a specific document by its ID. This is the most efficient way to fetch a single document when you know its identifier.
  - `collection` string, required — The name of the collection containing the document
  - `formatAttachment` boolean — When true, any attachment fields will be formatted for easier consumption
  - `id` unknown, required
  - `serializedAs` 'latestValues' | 'latestValuesAndTypes' — Controls how document values are serialized in responses

## Response `200`

The document was found and retrieved successfully. Returns the document data along with the transaction ID of the read operation.

- FindByIdResponse — Represents a document in the Ditto store. Documents are schema-free and can contain nested fields of various CRDT types for conflict-free replication.
  - `fields` unknown, required
  - `id` unknown, required
  - `txnId` integer — The transaction ID at which this document was retrieved, useful for consistency tracking

## Other responses

- `400` — The request was invalid. This could be due to an invalid ID format, unknown collection, or other parameter validation failures. Check the error message for specific details.
- `401` — Authentication failed. Ensure you're providing a valid API key or JWT token with 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)
