Skip to main content
POST
Create a knowledge base document from a file upload or text content. This triggers an asynchronous processing job to index the content.
This endpoint accepts multipart/form-data for file uploads. For text documents, you can use JSON.

Headers

string
required
Your API key for authentication.
string
required
The organization ID.

Permissions

  • kb:create (admin, agent_manager)

Request Body (Form Data)

string
required
The name of the document (1-200 characters).
file
The file to upload (e.g., PDF, DOCX, TXT). Required if text is not provided.
Max file size: 50MB
string
Raw text content. Required if file is not provided.
string
Optional agent ID to immediately attach this document to after creation.

Response

boolean
Indicates if the request was successful.
string
Human-readable success message.
object
Created document metadata.

Errors

object
Must provide either file or text, not both or neither.
object
Agent not found (if agent_id provided).