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"
}
'
{
  "code": "0000",
  "msg": "success",
  "data": {
    "task_id": "f432bc84bfd141d1b05c1d24af0abe6a"
  },
  "failed": false,
  "success": true
}
This endpoint allows you to edit videos by combining multiple assets with custom orientation and AI-guided editing instructions.

Code Examples

const response = await fetch('/video/edit', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'sk-8483027fe3abfe535f6ae01a9979b4f7'
  },
  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);

Request Body

FieldTypeRequiredDescription
asset_idsarray[string]YesArray of video asset IDs to combine and edit
orientationstringYesOutput video orientation: "landscape" or "portrait"
user_promptstringYesAI editing instructions describing desired output

Response

Returns task information for the video editing 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 editing task
successbooleanIndicates whether the operation was successful
failedbooleanIndicates whether the operation failed

Callback Response Parameters

When the video editing 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 edited video information
data.asset_idstringUnique asset ID for the edited video
data.create_timestringCreation timestamp in milliseconds
data.extensionstringFile extension of the edited video (e.g., “mp4”)
data.file_sizeintegerSize of the edited video in bytes
data.modify_timestringLast modification timestamp in milliseconds
data.original_filenamestringFilename of the edited video (e.g., “final_video”)
data.upload_statusstringUpload status of the edited video (e.g., “SUCCESS”)
task_idstringThe 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: "0000"
├── 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"
How to access the data:
  • 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

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) or portrait (9:16)
  • User prompt guides AI editing decisions
  • Processing time varies based on complexity and video length

Authorizations

Authorization
string
header
required

Body

application/json
asset_ids
string[]
required

Array of video asset IDs to combine and edit

Example:
[
"re_657739295220518912",
"re_657739295220518913"
]
orientation
enum<string>
required

Output video orientation

Available options:
landscape,
portrait
Example:

"portrait"

user_prompt
string
required

AI editing instructions describing desired output

Example:

"Create a dynamic montage with smooth transitions"

Response

200 - application/json

Video editing 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