Skip to main content
POST
/
knowledge
/
add-file
curl -X POST https://api.thinnest.ai/knowledge/add-file \
  -H "Authorization: Bearer $THINNESTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "agent_id": "ag_c47e7c97_b2f2",
  "file": "(multipart file upload)"
}'
{
  "id": 3,
  "name": "document.pdf",
  "type": "file",
  "status": "processing",
  "created_at": "2026-03-07T14:00:00Z"
}
curl -X POST https://api.thinnest.ai/knowledge/add-file \
  -H "Authorization: Bearer $THINNESTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "agent_id": "ag_c47e7c97_b2f2",
  "file": "(multipart file upload)"
}'

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

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
file
file
required

Response

Successful Response