Messages
Upload an attachment to R2 storage (tiered auth)
Upload a single message attachment to R2 storage. Accepts authenticated agent uploads or unauthenticated webchat uploads gated by a valid webchatConfigId. Returns the storage key plus content metadata for inclusion in a subsequent send-message call.
Request Body
multipart/form-data
TypeScript Definitions
Use the request body type in TypeScript.
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.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/messages/upload-attachment" \ -F file="<binary: receipt.png>" \ -F webchatConfigId="64a1b2c3d4e5f60012345678"{ "success": true, "attachment": { "storageKey": "messages/65a0e0e0e0e0e0e0e0e0e0e0/msg_67b0/photo.jpg", "filename": "photo.jpg", "contentType": "image/jpeg", "size": 184221 }}