Upload an attachment
Returns a short-lived presigned S3 POST (expires in 5 minutes / 300 seconds). Submit a multipart/form-data request to uploadUrl with every fields entry followed by the file field last; the Content-Type you send must match the one in fields, and S3 enforces the size limit server-side. Then reference the returned fileUrl/metadata in the attachments array of a reply or conversation message. Supported types and max sizes: images png/jpg/jpeg/webp (10 MB), documents pdf/docx/xlsx/pptx (25 MB), text txt/csv (25 MB), video mp4/3gpp/webm/mpeg (50 MB), audio mp3/wav/ogg/mpeg (50 MB). Other types — including svg, html and javascript — are rejected.
Overview
Attachments are not uploaded through this API directly. Instead you exchange the file’s metadata for a short-lived, pre-signed Amazon S3 upload, push the file straight to S3, and then reference the returned URL when you send a message. This keeps large files off our servers and lets uploads scale. The flow has three steps:Request a pre-signed upload
mimeType, size and a fileName. You
get back an uploadUrl, a set of fields, and the final fileUrl. The
conversation’s chatbot is resolved server-side from the conversationId —
you don’t pass a chatbotId.Upload the file to S3
multipart/form-data POST to uploadUrl containing every entry in
fields first, then the file last.Send the message
attachments array that references the fileUrl and metadata.conversationId is validated against
your workspace, so you can only upload into your own conversations.Step 1 — Request a pre-signed upload
Step 2 — Upload the file to S3
POST the file touploadUrl as multipart/form-data. Append every key from
fields in order, then append the file field last — S3 ignores any field
that comes after file.
204 No Content. The Content-Type you send must
match the Content-Type in fields, and the file size must be within the
per-category limit — S3 rejects the upload
otherwise, even if step 1 succeeded.
Step 3 — Send the message with the attachment
Reference thefileUrl and metadata in the attachments array. The message type
is resolved automatically (a single image → IMAGE, anything else → FILE).
id and a resolved
category (image | video | audio | doc | text).
Allowed types and size limits
Only the MIME types below are accepted. Anything else — includingimage/svg+xml,
text/html, and JavaScript types — is rejected for security.
| Category | MIME types | Max size |
|---|---|---|
image | image/png, image/jpg, image/jpeg, image/webp | 10 MB |
doc | application/pdf, .docx, .xlsx, .pptx (Office Open XML) | 25 MB |
text | text/plain, text/csv | 25 MB |
video | video/mp4, video/3gpp, video/webm, video/mpeg | 50 MB |
audio | audio/mp3, audio/mpeg, audio/wav, audio/x-wav, audio/ogg | 50 MB |
Errors
| Status | When |
|---|---|
400 | Missing fileName/mimeType/size, an unsupported MIME type, or a file larger than the category limit. |
401 | Missing or invalid API key. |
404 | The conversation does not exist or does not belong to your workspace. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier of the conversation the attachment belongs to
"chat_1234567890"

