Upload File
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/upload \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://mavi-backend.memories.ai/serve/api/v2/upload', 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://mavi-backend.memories.ai/serve/api/v2/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$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://mavi-backend.memories.ai/serve/api/v2/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mavi-backend.memories.ai/serve/api/v2/upload")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"asset_id": "re_660727003963174912"
},
"success": true,
"failed": false
}
Asset Management
Upload File
Upload a video, audio, or image file to Visual Intelligence for processing and analysis.
POST
/
upload
Upload File
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/upload \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form file='@example-file'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
headers = {"Authorization": "<api-key>"}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('file', '<string>');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://mavi-backend.memories.ai/serve/api/v2/upload', 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://mavi-backend.memories.ai/serve/api/v2/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data"
],
]);
$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://mavi-backend.memories.ai/serve/api/v2/upload"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://mavi-backend.memories.ai/serve/api/v2/upload")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/upload")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"asset_id": "re_660727003963174912"
},
"success": true,
"failed": false
}
Product: Visual Intelligence — Asset Management
Use case: Upload, manage, and download video/image assets used by other Visual Intelligence APIs
Host:
https://mavi-backend.memories.ai/serve/api/v2
Auth: Authorization: sk-mavi-... (no Bearer prefix)asset_id that can be used to reference this asset in all subsequent API calls.
Pricing:
- API calls are free
- Storage fee: $0.001/1GB per day
Supported File Formats
| Category | Formats |
|---|---|
| Video | MP4, MOV, AVI, WebM, MKV, FLV, WMV, MPEG |
| Audio | MP3, WAV, AAC, FLAC, OGG, M4A |
| Image | JPEG, PNG, GIF, WebP, BMP, TIFF |
Code Example
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/upload \
--header 'Authorization: sk-mavi-...' \
--form 'file=@video.mp4'
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const formData = new FormData();
formData.append('file', fileInput.files[0]);
const response = await fetch(`${BASE_URL}/upload`, {
method: 'POST',
headers: {
'Authorization': API_KEY
},
body: formData
});
const data = await response.json();
console.log(data);
// { code: 200, msg: "success", data: { asset_id: "re_660727003963174912" } }
import requests
BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2"
API_KEY = "sk-mavi-..."
HEADERS = {
"Authorization": f"{API_KEY}"
}
def upload(file_path):
url = f"{BASE_URL}/upload"
files = {"file": open(file_path, "rb")}
response = requests.post(url, headers=HEADERS, files=files)
return response.json()
# Usage example
result = upload("video.mp4")
print(result)
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | The file to upload (multipart/form-data). See supported formats above. |
Response
Return the resource information after the upload is successful.{
"code": 200,
"msg": "success",
"data": {
"asset_id": "re_660727003963174912"
},
"success": true,
"failed": false
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | integer | Response code (200 on success — the example shows this correctly but the prose previously said string) |
| msg | string | Response message describing the operation result |
| data | object | Response data object containing the uploaded asset information |
| data.asset_id | string | Unique identifier of the uploaded asset, format re_<digits>. Use this ID in all subsequent API calls. |
| success | boolean | Indicates whether the operation was successful |
| failed | boolean | Indicates whether the operation failed |
Error Responses
// Missing `file` part in the multipart body (note `msg` is null on this path)
HTTP 500 {"code": 500, "msg": null, "data": null}
HTTP 400 with a generic "Request has exceeded the limit." body — that string is shared between rate-limit and several validation paths, so don’t parse msg to distinguish them; rely on the HTTP status code.
Upload Status
After uploading, the asset goes through the following states. Only assets withSUCCESS status can be used in subsequent API calls.
| Status | Description |
|---|---|
WAITING | Upload request received, waiting to process |
UPLOADING | File is being uploaded and processed |
SUCCESS | Upload completed successfully — asset is ready for use |
FAILED | Upload failed — retry the upload |
upload_status of an asset.
File Size Limit
The maximum file size for direct upload is 500 MB. For files larger than 500 MB, use the Signed URL Upload method, which supports files up to 5 GB and provides more reliable uploads for large files.
Notes
- The returned
asset_idis required for all subsequent operations (transcription, editing, embedding, etc.) - Only assets with
upload_status: "SUCCESS"can be used in subsequent API calls - Use Get Metadata to verify the asset is ready before calling other endpoints
Authorizations
Body
multipart/form-data
The file to upload
Response
200 - application/json
File uploaded successfully
Response code indicating the result status
Example:
200
Response message describing the operation result
Example:
"success"
Response data object containing the uploaded asset information
Show child attributes
Show child attributes
Indicates whether the operation was successful
Example:
true
Indicates whether the operation failed
Example:
false
