> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mithunai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Read a document's text

> Page through the readable text of one ingested document, in reading order, as the passages answers cite. Use it to show a cited source in your own interface.

Returns one page of a document's text as it was ingested: the current version, split into the passages that answers cite, in reading order. Each passage's `id` is the `source_id` a citation carries, so you can show the document and scroll to the passage an answer used.

`text` is content from your knowledge sources. It is returned as a JSON string for you to display as **plain text**; do not render it as HTML or Markdown.

`limit` and `offset` are clamped rather than refused. A `limit` below `1` becomes `1`, a `limit` above `50` becomes `50`, and a negative `offset` becomes `0`. A value that is not a whole number returns `400`. Any role in the organization can read a document's content. A document that does not exist, belongs to another organization or has a malformed ID returns `404`.

<ParamField path="document_id" type="string" required>
  The document ID, from [List documents](/api-reference/knowledge/list-documents).
</ParamField>

<ParamField query="limit" type="integer" default="20">
  Passages per page, from `1` to `50`.
</ParamField>

<ParamField query="offset" type="integer" default="0">
  Number of passages to skip.
</ParamField>

## Response

<ResponseField name="document" type="object" required>
  The document, with the same fields [List documents](/api-reference/knowledge/list-documents)
  returns for it.
</ResponseField>

<ResponseField name="version_id" type="string" required>
  The version of the document this text belongs to. It changes when a sync finds the document
  changed.
</ResponseField>

<ResponseField name="chunks" type="object[]" required>
  The page of passages, in reading order.

  <Expandable title="properties">
    <ResponseField name="id" type="string" required>
      The passage ID. A citation that used this passage has it as `source_id`.
    </ResponseField>

    <ResponseField name="position" type="integer" required>
      The passage's place in the document's reading order.
    </ResponseField>

    <ResponseField name="text" type="string" required>
      The passage text. Display it as plain text.
    </ResponseField>

    <ResponseField name="heading_path" type="string[]" required>
      The headings the passage sits under, outermost first. Empty when it is under none.
    </ResponseField>

    <ResponseField name="anchor" type="string | null" required>
      The in-page anchor of the passage's section, when the source has one.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="integer" required>
  Number of passages in this version of the document.
</ResponseField>

<ResponseField name="limit" type="integer" required>
  The page size applied, after clamping.
</ResponseField>

<ResponseField name="offset" type="integer" required>
  The offset applied, after clamping.
</ResponseField>

<ResponseField name="has_more" type="boolean" required>
  `true` when more passages follow this page.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl --request GET "$MITHUNAI_URL/mithunai/api/v1/knowledge/documents/7e2d4b1a-9c3f-5a86-b1e4-0d6c8f2a3b57/content?limit=2&offset=0" \
    --header "Authorization: Bearer $MITHUNAI_API_KEY"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import os, requests

  document_id = "7e2d4b1a-9c3f-5a86-b1e4-0d6c8f2a3b57"
  response = requests.get(
      f"{os.environ['MITHUNAI_URL']}/mithunai/api/v1/knowledge/documents/{document_id}/content",
      headers={"Authorization": f"Bearer {os.environ['MITHUNAI_API_KEY']}"},
      params={"limit": 2, "offset": 0},
      timeout=60,
  )
  response.raise_for_status()
  print(response.json())
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const documentId = '7e2d4b1a-9c3f-5a86-b1e4-0d6c8f2a3b57'
  const params = new URLSearchParams({ limit: '2', offset: '0' })
  const response = await fetch(
    `${process.env.MITHUNAI_URL}/mithunai/api/v1/knowledge/documents/${documentId}/content?${params}`,
    {
      headers: { Authorization: `Bearer ${process.env.MITHUNAI_API_KEY}` },
    },
  )
  console.log(await response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "document": {
      "id": "7e2d4b1a-9c3f-5a86-b1e4-0d6c8f2a3b57",
      "collection_id": "0b6f2c14-8a3d-4e91-9c77-2f5b1d0a4e88",
      "source_id": "5d1e7a90-3c4b-4f2a-8e61-7b9c0d2f4a13",
      "title": "Rate limits",
      "path": "docs/api/rate-limits.md",
      "content_type": "markdown",
      "status": "active",
      "source_url": "https://github.com/example-org/platform-docs/blob/4f9c2e7a1b3d5c8e0f2a4b6c8d0e1f3a5b7c9d2e/docs/api/rate-limits.md",
      "source_version": "4f9c2e7a1b3d5c8e0f2a4b6c8d0e1f3a5b7c9d2e",
      "first_seen_at": "2026-09-24T10:21:13.550182",
      "last_seen_at": "2026-09-24T10:21:13.550182"
    },
    "version_id": "9a4c1e7b-2d58-4f03-b6a9-0c3e5d7f1b82",
    "chunks": [
      {
        "id": "c5e80b3a-6f12-4d97-a1c4-7b2e9d0f3a65",
        "position": 0,
        "text": "Rate limits\n\nEvery credential has a request budget per minute.",
        "heading_path": ["Rate limits"],
        "anchor": "rate-limits"
      },
      {
        "id": "e1f7a2c9-0b84-4e36-9d5a-3c6b8f1e4d70",
        "position": 1,
        "text": "When a budget is spent, the API answers 429 until the window resets.",
        "heading_path": ["Rate limits", "What happens at the limit"],
        "anchor": "what-happens-at-the-limit"
      }
    ],
    "total": 7,
    "limit": 2,
    "offset": 0,
    "has_more": true
  }
  ```

  ```json 400 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  { "code": "validation_error", "message": "'limit' must be a whole number." }
  ```

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  { "code": "not_found", "message": "The document was not found." }
  ```
</ResponseExample>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.