Media

Upload a file once, then send it by its media key.

Upload

Ask for a link with Create an upload link, then PUT the file to upload_url within 15 minutes, with the same Content-Type and Content-Length.

curl -X POST https://api.omnio.sawego.com/v1/media/uploads \
  -H "Authorization: Bearer $OMNIO_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"mime_type": "application/pdf", "size_bytes": 182044, "file_name": "receipt.pdf"}'

# then, with the upload_url from the answer
curl -X PUT "$UPLOAD_URL" \
  -H "Content-Type: application/pdf" \
  --data-binary @receipt.pdf

Send

A media message needs an open window, like a text.

{
  "conversation_id": "b1c7e0a4-52a3-4a3c-8d0e-6c1b9e5f7a20",
  "type": "document",
  "content": { "media_key": "5f3e2b1c/uploads/2026/10/3c5e7a90.pdf", "caption": "Your receipt", "file_name": "receipt.pdf" }
}

caption works on image, video and document, and file_name on document only. A file that does not suit the type is 422 media_invalid.

Types and sizes

KindTypesLargest
imageJPEG, PNG5 MB
videoMP4, 3GPP16 MB
audioAAC, AMR, MP3, MP4, OGG, WebM16 MB
documentPDF, plain text, Word, Excel, PowerPoint100 MB
stickerWebP500 KB

Download

Each message lists its files in attachments. Get a file link answers with a link valid for 15 minutes, as a redirect or as JSON with format=json. Add download=1 to save the file under its name.

NextAPI reference