Skip to main content
POST
/
serve
/
api
/
v1
/
download
Download Video
curl --request POST \
  --url https://api.memories.ai/serve/api/v1/download \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "video_no": "VI625239098370850816",
  "unique_id": "default"
}
'
"<string>"

Overview

The Download Video API returns the raw video file for a given video_no in your private library. Successful downloads return a binary stream (application/octet-stream). If the response is JSON, it indicates that the download did not succeed (e.g., the video is not ready, not found, or the request is invalid).

Host URL

https://api.memories.ai

Endpoint

POST /serve/api/v1/download
/serve/api/v1/download

Authentication

Include your API key in the Authorization header.
Authorization: <YOUR_API_KEY>

Request

Content-Type: application/json
{
  "video_no": "VI625239098370850816",
  "unique_id": "default"
}

Python Example

import requests

headers = {"Authorization": "sk-test"}
payload = { 
    "unique_id": "test", 
    "video_no": "VI625239098370850816"
}
url = "https://api.memories.ai/serve/api/v1/download"

# stream=True enables chunked download
resp = requests.post(url, json=payload, headers=headers, stream=True)
print("Status:", resp.status_code)

content_type = resp.headers.get("Content-Type", "")

if "application/json" in content_type.lower(): 
    # JSON means the download did not succeed; inspect the error payload 
    print(resp.json())
else: 
    # Binary stream (video) 
    with open("video.mp4", "wb") as f: 
        for chunk in resp.iter_content(chunk_size=8192): 
            if chunk: 
                f.write(chunk) 
    print("Download complete")

cURL Example

curl -X POST "https://api.memories.ai/serve/api/v1/download" \
  -H "Authorization: sk-test" \
  -H "Content-Type: application/json" \
  -d '{"video_no":"VI625239098370850816","unique_id":"test"}' \
  --output video.mp4

Successful Response

On success, the server returns the video file as a binary stream:
  • Status: 200
  • Content-Type: application/octet-stream
  • Body: Binary content of the video

Error Response (JSON)

If the download cannot be fulfilled, a JSON payload is returned instead.
{ 
    "code": "0001", 
    "msg": "video not found", 
    "data": null, 
    "failed": true, 
    "success": false
}

Tips

  • Stream downloads: Always use stream=True (Python) to avoid loading the entire file into memory.
  • Scopes: If you organize content by unique_id, include it for correct scoping.

Authorizations

Authorization
string
header
required

Body

application/json
video_no
string
required
Example:

"VI625239098370850816"

unique_id
string
default:default

Response

Binary video stream or JSON error response

The response is of type file.