All Products
Search
Document Center

Alibaba Cloud Model Studio:Wan video editing API reference

Last Updated:Apr 03, 2026

The Wan2.7 - video editing model supports multimodal inputs (text, images, and videos) for instruction-based editing and video migration.

Availability

The model, endpoint URL, and API key must belong to the same region. Cross-region calls fail.

Note

The sample code in this topic applies to the Singapore region.

HTTP

Video editing tasks typically take 1 to 5 minutes, so the API uses asynchronous invocation: Create a task → Poll for results.

Step 1: Create a task

Singapore

POST https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Beijing

POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis

Note
  • After the task is created, use the returned task_id to query the result. The task_id is valid for 24 hours. Do not create duplicate tasks. Instead, use polling to retrieve the result.

  • For a beginner's tutorial, see Postman.

Request parameters

Video style modification

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.7-videoedit",
    "input": {
        "prompt": "Convert the entire scene to a claymation style",
        "media": [
            {
                "type": "video",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/ldnfdf/wan2.7-videoedit-style-change.mp4"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "prompt_extend": true,
        "watermark": true
    }
}'

Video editing

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis' \
    -H 'X-DashScope-Async: enable' \
    -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
    -H 'Content-Type: application/json' \
    -d '{
    "model": "wan2.7-videoedit",
    "input": {
        "prompt": "Replace the clothes of the girl in the video with the clothes from the image",
        "media": [
            {
                "type": "video",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260403/nlspwm/T2VA_22.mp4"
            },
            {
                "type": "reference_image",
                "url": "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260402/fwjpqf/wan2.7-videoedit-change-clothes.png"
            }
        ]
    },
    "parameters": {
        "resolution": "720P",
        "prompt_extend": true,
        "watermark": true
    }
}'

Content-Type string (Required)

The content type of the request. Must be application/json.

Authorization string (Required)

The authentication credentials using a Model Studio API key.

Example: Bearer sk-xxxx

X-DashScope-Async string (Required)

Enables asynchronous processing. Must be enable as HTTP requests support only asynchronous processing.

Important

Returns "current user api does not support synchronous calls" error if not included.

Request body

model string (Required)

The model name.

Example: wan2.7-videoedit.

input object (Required)

The input information, such as the prompt.

Properties

prompt string (Optional)

The text prompt describing the desired elements and visual features in the generated video.

Chinese and English are supported. Each Chinese character or letter counts as one character. Any text exceeding the limit is automatically truncated.

  • wan2.7-videoedit: The length cannot exceed 5,000 characters.

Example: Change the clothes of the character to a cool, flashy outfit and add the hat from the reference image.

negative_prompt string (Optional)

The negative prompt. Describes content you do not want in the video, used to constrain video frames.

Chinese and English are supported. The length cannot exceed 500 characters. Any text exceeding the limit is automatically truncated.

Example: low resolution, error, worst quality, low quality, deformed, extra fingers, bad proportions.

media array (Required)

Media assets (images, videos) used as reference materials for video generation.

Each element is an object with type and url fields.

Properties

type string (Required)

The media asset type. Valid values:

  • video: Required. The video to be edited.

  • reference_image: Optional. The reference image.

Asset limits:

  • You can provide only one video.

  • You can provide up to three reference images.

url string (Required)

The URL of the media asset.

Input video (type=video)

URL of the video to edit.

Video limits:

  • Format: MP4, MOV.

  • Duration: 2 to 10s.

  • Resolution: The width and height must be in the range of [240, 4096] pixels.

  • Aspect ratio: 1:8 to 8:1.

  • File size: Up to 100 MB.

Supported input formats:

  1. Public URL:

    • HTTP and HTTPS are supported.

    • Example: https://xxx/xxx.mp4.

Input image (type=reference_image or first_frame)

URL of the first frame or reference image.

Image limits:

  • Format: JPEG, JPG, PNG (alpha channel is not supported), BMP, WEBP.

  • Resolution: The width and height must be in the range of [240, 8000] pixels.

  • Aspect ratio: 1:8 to 8:1.

  • File size: Up to 20 MB.

Supported input formats:

  1. Public URL:

    • HTTP and HTTPS are supported.

    • Example: https://xxx/xxx.png.

parameters object (Optional)

Video processing parameters such as resolution, duration, prompt rewriting, and watermark.

Properties

resolution string (Optional)

Important

The resolution directly affects the cost. For the same model, 1080P costs more than 720P. Before making a call, confirm the

The resolution level of the generated video.

  • wan2.7-videoedit: Valid values are 720P and 1080P. The default value is 1080P.

ratio string (Optional)

The aspect ratio of the generated video.

Activation logic:

  • If omitted, the output aspect ratio matches the input video.

  • If specified, the output uses the given ratio.

Valid values:

  • 16:9

  • 9:16

  • 1:1

  • 4:3

  • 3:4

Output video resolutions (width × height) by aspect ratio:

Resolution level

Aspect ratio

Output video resolution (width × height)

720P

16:9

1280 × 720

9:16

720 × 1280

1:1

960 × 960

4:3

1104 × 832

3:4

832 × 1104

1080P

16:9

1920 × 1080

9:16

1080 × 1920

1:1

1440 × 1440

4:3

1648 × 1248

3:4

1248 × 1648

duration integer (Optional)

The duration of the generated video, in seconds.

Set this parameter only to truncate the video. To keep the input video duration, omit this parameter or pass 0.

Rules:

  • Default: 0 (uses input video duration without truncation).

  • Truncation: The system truncates the video from 0 seconds to the specified `duration`.

  • Valid range: 2 to 10.

audio_setting string (Optional)

Audio settings.

  • auto (default): The model decides based on the prompt. If the prompt describes sound, audio may be regenerated; otherwise, the original audio is retained.

  • origin: Retains the original audio without regeneration.

prompt_extend boolean (Optional)

Enables prompt rewriting using an LLM, which improves results for shorter prompts but increases processing time.

  • true (default)

  • false

watermark boolean (Optional)

Whether to add a watermark. The watermark is located in the lower-right corner of the video, with the fixed text “AI-generated”.

  • false (default)

  • true

Example value: false.

seed integer (Optional)

The random number seed. Must be an integer between 0 and 2147483647.

If not provided, a random seed is generated. Using a fixed seed improves reproducibility, though results may still vary due to model randomness.

Example: 12345

Response parameters

Successful response

Save the task_id to query the task status and result.

{
    "output": {
        "task_status": "PENDING",
        "task_id": "0385dc79-5ff8-4d82-bcb6-xxxxxx"
    },
    "request_id": "4909100c-7b5a-9f92-bfe5-xxxxxx"
}

Error response

Task creation failed. See error codes to resolve the issue.

{
    "code": "InvalidApiKey",
    "message": "No API-key provided.",
    "request_id": "7438d53d-6eb8-4596-8835-xxxxxx"
}

output object

The task output.

Properties

task_id string

The ID of the task. Can be used to query the task for up to 24 hours.

task_status string

The status of the task.

Enumeration

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN: Task does not exist or status is unknown

request_id string

Unique identifier for the request. Use for tracing and troubleshooting issues.

code string

The error code. Returned only when the request fails. See error codes for details.

message string

Detailed error message. Returned only when the request fails. See error codes for details.

Step 2: Query the result

Singapore

GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}

Beijing

GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}

Note
  • Polling suggestion: Video generation can take several minutes. Use a polling mechanism with a reasonable query interval, such as 15 seconds, to retrieve the result.

  • Task status transition: PENDING → RUNNING → SUCCEEDED or FAILED.

  • Result URL: After the task is successful, a video URL is returned. The URL is valid for 24 hours. After you retrieve the URL, you must immediately download and save the video to a permanent storage service, such as Object Storage Service (OSS).

  • task_id validity: 24 hours. After this period, you cannot query the result, and the API returns a task status of UNKNOWN.

Request parameters

Query task result

Replace {task_id} with the task_id value returned by the previous API call. task_id is valid for queries within 24 hours.

curl -X GET https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id} \
--header "Authorization: Bearer $DASHSCOPE_API_KEY"
Request headers

Authorization string (Required)

The authentication credentials using a Model Studio API key.

Example: Bearer sk-xxxx

Path parameters

task_id string (Required)

The ID of the task to query.

Response parameters

Task succeeded

Video URLs are retained for only 24 hours and then automatically purged. Save generated videos promptly.

{
    "request_id": "f16ae7e9-d518-92f8-a02c-xxxxxx",
    "output": {
        "task_id": "05e68c7e-850c-49e4-b866-xxxxxx",
        "task_status": "SUCCEEDED",
        "submit_time": "2026-04-03 00:08:03.576",
        "scheduled_time": "2026-04-03 00:08:13.408",
        "end_time": "2026-04-03 00:11:57.286",
        "orig_prompt": "Convert the entire scene to a claymation style",
        "video_url": "https://dashscope-a717.oss-accelerate.aliyuncs.com/xxx.mp4?xxxx"
    },
    "usage": {
        "duration": 10.04,
        "input_video_duration": 5.02,
        "output_video_duration": 5.02,
        "video_count": 1,
        "SR": 720
    }
}

Task failed

When a task fails, task_status is set to FAILED with an error code and message. See error codes to resolve the issue.

{
    "request_id": "e5d70b02-ebd3-98ce-9fe8-759d7d7b107d",
    "output": {
        "task_id": "86ecf553-d340-4e21-af6e-a0c6a421c010",
        "task_status": "FAILED",
        "code": "InvalidParameter",
        "message": "The size is not match xxxxxx"
    }
}

Task query expired

The task_id is valid for 24 hours. After this period, queries fail and return the following error message.

{
    "request_id": "a4de7c32-7057-9f82-8581-xxxxxx",
    "output": {
        "task_id": "502a00b1-19d9-4839-a82f-xxxxxx",
        "task_status": "UNKNOWN"
    }
}

output object

The task output.

Properties

task_id string

The ID of the task. Can be used to query the task for up to 24 hours.

task_status string

The status of the task.

Enumeration

  • PENDING

  • RUNNING

  • SUCCEEDED

  • FAILED

  • CANCELED

  • UNKNOWN: Task does not exist or status is unknown

Status transitions during polling:

  • PENDING → RUNNING → SUCCEEDED or FAILED

  • First query typically returns PENDING or RUNNING

  • SUCCEEDED status includes the generated video URL in the response

  • FAILED status requires checking the error message and retrying

submit_time string

The time when the task was submitted. Time is in UTC+8. Format: YYYY-MM-DD HH:mm:ss.SSS.

scheduled_time string

The time when the task started running. Time is in UTC+8. Format: YYYY-MM-DD HH:mm:ss.SSS.

end_time string

The time when the task was completed. Time is in UTC+8. Format: YYYY-MM-DD HH:mm:ss.SSS.

video_url string

The URL of the generated video. Returned only when task_status is SUCCEEDED.

URL is valid for 24 hours. Use to download the video in MP4 format with H.264 encoding.

orig_prompt string

The original input prompt. This is the value of the prompt request parameter.

code string

The error code. Returned only when the request fails. See error codes for details.

message string

Detailed error message. Returned only when the request fails. See error codes for details.

usage object

Output statistics. Only successful tasks are counted.

Properties

input_video_duration float

The duration of the input video, in seconds.

output_video_duration float

The duration of the output video, in seconds.

duration float

The total video duration, which is used for billing.

The billing formula is: duration = input_video_duration + output_video_duration.

SR integer

The resolution level of the output video. For example: 720.

video_count integer

The number of generated videos. This value is fixed at 1.

request_id string

Unique identifier for the request. Use for tracing and troubleshooting issues.

Billing and rate limiting

  • For free quota and billing, see Model invocation pricing.

  • For model rate limits, see Wan series.

  • Billing description:

    • Input images are free. Input and output videos are billed per second. Total billable duration = Input video duration + Output video duration.

    • Failed calls do not incur fees or consume the free quota for new users.

Limitations

  • Data validity: The task_id and video_url expire after 24 hours and can no longer be queried or downloaded.

  • Content moderation: Inputs (prompts, images) and output videos are subject to Content Moderation review. Violations result in an "IPInfringementSuspect" or "DataInspectionFailed" error. See Error messages.

Error codes

If a call fails, see Error messages.