Media
Sending and receiving media
Upload the file first, then send a message that refers to it. Uploads go straight to storage over a short-lived URL.
# 1. Ask for an upload URL
curl https://api.quic.chat/platform/v1/media \
-H "Authorization: Bearer $QUIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "fileName": "invoice-1042.pdf", "mimeType": "application/pdf", "size": 48213 }'
# 2. PUT the bytes to upload.url with upload.headers (within 15 minutes)
curl -X PUT "$UPLOAD_URL" -H "Content-Type: application/pdf" --data-binary @invoice-1042.pdf
# 3. Send it
curl https://api.quic.chat/platform/v1/messages \
-H "Authorization: Bearer $QUIC_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{ "to": { "appUserId": "u_4f9XkQ2bT7mN1pR8sV0wYz" }, "type": "file", "mediaId": "<media.id from step 1>", "text": "Your invoice" }'Uploading#
POST /mediawithfileName,mimeTypeandsize(bytes). You getmedia.idand anuploadobject with a URL, methodPUTand headers.- PUT the exact bytes to that URL with those headers within 15 minutes.
- Send with
typematching the file andmediaId. If the upload hasn't finished you get 409media_not_uploaded; if the bytes don't match what you declared, 422media_invalid.
Types and limits#
| Kind | MIME types | Max size |
|---|---|---|
| Image | image/jpeg, image/png, image/webp, image/gif | 16 MB |
| Video | video/mp4, video/3gpp, video/quicktime | 16 MB |
| Audio | audio/mpeg, audio/mp4, audio/aac, audio/ogg, audio/amr | 16 MB |
| Document | PDF, plain text, CSV, Word, Excel, PowerPoint | 100 MB |
SVG, HTML, executables and archives are refused (415 unsupported_media_type). Each app can create up to 100 uploads per hour.
Media users send you#
message.received events list attachments as media[] with an id. Call GET /media/:id for a download URL that is valid for one hour; fetch a fresh one when it expires.