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

# Get Source Chunks



## OpenAPI

````yaml https://api.aiql.io/openapi.json get /sources/{id}/chunks
openapi: 3.1.0
info:
  title: aiql-api
  version: 0.1.0
servers:
  - url: https://api.aiql.io
security: []
tags:
  - name: Health
    description: Service health checks.
  - name: Workspaces
    description: Workspace management.
  - name: Ingestions
    description: Document ingestion pipeline.
  - name: Queries
    description: Natural-language queries.
  - name: Sources
    description: Ingested sources and their contents.
  - name: Requests
    description: Source addition/removal requests awaiting review.
  - name: Request Changes
    description: Individual source add/remove changes on a request.
  - name: Request Reviews
    description: Reviews of a request, including draft and submit.
  - name: Request Comments
    description: Comments on a request review.
  - name: Canvases
    description: Brainstorm canvases.
  - name: Dashboards
    description: Dashboards.
  - name: Presentations
    description: Slide presentations.
  - name: Tools
    description: Standalone convert/split/shape/extract tools.
  - name: Connectors
    description: Connector catalog and connect flows.
  - name: Connections
    description: Workspace connector connections.
paths:
  /sources/{id}/chunks:
    get:
      tags:
        - Sources
      summary: Get Source Chunks
      operationId: get_source_chunks_sources__id__chunks_get
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            title: Id
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Maximum number of items to return per page.
            default: 20
            title: Limit
          description: Maximum number of items to return per page.
        - name: cursor
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Opaque cursor pointing to the page to fetch. Omit to start from
              the first page.
            title: Cursor
          description: >-
            Opaque cursor pointing to the page to fetch. Omit to start from the
            first page.
        - name: AiQL-Workspace
          in: header
          required: true
          schema:
            type: string
            description: ID of the workspace the request operates on.
            title: Aiql-Workspace
          description: ID of the workspace the request operates on.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page_SourceChunk_'
        '401':
          description: 'Authentication failed: missing or invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            curl https://api.aiql.io/sources/ing_9d2c/chunks \
              -H "Authorization: Bearer $AIQL_API_KEY" \
              -H "AiQL-Workspace: $AIQL_WORKSPACE_ID"
        - lang: python
          label: Python SDK
          source: |-
            import os
            from aiql import AiQL

            client = AiQL(api_key=os.environ["AIQL_API_KEY"])

            chunks = client.sources.chunks("ing_9d2c", workspace_id="ws_3a1b")
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import { AiQL } from "@aiql.io/sdk";


            const client = new AiQL({ apiKey: process.env.AIQL_API_KEY });


            const chunks = await client.sources.chunks("ing_9d2c", {
            workspaceId: "ws_3a1b" });
components:
  schemas:
    Page_SourceChunk_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/SourceChunk'
          type: array
          title: Data
          description: Items in this page.
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
          description: >-
            Cursor to pass as `cursor` to fetch the next page. Null when there
            are no more items.
        has_more:
          type: boolean
          title: Has More
          description: Whether more items are available after this page.
          default: false
      type: object
      title: Page[SourceChunk]
    ErrorResponse:
      type: object
      title: ErrorResponse
      properties:
        detail:
          type: string
          title: Detail
      required:
        - detail
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SourceChunk:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the chunk.
        number:
          type: integer
          title: Number
          description: 1-indexed position of the chunk within the source document.
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: Text content of the chunk.
        pages:
          items:
            $ref: '#/components/schemas/ChunkPage'
          type: array
          title: Pages
          description: Pages the chunk was extracted from.
      type: object
      required:
        - id
        - number
      title: SourceChunk
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ChunkPage:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier of the page.
        number:
          type: integer
          title: Number
          description: 1-indexed page number within the source document.
      type: object
      required:
        - id
        - number
      title: ChunkPage
  securitySchemes:
    HTTPBearer:
      type: http
      description: API key passed as a Bearer token in the Authorization header.
      scheme: bearer

````