Split Video
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/video/split \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_id": "re_657739295220518912"
}
'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/video/split"
payload = { "asset_id": "re_657739295220518912" }
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_id: 're_657739295220518912'})
};
fetch('https://mavi-backend.memories.ai/serve/api/v2/video/split', 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/split",
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_id' => 're_657739295220518912'
]),
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/split"
payload := strings.NewReader("{\n \"asset_id\": \"re_657739295220518912\"\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/split")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"asset_id\": \"re_657739295220518912\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/video/split")
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_id\": \"re_657739295220518912\"\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": {
"splits": [
{
"asset_id": "re_666934884455964673",
"create_time": "1768468867505",
"extension": "mp4",
"file_size": 49164198,
"modify_time": "1768468867505",
"original_filename": "segment_video_79e54dd3_0000",
"upload_status": "SUCCESS"
},
{
"asset_id": "re_666934888084037633",
"create_time": "1768468868370",
"extension": "mp4",
"file_size": 56074135,
"modify_time": "1768468868370",
"original_filename": "segment_video_79e54dd3_0001",
"upload_status": "SUCCESS"
},
{
"asset_id": "re_666934893062676481",
"create_time": "1768468869557",
"extension": "mp4",
"file_size": 28377039,
"modify_time": "1768468869557",
"original_filename": "segment_video_79e54dd3_0002",
"upload_status": "SUCCESS"
}
]
},
"task_id": "41cf434821fd42368232b3d9ade53d2c"
}
Video Editing Agent
Split Video
Split a video into multiple segments
POST
/
video
/
split
Split Video
curl --request POST \
--url https://mavi-backend.memories.ai/serve/api/v2/video/split \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_id": "re_657739295220518912"
}
'import requests
url = "https://mavi-backend.memories.ai/serve/api/v2/video/split"
payload = { "asset_id": "re_657739295220518912" }
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_id: 're_657739295220518912'})
};
fetch('https://mavi-backend.memories.ai/serve/api/v2/video/split', 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/split",
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_id' => 're_657739295220518912'
]),
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/split"
payload := strings.NewReader("{\n \"asset_id\": \"re_657739295220518912\"\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/split")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"asset_id\": \"re_657739295220518912\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://mavi-backend.memories.ai/serve/api/v2/video/split")
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_id\": \"re_657739295220518912\"\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": {
"splits": [
{
"asset_id": "re_666934884455964673",
"create_time": "1768468867505",
"extension": "mp4",
"file_size": 49164198,
"modify_time": "1768468867505",
"original_filename": "segment_video_79e54dd3_0000",
"upload_status": "SUCCESS"
},
{
"asset_id": "re_666934888084037633",
"create_time": "1768468868370",
"extension": "mp4",
"file_size": 56074135,
"modify_time": "1768468868370",
"original_filename": "segment_video_79e54dd3_0001",
"upload_status": "SUCCESS"
},
{
"asset_id": "re_666934893062676481",
"create_time": "1768468869557",
"extension": "mp4",
"file_size": 28377039,
"modify_time": "1768468869557",
"original_filename": "segment_video_79e54dd3_0002",
"upload_status": "SUCCESS"
}
]
},
"task_id": "41cf434821fd42368232b3d9ade53d2c"
}
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.02/second 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/split`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': API_KEY
},
body: JSON.stringify({
asset_id: 're_657739295220518912'
})
});
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/split`, {
asset_id: 're_657739295220518912'
}, {
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_split(asset_id):
url = f"{BASE_URL}/video/split"
data = {"asset_id": asset_id}
response = requests.post(url, json=data, headers=HEADERS)
return response.json()
# Usage example
result = video_split("re_657739295220518912")
print(result)
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| asset_id | string | Yes | The video asset ID to split |
Response
Returns task information for the video split operation.{
"code": 200,
"msg": "success",
"data": {
"task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
},
"failed": false,
"success": true
}
{
"code": 200,
"message": "SUCCESS",
"data": {
"splits": [
{
"asset_id": "re_666934884455964673",
"create_time": "1768468867505",
"extension": "mp4",
"file_size": 49164198,
"modify_time": "1768468867505",
"original_filename": "segment_video_79e54dd3_0000",
"upload_status": "SUCCESS"
},
{
"asset_id": "re_666934888084037633",
"create_time": "1768468868370",
"extension": "mp4",
"file_size": 56074135,
"modify_time": "1768468868370",
"original_filename": "segment_video_79e54dd3_0001",
"upload_status": "SUCCESS"
},
{
"asset_id": "re_666934893062676481",
"create_time": "1768468869557",
"extension": "mp4",
"file_size": 28377039,
"modify_time": "1768468869557",
"original_filename": "segment_video_79e54dd3_0002",
"upload_status": "SUCCESS"
}
]
},
"task_id": "41cf434821fd42368232b3d9ade53d2c"
}
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 split task |
| success | boolean | Indicates whether the operation was successful |
| failed | boolean | Indicates whether the operation failed |
Callback Response Parameters
When the video splitting 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 split video segments |
| data.splits | array | Array of video segment objects created from the original video |
| data.splits[].asset_id | string | Unique asset ID for this video segment |
| data.splits[].create_time | string | Creation timestamp in milliseconds |
| data.splits[].extension | string | File extension of the video segment (e.g., “mp4”) |
| data.splits[].file_size | integer | Size of the video segment in bytes |
| data.splits[].modify_time | string | Last modification timestamp in milliseconds |
| data.splits[].original_filename | string | Generated filename for the segment (format: segment_video__) |
| data.splits[].upload_status | string | Upload status of the segment (e.g., “SUCCESS”) |
| task_id | string | The task ID associated with this video split request |
Understanding the Callback Response
The callback response contains an array of video segments, each representing a portion of the original video with its own asset ID and metadata. Response Structure:callback_response
├── code: 200
├── message: "SUCCESS"
├── data
│ └── splits: [array of video segments]
│ └── [
│ {
│ asset_id: "re_666934884455964673",
│ create_time: "1768468867505",
│ extension: "mp4",
│ file_size: 49164198,
│ modify_time: "1768468867505",
│ original_filename: "segment_video_79e54dd3_0000",
│ upload_status: "SUCCESS"
│ },
│ {
│ asset_id: "re_666934888084037633",
│ create_time: "1768468868370",
│ extension: "mp4",
│ file_size: 56074135,
│ modify_time: "1768468868370",
│ original_filename: "segment_video_79e54dd3_0001",
│ upload_status: "SUCCESS"
│ },
│ ...
│ ]
└── task_id: "41cf434821fd42368232b3d9ade53d2c"
- All video segments:
callback_response.data.splits - Number of segments:
callback_response.data.splits.length - First segment asset ID:
callback_response.data.splits[0].asset_id - First segment file size:
callback_response.data.splits[0].file_size - First segment filename:
callback_response.data.splits[0].original_filename - Task ID:
callback_response.task_id
segment_video_{id}_{index}, where:
segment_video_is the prefix for split video segments{id}is a unique identifier for this split operation{index}is the sequential segment number (0-indexed)
Notes
- Video splitting is processed asynchronously
- Returns a task_id that can be used to track the split progress
- Use the task_id to query the status and results of video splitting
- Original video remains unchanged
- Useful for creating shorter clips from long videos
Authorizations
Body
application/json
The video asset ID to split
Example:
"re_657739295220518912"
Response
200 - application/json
Video split 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
