Skip to main content
POST
/
v1
/
knowledge-base
/
documents
/
upload
Upload knowledge base document
curl --request POST \
  --url https://api.trycomp.ai/v1/knowledge-base/documents/upload \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "organizationId": "<string>",
  "fileName": "rbac-matrix.xlsx",
  "fileType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
}
'

Authorizations

X-API-Key
string
header
required

API key for authentication

Body

application/json
organizationId
string
required

Organization ID that owns the document

fileName
string
required

File name

Example:

"rbac-matrix.xlsx"

fileType
string
required

MIME type of the file

Example:

"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

fileData
string

Base64-encoded file contents. For the web UI / direct callers. AI/MCP clients should instead upload via /v1/uploads/presign (purpose=document) and pass s3Key — base64 through an LLM is impractically slow and times out. Provide exactly one of fileData or s3Key.

s3Key
string

Key of a file already uploaded via /v1/uploads/presign (purpose=document). The server fetches the bytes from storage — no base64 needed. Provide exactly one of fileData or s3Key.

description
string

Optional description

Response

200

Document uploaded successfully