Add File

Upload a document file to an agent's knowledge base.

POST/knowledge/add-file

Upload a file (PDF, DOCX, TXT, etc.) to be processed and added to the knowledge base.

No parameters for this endpoint.


Request

This endpoint uses multipart/form-data for file uploads.

Form Fields

FieldTypeRequiredDescription
agent_idstringYesThe agent's public ID (ag_*)
filefileYesThe file to upload

Supported Formats

FormatExtensionsMax Size
PDF.pdf50 MB
Word.docx, .doc50 MB
Text.txt10 MB
Markdown.md10 MB
CSV.csv50 MB
Excel.xlsx, .xls50 MB
JSON.json10 MB

cURL Example

curl -X POST https://api.thinnest.ai/knowledge/add-file \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "agent_id=ag_c47e7c97_b2f2" \
  -F "file=@/path/to/document.pdf"

Response 201

{
  "id": 3,
  "name": "document.pdf",
  "type": "file",
  "status": "processing",
  "created_at": "2026-03-07T14:00:00Z"
}

The file is processed asynchronously. Check status via List Sources.


Errors

CodeDescription
401Missing or invalid authentication
404Agent not found
413File too large
415Unsupported file type

On this page