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

# Get a knowledge document by ID

> Retrieves a single document with its processing status, file name, size, and chunk count. Use this to check whether a recently uploaded document has finished indexing.



## OpenAPI

````yaml /openapi.json get /api/v1/knowledge-documents/{id}
openapi: 3.1.1
info:
  title: PromptJuggler
  description: PromptJuggler API
  version: 1.0.0
servers:
  - url: https://promptjuggler.com
security:
  - Bearer: []
tags:
  - name: Prompts
    description: Fetch prompts and revisions.
  - name: Prompt Runs
    description: Execute published prompts and retrieve results.
  - name: Workflow Runs
    description: Execute multi-step workflows and retrieve results.
  - name: Knowledge Bases
    description: Upload and manage documents used for retrieval-augmented generation.
paths:
  /api/v1/knowledge-documents/{id}:
    get:
      tags:
        - Knowledge Bases
      summary: Get a knowledge document by ID
      description: >-
        Retrieves a single document with its processing status, file name, size,
        and chunk count. Use this to check whether a recently uploaded document
        has finished indexing.
      operationId: public_get_document
      parameters:
        - name: id
          in: path
          description: Document ID
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Knowledge document
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeDocumentResponse'
        '401':
          description: Missing or invalid API key
        '403':
          description: No active subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Document not found
      x-codeSamples:
        - lang: PHP
          label: PromptJuggler PHP SDK
          source: $doc = $pj->getKnowledgeDocument('01J...');
        - lang: TypeScript
          label: PromptJuggler TypeScript SDK
          source: const doc = await pj.getKnowledgeDocument('01J...');
        - lang: Python
          label: PromptJuggler Python SDK
          source: doc = pj.get_knowledge_document('01J...')
        - lang: Java
          label: PromptJuggler Java SDK
          source: KnowledgeDocumentResponse doc = pj.getKnowledgeDocument("01J...");
        - lang: Go
          label: PromptJuggler Go SDK
          source: doc, err := pj.GetKnowledgeDocument(ctx, "01J...")
components:
  schemas:
    KnowledgeDocumentResponse:
      description: Knowledge document
      required:
        - id
        - status
        - fileName
        - bytes
        - chunkCount
      properties:
        id:
          description: Document ID
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/KnowledgeDocumentStatus'
          description: Processing status
        fileName:
          description: Original file name
          type: string
        bytes:
          description: File size in bytes
          type: integer
        chunkCount:
          description: Number of chunks extracted
          type: integer
      type: object
    ErrorResponse:
      description: Error response.
      required:
        - error
      properties:
        error:
          description: Error message.
          type: string
      type: object
    KnowledgeDocumentStatus:
      type: string
      enum:
        - pending
        - sealed
        - ready
        - failed
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````