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

# Batch Get Chunks

> Retrieve specific chunks by their document ID and chunk number in a single batch operation.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/morphik/openapi.documented.yml post /batch/chunks
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /batch/chunks:
    post:
      summary: Batch Get Chunks
      description: >-
        Retrieve specific chunks by their document ID and chunk number in a
        single batch operation.
      operationId: batch_get_chunks_batch_chunks_post
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchChunksRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ChunkResult'
                title: Response Batch Get Chunks Batch Chunks Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Morphik from 'morphik';

            const client = new Morphik({
              apiKey: process.env['MORPHIK_API_KEY'], // This is the default and can be omitted
            });

            const chunkResults = await client.batch.retrieveChunks();

            console.log(chunkResults);
        - lang: cURL
          source: |-
            curl https://api.morphik.ai/batch/chunks \
                -H 'Content-Type: application/json' \
                -H "Authorization: Bearer $MORPHIK_API_KEY" \
                -d '{}'
components:
  schemas:
    BatchChunksRequest:
      properties:
        sources:
          items:
            $ref: '#/components/schemas/ChunkSource'
          type: array
          title: Sources
          description: List of chunk sources to retrieve
        folder_name:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          title: Folder Name
          description: >-
            Optional folder scope. Accepts a folder PATH (e.g.,
            '/Company/Reports') or list of paths.
        end_user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: End User Id
          description: Optional end-user scope for the operation
        use_colpali:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Use Colpali
          description: Whether to use ColPali embeddings for retrieval
        output_format:
          anyOf:
            - $ref: '#/components/schemas/OutputFormat'
            - type: 'null'
          description: >-
            How to return image chunks: base64 (default), url, or text (markdown
            format)
      type: object
      title: BatchChunksRequest
      description: Request model for batch chunk retrieval.
    ChunkResult:
      properties:
        content:
          type: string
          title: Content
        score:
          type: number
          title: Score
        document_id:
          type: string
          title: Document Id
        chunk_number:
          type: integer
          title: Chunk Number
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        content_type:
          type: string
          title: Content Type
        filename:
          anyOf:
            - type: string
            - type: 'null'
          title: Filename
        download_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Download Url
        is_padding:
          type: boolean
          title: Is Padding
          description: Whether this chunk was added as padding
          default: false
      type: object
      required:
        - content
        - score
        - document_id
        - chunk_number
        - metadata
        - content_type
      title: ChunkResult
      description: Query result at chunk level
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ChunkSource:
      properties:
        document_id:
          type: string
          title: Document Id
        chunk_number:
          type: integer
          title: Chunk Number
        score:
          anyOf:
            - type: number
            - type: 'null'
          title: Score
      type: object
      required:
        - document_id
        - chunk_number
      title: ChunkSource
      description: Source information for a chunk used in completion
    OutputFormat:
      type: string
      enum:
        - base64
        - url
        - text
      title: OutputFormat
      description: Output format for image chunks in retrieval results.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````