Download Endpoint
GET /media?path={media_path}
Internal Onebrick engineer flow is device_id-only and auth is handled by Mantul services.
Path Validation Rules
- Use
media_pathexactly as returned by webhook payload. - Path is app-scoped and validated by server before file access.
- Invalid, tampered, or cross-app path returns authorization/validation error.
What the Endpoint Returns
- Binary stream with correct
Content-Typewhen recognizable. Content-DispositionandContent-Lengthare provided.
Customer Support Recovery Notes
- Inbound media is downloaded only when the estimated and final size are within
MEDIA_MAX_BYTES, currently 64 MiB by default. - Downstream Chatwoot repair requires a webhook
media_path,media_url, or attachment object that points at the stored binary. - If an older gateway skipped a large file before download, webhook metadata such as caption, MIME type, and byte size can identify the missing attachment but cannot recreate a playable file. Recover the original binary or ask the sender to resend it after the current limit is deployed.
Production Curl Example
curl -L "https://wa.onebrick.io/media?path=media/{app_id}/{device_id}-{message_id}.jpg" \
-o attachment.bin