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

> ## Agent Instructions
> For AgentScope Python, use https://docs.agentscope.io/stable/en/index for new projects. For existing projects, check the installed agentscope version and use matching versioned documentation.
> The /latest/ alias points to development documentation. Use it only with the matching development source. Do not mix AgentScope 1.x and 2.x APIs.
> State the AgentScope version when providing installation commands or code examples. ReMe uses its own continuously updated /reme/latest/ documentation.

# Browse one document's chunks in order

> Return one page of a document's chunks, ``chunk_index`` ascending.

Pagination is stable: ``chunk_index`` is a dense, immutable
``0..N-1`` sequence within a document, so page ``N`` always maps to
the same chunk range.  A document that is still indexing serves
the chunks persisted so far.

Args:
    knowledge_base_id (`str`):
        The parent knowledge base.
    document_id (`str`):
        The document whose chunks should be listed.
    page (`int`, defaults to ``1``):
        1-based page number.
    page_size (`int`, defaults to ``30``):
        Chunks per page (max 128).
    user_id (`str`):
        Injected authenticated user ID.
    service (`KnowledgeBaseService`):
        Injected knowledge base service.

Returns:
    `ListDocumentChunksResponse`:
        The page of chunks plus the document's total chunk count.



## OpenAPI

````yaml /en/versions/2.0.9/deploy/openapi.json get /knowledge_bases/{knowledge_base_id}/documents/{document_id}/chunks
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.9
servers: []
security: []
paths:
  /knowledge_bases/{knowledge_base_id}/documents/{document_id}/chunks:
    get:
      tags:
        - knowledge_bases
      summary: Browse one document's chunks in order
      description: |-
        Return one page of a document's chunks, ``chunk_index`` ascending.

        Pagination is stable: ``chunk_index`` is a dense, immutable
        ``0..N-1`` sequence within a document, so page ``N`` always maps to
        the same chunk range.  A document that is still indexing serves
        the chunks persisted so far.

        Args:
            knowledge_base_id (`str`):
                The parent knowledge base.
            document_id (`str`):
                The document whose chunks should be listed.
            page (`int`, defaults to ``1``):
                1-based page number.
            page_size (`int`, defaults to ``30``):
                Chunks per page (max 128).
            user_id (`str`):
                Injected authenticated user ID.
            service (`KnowledgeBaseService`):
                Injected knowledge base service.

        Returns:
            `ListDocumentChunksResponse`:
                The page of chunks plus the document's total chunk count.
      operationId: >-
        list_document_chunks_knowledge_bases__knowledge_base_id__documents__document_id__chunks_get
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            type: string
            description: The knowledge base id.
            title: Knowledge Base Id
          description: The knowledge base id.
        - name: document_id
          in: path
          required: true
          schema:
            type: string
            description: The document id.
            title: Document Id
          description: The document id.
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            description: 1-based page number.
            default: 1
            title: Page
          description: 1-based page number.
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            maximum: 128
            minimum: 1
            default: 30
            title: Page Size
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListDocumentChunksResponse'
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ListDocumentChunksResponse:
      properties:
        chunks:
          items:
            $ref: '#/components/schemas/Chunk'
          type: array
          title: Chunks
          description: The requested page of chunks, ordered by ``chunk_index`` ascending.
        total:
          type: integer
          title: Total
          description: >-
            Total number of chunks indexed for this document, taken from the
            document record. ``0`` while the document is still being indexed.
        page:
          type: integer
          title: Page
          description: The 1-based page number served.
        page_size:
          type: integer
          title: Page Size
          description: The page size used.
      type: object
      required:
        - chunks
        - total
        - page
        - page_size
      title: ListDocumentChunksResponse
      description: Response body for browsing one document's chunks page by page.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Chunk:
      properties:
        content:
          anyOf:
            - $ref: '#/components/schemas/TextBlock'
            - $ref: '#/components/schemas/DataBlock'
          title: Content
        source:
          type: string
          title: Source
        chunk_index:
          type: integer
          title: Chunk Index
        total_chunks:
          type: integer
          title: Total Chunks
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
      type: object
      required:
        - content
        - source
        - chunk_index
        - total_chunks
      title: Chunk
      description: |-
        A final indexable chunk produced by a :class:`ChunkerBase`.

        Each ``Chunk`` corresponds to one record in the vector store.
        The required structural fields (``source``, ``chunk_index``,
        ``total_chunks``) enable downstream features such as "expand
        context around a hit" during retrieval.
    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
    TextBlock:
      properties:
        type:
          type: string
          const: text
          title: Type
          default: text
        text:
          type: string
          title: Text
        id:
          type: string
          title: Id
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - text
      title: TextBlock
      description: The text block.
    DataBlock:
      properties:
        type:
          type: string
          const: data
          title: Type
          default: data
        id:
          type: string
          title: Id
        source:
          anyOf:
            - $ref: '#/components/schemas/Base64Source'
            - $ref: '#/components/schemas/URLSource'
          title: Source
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - source
      title: DataBlock
      description: The data block for binary content (images, audio, video, etc.).
    Base64Source:
      properties:
        type:
          type: string
          const: base64
          title: Type
          default: base64
        data:
          type: string
          title: Data
        media_type:
          type: string
          title: Media Type
      type: object
      required:
        - data
        - media_type
      title: Base64Source
      description: The base64 source.
    URLSource:
      properties:
        type:
          type: string
          const: url
          title: Type
          default: url
        url:
          type: string
          minLength: 1
          format: uri
          title: Url
        media_type:
          type: string
          title: Media Type
      type: object
      required:
        - url
        - media_type
      title: URLSource
      description: The URL source.

````