---
title: "Get Document Chunks"
method: GET
path: "/documents/{document_id}/chunks"
tags: ["documents"]
---

# Get Document Chunks

`GET /documents/{document_id}/chunks`

List all document chunks sorted by index in ascending order. May be limited to a range of chunk indices with the `start_index` and `end_index` parameters. Documents created prior to 9/18/2024, which have not been updated since, have chunks which do not include an index and their index will be returned as -1. They will be sorted by their ID instead. Updating the document using the `Update Document File` or `Update Document Raw` endpoint will regenerate document chunks, including their index. Results are paginated with a max limit of 100. When more chunks are available, a `cursor` will be provided. Use the `cursor` parameter to retrieve the subsequent page.

## Path parameters

- `document_id` string, uuid, required — The id of the document.

## Query parameters

- `start_index` integer, nullable — The inclusive starting index of the chunk range to list. If omitted and `end_index` is present effectively limits results to at most one chunk matching `end_index`. If both `start_index` and `end_index` are omitted, results are not limited by index.
- `end_index` integer, nullable — The inclusive ending index of the chunk range to list. If omitted and `start_index` is present effectively limits results to at most one chunk matching `start_index`. If both `start_index` and `end_index` are omitted, results are not limited by index.
- `cursor` string, nullable — An opaque cursor for pagination
- `page_size` integer — The number of items per page (must be greater than 0 and less than or equal to 100)

## Headers

- `partition` string, nullable — An optional partition to scope the request to. If omitted, accounts created after 1/9/2025 will have the request scoped to the default partition, while older accounts will have the request scoped to all partitions. Older accounts may opt in to strict partition scoping by contacting support@ragie.ai. Older accounts using the partitions feature are strongly recommended to scope the request to a partition.

## Response `200`

Successful Response

- DocumentChunkList
  - `pagination` Pagination, required
    - `next_cursor` string, nullable
    - `total_count` integer, required
  - `chunks` DocumentChunk[], required
    - `id` string, uuid, required
    - `index` integer
    - `text` string, required
    - `metadata` ChunkMetadata
    - `links` object, required

## Other responses

- `401` — Unauthorized
- `402` — Payment Required
- `404` — Not Found
- `422` — Validation Error
- `429` — Too Many Requests
- `500` — Internal Server Error

---

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