---
title: "Read document"
method: GET
path: "/_fabric/{fabric}/_api/document/{collection}/{key}"
tags: ["Documents"]
---

# Read document

`GET /_fabric/{fabric}/_api/document/{collection}/{key}`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_fabric/:fabric/_api/document/:collection/:key/get.ts> (a function with typed inputs; its response is checked against the schema)

Fetch the document identified by *key*. The returned document contains three special attributes:
 - *_id* containing the document handle.
 - *_key* containing key which uniquely identifies a document.
 - *_rev* containing the revision.

## Path parameters

- `fabric` string, string, required
- `collection` string, string, required
- `key` string, string, required

## Headers

- `If-None-Match` string
- `If-Match` string

## Response `200`

Successfully fetched document.

- ExamplesIdKeyRevData
  - `_id` string: ID of the collection.
  - `_key` string: _key details of collection.
  - `_rev` string: _rev details of collection.
  - `data` string: data in record.

## Other responses

- `304`: Document has the same revision if the *If-None-Match* header is given.
- `404`: Failed to find the specified collection or document.
- `412`: Document has different version if an *If-Match* header is given. The response contains the found document's current revision in the *_rev* attribute. Additionally, the attributes *_id* and *_key* are returned.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
