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

# Get Document Chunks

> Get all chunks for a document after processing.

## Authentication & Scope

Requires the `sessions-read` ability.

## Request

```http theme={null}
GET /extractions/documents/880e8400-e29b-41d4-a716-446655440000/chunks HTTP/1.1
Host: api.raydocs.com
Authorization: Bearer <token>
```

### Path Parameters

| Parameter    | Type | Required | Description     |
| ------------ | ---- | -------- | --------------- |
| `documentId` | uuid | Yes      | The document ID |

## Response

`200 OK` – Array of document chunks.

```json theme={null}
[
  {
    "id": "aa0e8400-e29b-41d4-a716-446655440000",
    "document_id": "880e8400-e29b-41d4-a716-446655440000",
    "chunk_index": 0,
    "blocks": [
      {
        "block_id": "doc:page:1:block:0",
        "type": "heading",
        "content": "Invoice",
        "page_ref": "Page 1",
        "meta": {}
      },
      {
        "block_id": "doc:page:1:block:1",
        "type": "paragraph",
        "content": "Invoice Number: INV-2024-001",
        "page_ref": "Page 1",
        "meta": {}
      },
      {
        "block_id": "doc:page:1:block:2",
        "type": "table",
        "content": "",
        "page_ref": "Page 1",
        "meta": {
          "table": {
            "table_id": "page:1:table:1",
            "row_count": 3,
            "col_count": 3
          }
        }
      },
      {
        "block_id": "doc:page:1:block:3",
        "type": "table_row",
        "content": "Item | Qty | Price",
        "page_ref": "Page 1",
        "meta": {
          "table_row": {
            "table_id": "page:1:table:1",
            "is_header_row": true,
            "cells": [
              { "col_index": 1, "text": "Item" },
              { "col_index": 2, "text": "Qty" },
              { "col_index": 3, "text": "Price" }
            ]
          }
        }
      }
    ],
    "context": "Page 1",
    "visual_context": "- Chart showing quarterly revenue",
    "page_range": "Page 1"
  }
]
```

<Note>
  Chunks are only available after document processing is complete (status = `ready`).
</Note>

### Chunk Properties

| Property         | Description                            |
| ---------------- | -------------------------------------- |
| `chunk_index`    | Order of the chunk within the document |
| `blocks`         | Structured array of canonical blocks   |
| `context`        | Optional AI-generated context prefix   |
| `visual_context` | Optional markdown describing visuals   |
| `page_range`     | Page/slide/sheet range for the chunk   |


## OpenAPI

````yaml get /extractions/documents/{documentId}/chunks
openapi: 3.0.1
info:
  title: Raydocs API
  description: REST API for document extraction with AI-powered data parsing
  version: 1.0.0
servers:
  - url: https://api.raydocs.com
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Create and manage workspaces.
  - name: Workspace Users
    description: Manage users within a workspace.
  - name: Extraction Templates
    description: Define extraction schemas and settings.
  - name: Extraction Sessions
    description: Manage extraction jobs and documents.
  - name: Batch Operations
    description: Bulk operations on sessions.
  - name: Documents
    description: Upload and manage source documents.
  - name: Workflows
    description: Discover workflow runs and read their public outputs.
  - name: Results
    description: Access extraction results.
paths:
  /extractions/documents/{documentId}/chunks:
    get:
      tags:
        - Documents
      summary: Get Document Chunks
      description: Retrieve parsed chunks from a document. Requires `sessions-read`.
      operationId: getDocumentChunks
      parameters:
        - name: documentId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Chunk'
        '404':
          description: Not Found
components:
  schemas:
    Chunk:
      type: object
      properties:
        id:
          type: string
          format: uuid
        content:
          type: string
        page_number:
          type: integer
        chunk_index:
          type: integer
        metadata:
          type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Personal Access Token created from the Raydocs dashboard.

        Include in the Authorization header: `Bearer <your_token>`

        See [API Keys](/api-reference/api-keys) for token creation and
        management.

````