---
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

## Changes

> 56 revisions in range; 4 could not be searched.

- **2026-06-05** `33c685841b7a` — 3 breaking, 3 info
  - added the new required request property `fileName`
  - added the new required request property `fileType`
  - added the new required request property `organizationId`
  - added the new optional request property `description`
  - …2 more
- **2026-06-05** `7ca7c363a732` — 6 warning
  - removed the request property `description`
  - removed the request property `fileData`
  - removed the request property `fileName`
  - removed the request property `fileType`
  - …2 more
- **2026-06-05** `d0f58f24175b` — 3 breaking, 3 info
  - added the new required request property `fileName`
  - added the new required request property `fileType`
  - added the new required request property `organizationId`
  - added the new optional request property `description`
  - …2 more
- **2026-06-04** `d7d0199d846f` — 1 info
  - the endpoint scheme security `oauth2` was removed from the API
- **2026-05-29** `5382c53ab431` — 1 info
  - the endpoint scheme security `oauth2` was added to the API

[Change history](https://skmtc.dev/trycompai/apis/comp-ai-api/changes/v1/knowledge-base/documents/upload/post.md)

---

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