Skip to main content
POST
/
knowledge_bases
/
{knowledge_base_id}
/
documents
Upload a document into a knowledge base
curl --request POST \
  --url https://api.example.com/knowledge_bases/{knowledge_base_id}/documents \
  --header 'Content-Type: multipart/form-data' \
  --header 'x-user-id: <x-user-id>' \
  --form 'file=<string>' \
  --form 'content_type=<string>'
{
  "document_id": "<string>",
  "filename": "<string>"
}

Headers

x-user-id
string
required

Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.

Path Parameters

knowledge_base_id
string
required

The knowledge base id.

Body

multipart/form-data
file
string
required

The document to index (PDF, TXT, Markdown, …).

content_type
string | null

Override the IANA media type used to route the upload. Defaults to the type guessed from the filename.

Response

Successful Response

Response body after uploading a document into a knowledge base.

document_id
string
required

Server-assigned document identifier.

filename
string
required

The original filename of the uploaded document.

status
enum<string>
required

Lifecycle state immediately after upload — always 'pending' in the happy path; surfaced so the client can seed its progress tracker without an extra round-trip.

Available options:
pending,
parsing,
chunking,
indexing,
ready,
error