POST
/ai/chats/uploadUpload a file to attach to a chat message
Uploads a file to attach to an AI chat message. Supply the file in file and optionally use chatId to attach it to an existing chat; omit chatId to upload before the chat exists. Requests are limited to 25 per minute per user.
- IdempotentThe SDK sends
Idempotency-Key, so a retried request is only applied once.
Multipart form data containing a file and, optionally, the chat to attach it to.
chatIdstringoptional
Chat to attach the file to. Omit to upload before the chat exists.
filestringrequired
File to attach. Subject to the server's upload size limit.
200Returns the uploaded attachment in the response payload.
dataunknownoptional
Response payload
statusintegeroptional
successbooleanoptional
400Returned when the upload fails, the file is too large, or the chat ID is invalid.
errorstringoptional
Reason phrase, for example `Bad Request`.
messagestringoptional
statusCodeintegeroptional
429Returned when the user exceeds the limit of 25 requests per minute.
errorstringoptional
Reason phrase, for example `Bad Request`.
messagestringoptional
statusCodeintegeroptional
Error handling
A 400 is returned when the upload fails, the file exceeds the server's upload size limit, or chatId is invalid. A 429 is returned when you exceed the limit of 25 requests per minute per user.