Multi-Elements
Initialize Video for Editing
Initialize the original video before using Multi-elements feature. When replacing or removing elements within the existing video, the relevant elements need to be marked in the video beforehand.
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Request Body
The ID of the video generated by the Kling AI
- Only videos generated within the last 30 days are supported
- Only supports videos with a duration of ≥2 seconds and ≤5 seconds, or ≥7 seconds and ≤10 seconds
- Related to the video_url parameter: both video_id and video_url cannot be empty at the same time, and cannot both have values at the same time
Get link for uploaded video
- Only .mp4/.mov formats are supported
- Only supports videos with a duration of ≥2 seconds and ≤5 seconds, or ≥7 seconds and ≤10 seconds
- Video resolution must be between 720px and 2160px (inclusive) in both width and height
- Only supports videos with frame rates of 24, 30, or 60 fps
- Related to the video_id parameter: both video_id and video_url cannot be empty at the same time, and cannot both have values at the same time
Add Video Selection Area
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Request Body
Session ID, generated during the video initialization task and remains unchanged during editing operations
Frame Number
- A maximum of 10 frames can be marked. That is, up to 10 frames can be used to define selection areas in the video
- Only supports marking 1 frame at a time
Click Coordinates, represented by x and y
- Value range: [0, 1], expressed as percentages; [0, 1] represents the top-left corner of the frame
- Multiple points can be marked at once; up to 10 points can be marked on a single frame
X coordinate [0-1]
Y coordinate [0-1]
Sample Code
Decoding Image Segmentation Result
Rendering the Segmentation Mask Layer
Delete Video Selection Area
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Request Body
Session ID, generated during the video initialization task and remains unchanged during editing operations
Frame Number
Click Coordinates to delete, represented by x and y
- Value range: [0, 1], expressed as percentages; [0, 1] represents the top-left corner of the frame
- Multiple points can be provided at once
- Coordinates must exactly match those used when adding the video selection area
X coordinate [0-1]
Y coordinate [0-1]
Clear Video Selection
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Request Body
Session ID, generated during the video initialization task and remains unchanged during editing operations
Preview Video with Selected Areas
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Request Body
Session ID, generated during the video initialization task and remains unchanged during editing operations
Create Task
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Request Body
Model Name
Session ID, generated during the video initialization task and remains unchanged during editing operations
Operation Type
- addition: Add an element
- swap: Replace an element
- removal: Remove an element
Cropped Reference Images
- For adding video elements: This parameter is required; upload 1–2 images
- For editing (swapping) video elements: This parameter is required; upload 1 image only
- For deleting video elements: This parameter is not required
- Use key:value format as follows:
- The API does not perform cropping, please upload images with subjects already cropped
- Supports image input as either Base64-encoded string or URL (ensure the URL is publicly accessible)
- Important: When using Base64, do NOT add any prefix like
data:image/png;base64,. Submit only the raw Base64 string.
- Correct Base64 format:
- Incorrect Base64 format (with data: prefix):
- Supported image formats: .jpg / .jpeg / .png
- Image file size must not exceed 10MB. Image dimensions must be at least 300px. Aspect ratio must be between 1:2.5 and 2.5:1
Image URL or Base64 string
Positive Prompt
- Use the format <<<xxx>>> to explicitly refer to a specific video or image, such as <<<video_1>>> or <<<image_1>>>
- To ensure optimal results, the prompt must include references to the video and image(s) required for the editing
- Must not exceed 2,500 characters
Recommended Prompt Templates:
Adding Elements:
- EN: Using the context of <<<video_1>>>, seamlessly add [x] from <<<image_1>>>
- ZH: 基于<<<video_1>>>中的原始内容,以自然生动的方式,将<<<image_1>>>中的【】,融入<<<video_1>>>的【】
Replacing Elements:
- EN: swap [x] from <<<image_1>>> for [x] from <<<video_1>>>
- ZH: 使用<<<image_1>>>中的【】,替换<<<video_1>>>中的【】
Removing Elements:
- EN: Delete [x] from <<<video_1>>>
- ZH: 删除<<<video_1>>>中的【】
Note: [x] or 【】 are placeholders where you should fill in specific content.
Negative Prompt
- Must not exceed 2,500 characters
Video Generation Mode
- std: Standard mode, basic rendering, cost-effective
- pro: Professional mode, high-quality, enhanced rendering, better video output quality
Video Duration (in seconds)
- Only 5-second and 10-second videos are supported
- To generate a 5-second video, the input video must be ≥2 seconds and ≤5 seconds
- To generate a 10-second video, the input video must be ≥7 seconds and ≤10 seconds
Whether to generate watermarked results simultaneously
- Defined by the enabled parameter, format:
- true: generate watermarked result, false: do not generate
- Custom watermarks are not currently supported
Callback URL for Task Result Notification. If configured, the server will actively send notifications when the task status changes
- For the message schema, refer to the Callback Protocol
Custom Task ID
- A user-defined task ID; it will not overwrite the system-generated task ID, but can be used to query the task
- Please ensure uniqueness of the task ID within a single user account
Query Task (Single)
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Path Parameters
Task ID for Multi-Elements video editing
- Request path parameter, fill the value directly in the request path
- You can choose to query by external_task_id or task_id
Custom Task ID for Multi-Elements video editing
- The external_task_id filled in when creating the task. You can choose to query by external_task_id or task_id
Query Task (List)
Request Header
Data Exchange Format
Authentication information, refer to API authentication
Query Parameters
Page number
- Value range: [1, 1000]
Number of items per page
- Value range: [1, 500]