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"
}
'import requests
url = "https://api.memories.ai/serve/api/v1/download"
payload = { "video_no": "VI625239098370850816" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({video_no: 'VI625239098370850816'})
};
fetch('https://api.memories.ai/serve/api/v1/download', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memories.ai/serve/api/v1/download",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'video_no' => 'VI625239098370850816'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.memories.ai/serve/api/v1/download"
payload := strings.NewReader("{\n \"video_no\": \"VI625239098370850816\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.memories.ai/serve/api/v1/download")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"video_no\": \"VI625239098370850816\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memories.ai/serve/api/v1/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_no\": \"VI625239098370850816\"\n}"
response = http.request(request)
puts response.read_body"<string>"Library Management
Download Video
Download the original video file for a given video in your Private Video Library.
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"
}
'import requests
url = "https://api.memories.ai/serve/api/v1/download"
payload = { "video_no": "VI625239098370850816" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({video_no: 'VI625239098370850816'})
};
fetch('https://api.memories.ai/serve/api/v1/download', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.memories.ai/serve/api/v1/download",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'video_no' => 'VI625239098370850816'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.memories.ai/serve/api/v1/download"
payload := strings.NewReader("{\n \"video_no\": \"VI625239098370850816\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.memories.ai/serve/api/v1/download")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"video_no\": \"VI625239098370850816\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.memories.ai/serve/api/v1/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"video_no\": \"VI625239098370850816\"\n}"
response = http.request(request)
puts response.read_body"<string>"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)Prerequisites
- You have created a memories.ai API key.
Endpoint
POST /serve/api/v1/downloadAuthentication
Include your API key in the Authorization header.Authorization: sk-mavi-...
Request
Content-Type:application/json
{
"video_no": "VI625239098370850816"
}
Request Parameters
string
required
The video identifier to download.
Python Example
import requests
headers = {"Authorization": "sk-mavi-..."}
payload = {
"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"}' \
--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
ftypISO-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
}
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.
