> ## 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 base by slug

> Retrieves a knowledge base with its processing status, document count, chunk count, and a list of all documents. Use this to verify that uploaded documents have finished indexing before relying on them in prompts.



## OpenAPI

````yaml /openapi.json get /api/v1/knowledge-bases/{slug}
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-bases/{slug}:
    get:
      tags:
        - Knowledge Bases
      summary: Get a knowledge base by slug
      description: >-
        Retrieves a knowledge base with its processing status, document count,
        chunk count, and a list of all documents. Use this to verify that
        uploaded documents have finished indexing before relying on them in
        prompts.
      operationId: public_get_knowledge_base
      parameters:
        - name: slug
          in: path
          description: Knowledge base handle
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Knowledge base with documents
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseResponse'
        '401':
          description: Missing or invalid API key
        '403':
          description: No active subscription
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Knowledge base not found
      x-codeSamples:
        - lang: PHP
          label: PromptJuggler PHP SDK
          source: $kb = $pj->getKnowledgeBase('product-docs');
        - lang: TypeScript
          label: PromptJuggler TypeScript SDK
          source: const kb = await pj.getKnowledgeBase('product-docs');
        - lang: Python
          label: PromptJuggler Python SDK
          source: kb = pj.get_knowledge_base('product-docs')
        - lang: Java
          label: PromptJuggler Java SDK
          source: KnowledgeBaseResponse kb = pj.getKnowledgeBase("product-docs");
        - lang: Go
          label: PromptJuggler Go SDK
          source: kb, err := pj.GetKnowledgeBase(ctx, "product-docs")
components:
  schemas:
    KnowledgeBaseResponse:
      description: Knowledge base with documents
      required:
        - id
        - status
        - documentCount
        - chunkCount
        - documents
      properties:
        id:
          description: Knowledge base ID
          type: string
          format: uuid
        status:
          $ref: '#/components/schemas/KnowledgeBaseStatus'
          description: Processing status
        documentCount:
          description: Total number of documents
          type: integer
        chunkCount:
          description: Total number of chunks across all documents
          type: integer
        documents:
          type: array
          items:
            $ref: '#/components/schemas/KnowledgeDocumentSummary'
      type: object
    ErrorResponse:
      description: Error response.
      required:
        - error
      properties:
        error:
          description: Error message.
          type: string
      type: object
    KnowledgeBaseStatus:
      type: string
      enum:
        - pending
        - ready
        - failed
    KnowledgeDocumentSummary:
      description: Knowledge document summary (without counts)
      required:
        - id
        - status
        - fileName
        - bytes
        - mimeType
      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
        mimeType:
          description: MIME type
          type: string
      type: object
    KnowledgeDocumentStatus:
      type: string
      enum:
        - pending
        - sealed
        - ready
        - failed
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````