This endpoint directly downloads the file to your local storage when successful. When you call this endpoint successfully, the browser will automatically download the file (video, image, etc.) directly to your computer’s download folder. The 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
Key Points:
  • 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

# Download file stream and save to local storage
# Use -O -J to automatically use filename from Content-Disposition header
curl --request GET \
  --url https://mavi-backend.memories.ai/serve/api/v2/re_657739295220518912/download \
  --header 'Authorization: sk-8483027fe3abfe535f6ae01a9979b4f7' \
  --remote-name \
  --remote-header-name

# -O (--remote-name): Save file with remote filename
# --remote-header-name: Use filename from Content-Disposition header
# File will be saved with the original filename and format from the server

Path Parameters

ParameterTypeRequiredDescription
asset_idstringYesThe 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
⚠️ Important:
  • USE response.blob() (JavaScript) or stream=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!
Error Response Returns JSON with error information. Error Response Parameters:
ParameterTypeDescription
codestringError code indicating the type of error
msgstringError message describing what went wrong
datanullError data (usually null)
successbooleanAlways false for errors
failedbooleanAlways true for errors

Response Parameters

ParameterTypeDescription
Response Bodybinary streamThe 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-Disposition header
  • 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