---
title: "Upload knowledge base document"
method: POST
path: "/v1/knowledge-base/documents/upload"
tags: ["Knowledge Base"]
---

# Upload knowledge base document

`POST /v1/knowledge-base/documents/upload`

Upload supporting documentation so Comp AI can process approved source material for questionnaire answers and policy workflows.

## Request body

- UploadDocumentDto
  - `organizationId` string, required — Organization ID that owns the document
  - `fileName` string, required — File name
  - `fileType` string, required — MIME type of the file
  - `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

---

[API](https://skmtc.net/trycompai/apis/comp-ai-api.md) · [All operations](https://skmtc.net/trycompai/apis/comp-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/trycompai/comp-ai-api/revisions/726b9523fb22/schema)
