Documentation Index
Fetch the complete documentation index at: https://api-tools.memories.ai/llms.txt
Use this file to discover all available pages before exploring further.
Product: Visual Search
Use case: Upload videos and images, auto-index them, then search by natural language, image, or transcript phrase
Host: https://api.memories.ai/serve/api/v1
Auth: Authorization: sk-mavi-... (no Bearer prefix)
Download the original video file for a given video in your Private Video Library. Returns a binary stream on success.
Prerequisites
Endpoint
POST /serve/api/v1/download
Authentication
Include your API key in the Authorization header.
Authorization: sk-mavi-...
Request
Content-Type: application/json
{
"video_no": "VI625239098370850816",
"unique_id": "default"
}
Request Parameters
The video identifier to download.
Scope identifier for the authenticated account. Must match the unique_id used at upload time.
Python Example
import requests
headers = {"Authorization": "sk-mavi-..."}
payload = {
"unique_id": "default",
"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-mavi-..." \
-H "Content-Type: application/json" \
-d '{"video_no":"VI625239098370850816","unique_id":"default"}' \
--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 (mp4 — the first bytes are an
ftyp ISO-BMFF box)
The download uses HTTP chunked transfer encoding, so Content-Length is typically absent. Don’t use it for progress reporting; rely on iter_content chunk counts instead.
Error Response (JSON)
If the download cannot be fulfilled, a JSON payload is returned instead — same HTTP status (200) but Content-Type: application/json. The Python and cURL examples above already branch on the response content type.
Unknown or wrong-namespace video_no:
{
"code": "0001",
"msg": "download video error",
"data": null,
"success": false,
"failed": true
}
Missing video_no in the request body:
{
"code": "0001",
"msg": "The video number cannot be empty!",
"data": null,
"success": false,
"failed": true
}
Branch on Content-Type (or check success: false) rather than parsing msg text — the message strings are short, sometimes use full-width punctuation, and aren’t a stable contract.
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.
Binary video stream or JSON error response
The response is of type file.