Upload knowledge base document
POST
/v1/knowledge-base/documents/upload
const url = 'https://api.varman.io/v1/knowledge-base/documents/upload';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"organizationId":"example","fileName":"rbac-matrix.xlsx","fileType":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","fileData":"example","s3Key":"example","description":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.varman.io/v1/knowledge-base/documents/upload \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "organizationId": "example", "fileName": "rbac-matrix.xlsx", "fileType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "fileData": "example", "s3Key": "example", "description": "example" }'Upload supporting documentation so Varman can process approved source material for questionnaire answers and policy workflows.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
organizationId
required
Organization ID that owns the document
string
fileName
required
File name
string
Example
rbac-matrix.xlsxfileType
required
MIME type of the file
string
Example
application/vnd.openxmlformats-officedocument.spreadsheetml.sheetfileData
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.
string
s3Key
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.
string
description
Optional description
string
Responses
Section titled “Responses”Document uploaded successfully