API reference
Upload
POST /v1/agents/upload
View as MarkdownUploads one file so a message can attach it. The body is the raw file; the name travels in a header.
Request
bash
curl -s "$SAI_API_URL/v1/agents/upload" \
-H "Authorization: Bearer $SAI_API_KEY" \
-H "x-filename: report.pdf" \
--data-binary @./report.pdfThe Content-Type header is ignored. Maximum size is 25 MB.
Response
json
{
"path": "uploads/report-1790000000000.pdf",
"name": "report-1790000000000.pdf",
"mime": "application/pdf",
"size": 48213,
"fileId": "f_3kd9"
}Pass this object unchanged as one entry of attachments on POST /message.
Recognised extensions
.txt .md .json .js .ts .py .sh .bash .yaml .yml .csv .html .xml .pdf .png .jpg .jpeg .gif .webp .sim
Anything else is stored as application/octet-stream.
Errors
Gotchas
- The returned
namecan differ from the one you sent: unsafe characters are replaced and a timestamp is appended. - One file per call. Loop for several.
- Use
--data-binary, not-d, so curl does not strip newlines.