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"
}
'
{
  "code": "0000",
  "msg": "success",
  "data": {
    "task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
  },
  "failed": false,
  "success": true
}
This endpoint splits a video asset into multiple parts based on specified criteria.

Code Examples

const response = await fetch('/video/split', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'sk-8483027fe3abfe535f6ae01a9979b4f7'
  },
  body: JSON.stringify({
    asset_id: 're_657739295220518912'
  })
});

const data = await response.json();
console.log(data);

Request Body

FieldTypeRequiredDescription
asset_idstringYesThe video asset ID to split

Response

Returns task information for the video split operation.
{
  "code": "0000",
  "msg": "success",
  "data": {
    "task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
  },
  "failed": false,
  "success": true
}

Response Parameters

ParameterTypeDescription
codestringResponse code indicating the result status
msgstringResponse message describing the operation result
dataobjectResponse data object containing task information
data.task_idstringUnique identifier of the video split task
successbooleanIndicates whether the operation was successful
failedbooleanIndicates whether the operation failed

Callback Response Parameters

When the video splitting is complete, a callback will be sent to your configured webhook URL.
ParameterTypeDescription
codestringResponse code (“0000” indicates success)
messagestringStatus message (e.g., “SUCCESS”)
dataobjectResponse data object containing the split video segments
data.splitsarrayArray of video segment objects created from the original video
data.splits[].asset_idstringUnique asset ID for this video segment
data.splits[].create_timestringCreation timestamp in milliseconds
data.splits[].extensionstringFile extension of the video segment (e.g., “mp4”)
data.splits[].file_sizeintegerSize of the video segment in bytes
data.splits[].modify_timestringLast modification timestamp in milliseconds
data.splits[].original_filenamestringGenerated filename for the segment (format: segment_video__)
data.splits[].upload_statusstringUpload status of the segment (e.g., “SUCCESS”)
task_idstringThe 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: "0000"
├── 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"
How to access the data:
  • 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 Filename Format: Each segment filename follows the pattern 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

Authorization
string
header
required

Body

application/json
asset_id
string
required

The video asset ID to split

Example:

"re_657739295220518912"

Response

200 - application/json

Video split initiated successfully

code
string

Response code indicating the result status

Example:

"0000"

msg
string

Response message describing the operation result

Example:

"success"

data
object

Response data object containing task information

success
boolean

Indicates whether the operation was successful

Example:

true

failed
boolean

Indicates whether the operation failed

Example:

false