Skip to content

Media

Upload a file once and send it by id, or download what customers send you.

Endpoints

Uploading

Send the file as the file field of a multipart/form-data request. The response is 201 with the media object. Uploading the exact same bytes again returns 200 with the existing object instead of a copy.

POST /v1/media
curl https://engage.swastik.ai/v1/media \
  -H "Authorization: Bearer $ENGAGE_API_KEY" \
  -F "file=@./brochure.pdf"
Response · 201
{
  "id": "6a1f0c2e-…",
  "kind": "document",
  "mime": "application/pdf",
  "size_bytes": 482113,
  "filename": "brochure.pdf",
  "direction": "out",
  "url": "/v1/media/6a1f0c2e-…/content",
  "created_at": "2026-11-11T10:30:00Z"
}

Then send it with { "type": "document", "document": { "media_id": "6a1f0c2e-…" } }.

KindFormatsMax size
imageJPEG, PNG5 MB
videoMP4, 3GPP (H.264 + AAC)16 MB
audioAAC, MP3, M4A, AMR, OGG (Opus)16 MB
documentPDF, DOC(X), XLS(X), PPT(X), TXT100 MB
stickerWebP500 KB

Downloading

Images, voice notes and documents that customers send arrive in message.received and are stored by Engage with direction: "in". Fetch the bytes with GET /v1/media/{id}/content and your API key — the url field is a path on the API host, not a public link.

Download
curl https://engage.swastik.ai/v1/media/6a1f0c2e-…/content \
  -H "Authorization: Bearer $ENGAGE_API_KEY" \
  -o brochure.pdf
Something unclear or missing on this page? Tell us at contact@swastik.ai