Content-Disposition: attachment header tells the browser to save the file locally.
Response Behavior:
- ✅ **Success **: Returns file stream (binary data) - browser automatically downloads to local storage
- ❌ **Error **: Returns JSON error - use
json()to parse error message
- Success response is a file (binary data), NOT JSON
- Browser automatically downloads the file to your local storage
- Error response is JSON with error details
- Check response status before deciding how to handle the response
Code Examples
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| asset_id | string | Yes | The unique identifier of the asset to download (e.g., “re_657739295220518912”) |
Response
Success Response (200 OK): Returns the file directly as a binary stream. The response body contains the actual file content (video, image, document, etc.). Response Type:application/octet-stream (binary file stream)
Response Headers:
Content-Type: The MIME type of the file (e.g.,video/mp4,image/jpeg)Content-Disposition: Attachment header with the original filename (e.g.,attachment; filename="video.mp4")Content-Length: File size in bytes
- ✅ USE
response.blob()(JavaScript) orstream=True(Python) to handle the file - ✅ The response is the actual file content, not JSON
- ❌ DO NOT use
response.json()on success - this will cause errors!
| Parameter | Type | Description |
|---|---|---|
| code | string | Error code indicating the type of error |
| msg | string | Error message describing what went wrong |
| data | null | Error data (usually null) |
| success | boolean | Always false for errors |
| failed | boolean | Always true for errors |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| Response Body | binary stream | The file content as a binary stream - must be saved to a file |
Notes
- Direct file download: The response is a binary file stream that should be saved directly to local storage
- Streaming: Files are streamed for efficient transfer of large files without loading entire file into memory
- Filename: The original filename is included in the
Content-Dispositionheader - Memory efficient: Use stream processing (as shown in examples) to handle large files efficiently
- No JSON response: Unlike other endpoints, this returns binary data, not JSON