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

# upload knowledge group document

> Upload a document to a RAG group (Supports PDF, TXT, MD, DOCX, CSV up to 50MB). Authentication can be via API key (Bearer token) OR upload token (X-Upload-Token header).



## OpenAPI

````yaml https://api.anam.ai/swagger.json post /v1/knowledge/groups/{id}/documents
openapi: 3.1.0
info:
  title: Anam AI API
  version: '1.0'
servers:
  - url: https://api.anam.ai
    description: Anam API
security:
  - BearerAuth: []
tags:
  - name: Sessions
  - name: Personas
  - name: Avatars
  - name: Voices
  - name: LLMs
  - name: Knowledge
  - name: Tools
  - name: Share Links
paths:
  /v1/knowledge/groups/{id}/documents:
    post:
      tags:
        - Knowledge
      summary: upload knowledge group document
      description: >-
        Upload a document to a RAG group (Supports PDF, TXT, MD, DOCX, CSV up to
        50MB). Authentication can be via API key (Bearer token) OR upload token
        (X-Upload-Token header).
      operationId: uploadKnowledgeGroupDocument
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: Unique identifier of the knowledge group
      requestBody:
        description: >-
          Document file to upload into the knowledge group. Supported formats
          are PDF, TXT, MD, DOCX, and CSV, up to 50MB. Must be sent as
          `multipart/form-data`. Documents are processed asynchronously — the
          returned record starts in `PROCESSING` state and becomes searchable
          once it reaches `READY`.
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Document file (PDF, TXT, MD, DOCX, or CSV, max 50MB).
                chunkSize:
                  type: integer
                  default: 1000
                chunkOverlap:
                  type: integer
                  default: 200
      responses:
        '201':
          description: Successfully uploaded document
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeDocument'
              examples:
                default:
                  $ref: '#/components/examples/KnowledgeDocumentResponse'
        '400':
          description: Bad request - Invalid file or parameters
        '401':
          description: Unauthorized - Invalid or missing API key/upload token
        '404':
          description: RAG group not found
        '500':
          description: Server error
components:
  schemas:
    KnowledgeDocument:
      type: object
      description: >-
        A single file uploaded into a knowledge group. Retrieved chunks
        reference it by ID.
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the document.
        knowledgeFolderId:
          type: string
          format: uuid
          description: ID of the knowledge group this document belongs to.
        filename:
          type: string
          description: Original filename as uploaded.
        fileType:
          type: string
          description: MIME type or extension-derived file type.
        fileSize:
          type: integer
          description: Size of the file in bytes.
        fileUrl:
          type: string
          format: uri
          description: Internal URL at which the file is stored.
        status:
          type: string
          enum:
            - UPLOADED
            - PROCESSING
            - READY
            - FAILED
          description: Current processing state. Only `READY` documents are searchable.
        errorMessage:
          type:
            - string
            - 'null'
          description: Failure reason when `status` is `FAILED`, otherwise `null`.
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the document was uploaded.
        updatedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: Timestamp when the document record was last updated.
  examples:
    KnowledgeDocumentResponse:
      summary: A single knowledge document
      value:
        id: 00000000-0000-0000-0000-000000000000
        knowledgeFolderId: 00000000-0000-0000-0000-000000000000
        filename: getting-started.pdf
        fileType: application/pdf
        fileSize: 248320
        fileUrl: https://cdn.anam.ai/knowledge/getting-started.pdf
        status: READY
        errorMessage: null
        createdAt: '2026-04-20T10:00:00.000Z'
        updatedAt: '2026-04-20T10:01:12.000Z'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````