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)"
}'
import requests
url = "https://api.thinnest.ai/knowledge/add-file"
headers = {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
}
payload = {
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch("https://api.thinnest.ai/knowledge/add-file", {
method: "POST",
headers: {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}),
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}`)
req, _ := http.NewRequest("POST", "https://api.thinnest.ai/knowledge/add-file", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"id": 3,
"name": "document.pdf",
"type": "file",
"status": "processing",
"created_at": "2026-03-07T14:00:00Z"
}
Knowledge
Add File
Upload a document file to an agent’s knowledge base.
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)"
}'
import requests
url = "https://api.thinnest.ai/knowledge/add-file"
headers = {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
}
payload = {
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch("https://api.thinnest.ai/knowledge/add-file", {
method: "POST",
headers: {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}),
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}`)
req, _ := http.NewRequest("POST", "https://api.thinnest.ai/knowledge/add-file", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"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)"
}'
import requests
url = "https://api.thinnest.ai/knowledge/add-file"
headers = {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
}
payload = {
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const response = await fetch("https://api.thinnest.ai/knowledge/add-file", {
method: "POST",
headers: {
"Authorization": "Bearer " + "YOUR_THINNESTAI_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}),
});
const data = await response.json();
console.log(data);
package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{
"agent_id": "ag_c47e7c97_b2f2",
"file": "(multipart file upload)"
}`)
req, _ := http.NewRequest("POST", "https://api.thinnest.ai/knowledge/add-file", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer YOUR_THINNESTAI_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Request
This endpoint usesmultipart/form-data for file uploads.
Form Fields
| Field | Type | Required | Description |
|---|---|---|---|
agent_id | string | Yes | The agent’s public ID (ag_*) |
file | file | Yes | The file to upload |
Supported Formats
| Format | Extensions | Max Size |
|---|---|---|
.pdf | 50 MB | |
| Word | .docx, .doc | 50 MB |
| Text | .txt | 10 MB |
| Markdown | .md | 10 MB |
| CSV | .csv | 50 MB |
| Excel | .xlsx, .xls | 50 MB |
| JSON | .json | 10 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"
}
Errors
| Code | Description |
|---|---|
401 | Missing or invalid authentication |
404 | Agent not found |
413 | File too large |
415 | Unsupported file type |
⌘I

