Skip to main content
POST
/
api
/
messages
/
upload-attachment
Upload an attachment to R2 storage (tiered auth)
curl --request POST \
  --url https://your-instance.example.com/api/messages/upload-attachment \
  --header 'Content-Type: multipart/form-data' \
  --form file='@example-file' \
  --form webchatConfigId=64a1b2c3d4e5f60012345678
{
  "success": true,
  "attachment": {
    "storageKey": "messages/65a0e0e0e0e0e0e0e0e0e0e0/msg_67b0/photo.jpg",
    "filename": "photo.jpg",
    "contentType": "image/jpeg",
    "size": 184221
  }
}

Body

multipart/form-data

Multipart form. Send the file as a file part; for unauthenticated webchat uploads also include webchatConfigId. Example with curl: curl -F "file=@receipt.png" -H "Authorization: Bearer $TOKEN" /api/messages/upload-attachment.

file
file
required

A single binary attachment (image, video, PDF). Max 50 MB.

webchatConfigId
string

Required when the caller is the webchat widget (no JWT/API-key). Validated against the org's active webchat configurations to gate unauthenticated uploads.

Response

Attachment uploaded

success
boolean
attachment
object