Knowledge

upload knowledge group document

Changed on

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

post/v1/knowledge/groups/{id}/documents

Request

  • Base URL
    https://api.anam.ai
  • URL
    https://api.anam.ai/v1/knowledge/groups/{id}/documents
  • Auth
    HTTP bearer

Path parameters

idstring required

Unique identifier of the knowledge group

Request body multipart/form-data

filestring binary required

Document file (PDF, TXT, MD, DOCX, CSV, or JSON, max 50MB).

chunkSizeinteger

Maximum tokens per chunk for this document. Defaults to the group's chunkSize, or the default of 350 when the group has none. Setting chunkSize or chunkOverlap overrides the group's settings for this document. JSON files ignore chunk settings; they are kept whole up to 2000 tokens, and larger files are split at 1000 tokens with 50 overlap.

chunkOverlapinteger

Token overlap between chunks for this document. Must be at most half of chunkSize, or at most 175 when chunkSize is not set. Defaults to the group's chunkOverlap, or the default of 0 when the group has none. If you set only chunkSize, overlap is the default of 0 rather than the group's value.

Response

Successfully uploaded document

idstring uuid

Unique identifier for the document.

knowledgeFolderIdstring uuid

ID of the knowledge group this document belongs to.

filenamestring

Original filename as uploaded.

fileTypestring

MIME type or extension-derived file type.

fileSizeinteger

Size of the file in bytes.

fileUrlstring uri

Internal URL at which the file is stored.

status'UPLOADED' | 'PROCESSING' | 'READY' | 'FAILED'

Current processing state. Only READY documents are searchable.

errorMessagestring nullable

Failure reason when status is FAILED, otherwise null.

chunkSizeinteger nullable

Chunk size override set at upload, in tokens; null when not overridden. When both chunkSize and chunkOverlap are null, the document uses its group's settings. When only chunkOverlap is set, a null chunkSize means the default of 350.

chunkOverlapinteger nullable

Chunk overlap override set at upload, in tokens; null when not overridden. When both chunkSize and chunkOverlap are null, the document uses its group's settings. When only chunkSize is set, a null chunkOverlap means the default of 0.

createdAtstring date-time

Timestamp when the document was uploaded.

updatedAtstring date-time nullable

Timestamp when the document record was last updated.

Changes

    • info

      added the non-success response with the status

    • warning

      the request property's max was set to 1000.00

    • warning

      the request property's max was set to 2000.00

    • warning

      the request property's min was set to 0.00

    • warning

      the request property's min was set to 100.00

    • info

      the request property default value 200 was removed

    • info

      the request property default value 1000 was removed

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status

    • info

      added the optional property to the response with the status