Upload file

POST/api/bot/upload

Upload a file and attach it to a chat as a message. Files are stored in S3 and served via signed URLs.

Request body

ParameterTypeDescription
chatId*stringTarget chat ID
file*fileFile binary or base64-encoded content
filenamestringOriginal filename (e.g. invoice.pdf)
contentTypestringMIME type of the file (e.g. image/png)

Supported file types

Content typeMax size
image/*10 MB
application/pdf25 MB
text/*5 MB

Example request

terminal
curl -X POST https://app.bx-livechat.com/api/bot/upload \
  -H "Authorization: Bearer bxl_pat_aB7XyZ..." \
  -F "chatId=clxyz1234567890abc" \
  -F "file=@/path/to/screenshot.png" \
  -F "filename=screenshot.png" \
  -F "contentType=image/png"

Response

200 OK
{
  "messageId": "clxyz0987654321def",
  "fileUrl": "https://s3.amazonaws.com/bxlivechat/org_abc/clxyz.../screenshot.png?X-Amz-Signature=..."
}
Pre-validation
Files are validated for type and size before upload. Rejected files return 400 with a clear error message.