Edit Video
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/video/edit \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_ids": [
"re_657739295220518912",
"re_657739295220518913"
],
"orientation": "portrait",
"user_prompt": "Create a dynamic montage with smooth transitions"
}
'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/video/edit"
payload = {
"asset_ids": ["re_657739295220518912", "re_657739295220518913"],
"orientation": "portrait",
"user_prompt": "Create a dynamic montage with smooth transitions"
}
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({
asset_ids: ['re_657739295220518912', 're_657739295220518913'],
orientation: 'portrait',
user_prompt: 'Create a dynamic montage with smooth transitions'
})
};
fetch('https://mavi-backend.memories.ai/serve/api/v2/video/edit', 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/video/edit",
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([
'asset_ids' => [
're_657739295220518912',
're_657739295220518913'
],
'orientation' => 'portrait',
'user_prompt' => 'Create a dynamic montage with smooth transitions'
]),
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://mavi-backend.memories.ai/serve/api/v2/video/edit"
payload := strings.NewReader("{\n \"asset_ids\": [\n \"re_657739295220518912\",\n \"re_657739295220518913\"\n ],\n \"orientation\": \"portrait\",\n \"user_prompt\": \"Create a dynamic montage with smooth transitions\"\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://mavi-backend.memories.ai/serve/api/v2/video/edit")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"asset_ids\": [\n \"re_657739295220518912\",\n \"re_657739295220518913\"\n ],\n \"orientation\": \"portrait\",\n \"user_prompt\": \"Create a dynamic montage with smooth transitions\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/video/edit")
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 \"asset_ids\": [\n \"re_657739295220518912\",\n \"re_657739295220518913\"\n ],\n \"orientation\": \"portrait\",\n \"user_prompt\": \"Create a dynamic montage with smooth transitions\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
},
"failed": false,
"success": true
}
{
"code": 200,
"message": "SUCCESS",
"data": {
"asset_id": "re_666942269501235201",
"create_time": "1768470628237",
"extension": "mp4",
"file_size": 62217261,
"modify_time": "1768470628237",
"original_filename": "final_video",
"upload_status": "SUCCESS"
},
"task_id": "b5b93c1ff93e460aaea67d328ab463f0"
}
Video Editing Agent
Edit Video
Edit and compose videos with AI-powered instructions
POST
/
video
/
edit
Edit Video
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/video/edit \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_ids": [
"re_657739295220518912",
"re_657739295220518913"
],
"orientation": "portrait",
"user_prompt": "Create a dynamic montage with smooth transitions"
}
'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/video/edit"
payload = {
"asset_ids": ["re_657739295220518912", "re_657739295220518913"],
"orientation": "portrait",
"user_prompt": "Create a dynamic montage with smooth transitions"
}
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({
asset_ids: ['re_657739295220518912', 're_657739295220518913'],
orientation: 'portrait',
user_prompt: 'Create a dynamic montage with smooth transitions'
})
};
fetch('https://mavi-backend.memories.ai/serve/api/v2/video/edit', 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/video/edit",
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([
'asset_ids' => [
're_657739295220518912',
're_657739295220518913'
],
'orientation' => 'portrait',
'user_prompt' => 'Create a dynamic montage with smooth transitions'
]),
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://mavi-backend.memories.ai/serve/api/v2/video/edit"
payload := strings.NewReader("{\n \"asset_ids\": [\n \"re_657739295220518912\",\n \"re_657739295220518913\"\n ],\n \"orientation\": \"portrait\",\n \"user_prompt\": \"Create a dynamic montage with smooth transitions\"\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://mavi-backend.memories.ai/serve/api/v2/video/edit")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"asset_ids\": [\n \"re_657739295220518912\",\n \"re_657739295220518913\"\n ],\n \"orientation\": \"portrait\",\n \"user_prompt\": \"Create a dynamic montage with smooth transitions\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/video/edit")
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 \"asset_ids\": [\n \"re_657739295220518912\",\n \"re_657739295220518913\"\n ],\n \"orientation\": \"portrait\",\n \"user_prompt\": \"Create a dynamic montage with smooth transitions\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "success",
"data": {
"task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
},
"failed": false,
"success": true
}
{
"code": 200,
"message": "SUCCESS",
"data": {
"asset_id": "re_666942269501235201",
"create_time": "1768470628237",
"extension": "mp4",
"file_size": 62217261,
"modify_time": "1768470628237",
"original_filename": "final_video",
"upload_status": "SUCCESS"
},
"task_id": "b5b93c1ff93e460aaea67d328ab463f0"
}
Product: Visual Agents
Use case: Managed endpoints powering Memories.ai’s open-source video search and editing agents (queries, video clipping/editing, screenplay extraction)
Host:
https://mavi-backend.memories.ai/serve/api/v2
Auth: Authorization: sk-mavi-... (no Bearer prefix)This is an async endpoint. You must configure a webhook URL in Webhooks Settings before calling this endpoint, otherwise you will not receive the processing results. See Webhooks Configuration Guide for details.
Pricing:
- $0.15/min of video
Code Examples
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const response = await fetch(`${BASE_URL}/video/edit`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': API_KEY
},
body: JSON.stringify({
asset_ids: ['re_657739295220518912', 're_657739295220518913'],
orientation: 'portrait',
user_prompt: 'Create a dynamic montage with smooth transitions'
})
});
const data = await response.json();
console.log(data);
import axios from 'axios';
const BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2";
const API_KEY = "sk-mavi-...";
const response = await axios.post(`${BASE_URL}/video/edit`, {
asset_ids: ['re_657739295220518912', 're_657739295220518913'],
orientation: 'portrait',
user_prompt: 'Create a dynamic montage with smooth transitions'
}, {
headers: {
'Authorization': API_KEY
}
});
console.log(response.data);
import requests
BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2"
API_KEY = "sk-mavi-..."
HEADERS = {
"Authorization": f"{API_KEY}"
}
def video_edit(asset_ids, orientation, user_prompt):
url = f"{BASE_URL}/video/edit"
data = {
"asset_ids": asset_ids,
"orientation": orientation,
"user_prompt": user_prompt
}
resp = requests.post(url, headers=HEADERS, json=data)
return resp.json()
# Usage example
asset_ids = ["re_657739295220518912", "re_657739295220518913"]
result = video_edit(
asset_ids=asset_ids,
orientation="portrait",
user_prompt="Create a dynamic montage with smooth transitions"
)
print(result)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| asset_ids | array[string] | Yes | Array of video asset IDs to combine and edit |
| orientation | string | Yes | Output video orientation: "landscape" or "portrait" |
| user_prompt | string | Yes | AI editing instructions describing desired output (max 500 characters, English recommended for best results) |
- Prompt language: English is recommended for best editing results. Other languages may work but are not guaranteed.
- Prompt length: Keep prompts under 500 characters for optimal performance.
- Output duration: The output video duration is determined by the AI based on the input assets and prompt — it cannot be manually specified.
Response
Returns task information for the video editing operation.{
"code": 200,
"msg": "success",
"data": {
"task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
},
"failed": false,
"success": true
}
{
"code": 200,
"message": "SUCCESS",
"data": {
"asset_id": "re_666942269501235201",
"create_time": "1768470628237",
"extension": "mp4",
"file_size": 62217261,
"modify_time": "1768470628237",
"original_filename": "final_video",
"upload_status": "SUCCESS"
},
"task_id": "b5b93c1ff93e460aaea67d328ab463f0"
}
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | string | Response code indicating the result status |
| msg | string | Response message describing the operation result |
| data | object | Response data object containing task information |
| data.task_id | string | Unique identifier of the video editing task |
| success | boolean | Indicates whether the operation was successful |
| failed | boolean | Indicates whether the operation failed |
Callback Response Parameters
When the video editing is complete, a callback will be sent to your configured webhook URL.| Parameter | Type | Description |
|---|---|---|
| code | string | Response code (200 indicates success) |
| message | string | Status message (e.g., “SUCCESS”) |
| data | object | Response data object containing the edited video information |
| data.asset_id | string | Unique asset ID for the edited video |
| data.create_time | string | Creation timestamp in milliseconds |
| data.extension | string | File extension of the edited video (e.g., “mp4”) |
| data.file_size | integer | Size of the edited video in bytes |
| data.modify_time | string | Last modification timestamp in milliseconds |
| data.original_filename | string | Filename of the edited video (e.g., “final_video”) |
| data.upload_status | string | Upload status of the edited video (e.g., “SUCCESS”) |
| task_id | string | The task ID associated with this video editing request |
Understanding the Callback Response
The callback response contains metadata about the final edited video created from combining and editing the input assets. Response Structure:callback_response
├── code: 200
├── message: "SUCCESS"
├── data
│ ├── asset_id: "re_666942269501235201"
│ ├── create_time: "1768470628237"
│ ├── extension: "mp4"
│ ├── file_size: 62217261
│ ├── modify_time: "1768470628237"
│ ├── original_filename: "final_video"
│ └── upload_status: "SUCCESS"
└── task_id: "b5b93c1ff93e460aaea67d328ab463f0"
- Edited video asset ID:
callback_response.data.asset_id - Video file size:
callback_response.data.file_size - Video filename:
callback_response.data.original_filename - Upload status:
callback_response.data.upload_status - Creation timestamp:
callback_response.data.create_time - Task ID:
callback_response.task_id
Prompt Examples
Theuser_prompt parameter guides the AI editing process. Here are some effective prompt examples:
| Use Case | Example Prompt |
|---|---|
| Montage | "Create a dynamic montage with smooth transitions" |
| Highlight Reel | "Create a 30-second highlight reel focusing on the most exciting moments" |
| Summary | "Compile a brief summary video with key scenes from all clips" |
| Style | "Edit with fast-paced cuts and energetic transitions for social media" |
| Narrative | "Arrange clips in chronological order with fade transitions" |
Notes
- Video editing is processed asynchronously using AI
- Returns a task_id that can be used to track the editing progress
- Use the task_id to query the status and results of video editing
- Supports combining multiple video assets
- Orientation options:
landscape(16:9) orportrait(9:16) - User prompt guides AI editing decisions — be specific about the desired style, pacing, and transitions
- Processing time varies based on complexity and video length
Authorizations
Body
application/json
Array of video asset IDs to combine and edit
Example:
[
"re_657739295220518912",
"re_657739295220518913"
]
Output video orientation
Available options:
landscape, portrait Example:
"portrait"
AI editing instructions describing desired output
Example:
"Create a dynamic montage with smooth transitions"
Response
200 - application/json
Video editing initiated successfully
Response code indicating the result status
Example:
200
Response message describing the operation result
Example:
"success"
Response data object containing task information
Show child attributes
Show child attributes
Indicates whether the operation was successful
Example:
true
Indicates whether the operation failed
Example:
false
