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

# Create Knowledge Base

> Create a knowledge base (document container for RAG).

Create a knowledge base (a container for documents used by RAG tools).

Required: `name` (unique per user). Optional: `description` (400 characters or fewer).

Then [upload documents](/api-reference/knowledge-bases/documents-create) and attach the knowledge base to a scenario with a `type: "rag"` function. See [Knowledge bases](/guides/knowledge-bases/overview).


## OpenAPI

````yaml openapi/akapulu.json POST /knowledge-bases/create
openapi: 3.1.0
info:
  title: Akapulu Labs API
  version: 1.0.0
  description: Public Akapulu Labs API reference.
servers:
  - url: https://akapulu.com/api
security:
  - bearerAuth: []
paths:
  /knowledge-bases/create:
    post:
      tags:
        - Knowledge bases
      summary: Create knowledge base
      description: Create a knowledge base (document container for RAG).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateKnowledgeBaseRequest'
            examples:
              default:
                value:
                  name: Product Docs
                  description: Main KB
      responses:
        '200':
          description: Knowledge base created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceMutationResponse'
              examples:
                success:
                  value:
                    status: created
                    id: 33333333-4444-5555-6666-777777777777
        '400':
          description: Invalid request payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                default:
                  value:
                    error: name is required
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                invalid_key:
                  value:
                    error: Invalid API key
components:
  schemas:
    CreateKnowledgeBaseRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
        description:
          type: string
          maxLength: 400
    ResourceMutationResponse:
      type: object
      required:
        - status
        - id
      properties:
        status:
          type: string
        id:
          type: string
          format: uuid
        redirect_url:
          type: string
          description: Dashboard path. Ignore for API clients.
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````