Overview
The file upload endpoint uploads input assets before creating image-to-image, video generation, or related tasks, and returns file access URLs that can be passed directly to fields such as imageUrls and videoUrl.
Two upload methods are supported:
| Method | endpoint | Description |
|---|---|---|
| Direct Client Upload | POST /api/v2/open/upload/presigned | Recommended. First get a presigned upload URL, then let the client PUT the file to the storage service |
| Server-side Upload | POST /api/v2/open/upload | usemultipart/form-data will File Upload |
Domestic Base URL: https://mm-internal-cn.leonecloud.com
International Base URL: https://mm-internal-cn.leonecloud.com
Authentication
All endpoints require a token in the request header for authentication:
Authorization: Bearer {YOUR_AUTH_TOKEN}1. Get Presigned Upload URL
POST /api/v2/open/upload/presigned
Get a temporary uploadUrl.use URLPUT Methodfile, After upload succeedsuse the value returned by the endpointfileUrl as the asset URL in business requests.
Content-Type: application/json
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| filename | string | Yes | File name. It must include an extension, localized example textinput.jpg, demo.mp4 |
| contentType | string | No | File MIME type. If omitted, it is inferred from the extension |
Supported Formats
| Type | Supported Extensions |
|---|---|
| Image | jpg, jpeg, png, gif, webp |
| Video | mp4, mov, avi, mkv, webm |
Request Example
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/upload/presigned" \
-H "Authorization: Bearer your_auth_token_here" \
-H "Content-Type: application/json" \
-d '{
"filename": "input.jpg",
"contentType": "image/jpeg"
}'Response Parameters
| Parameter | Type | Description |
|---|---|---|
| uploadUrl | string | URL, usePUT upload a file |
| fileUrl | string | File access URL after upload succeeds, can use after Create Task |
| key | string | File storage path |
| expire | int64 | uploadUrl expiration timestamp in seconds |
Response Example
{
"code": 0,
"msg": "success",
"data": {
"uploadUrl": "https://example-bucket.example-endpoint.com/uploads/20260513/20260513120000_abc123.jpg?OSSAccessKeyId=xxx&Expires=1778661000&Signature=xxx",
"fileUrl": "https://fc-gw-sh.oss-accelerate.aliyuncs.com/uploads/20260513/20260513120000_abc123.jpg",
"key": "uploads/20260513/20260513120000_abc123.jpg",
"expire": 1778661000
}
}Upload the File with uploadUrl
PUT whenContent-Type mustand URL when orcontentType consistent.
curl -X PUT "{uploadUrl}" \
-H "Content-Type: image/jpeg" \
--data-binary "@input.jpg"After upload succeeds, use number in thefileUrl Create Task:
{
"prompt": "will image as",
"genType": "i2i",
"imageUrls": [
"https://fc-gw-sh.oss-accelerate.aliyuncs.com/uploads/20260513/20260513120000_abc123.jpg"
]
}2. Form File Upload
POST /api/v2/open/upload
upload a file.endpointLimit file Format, File size exceeds 100MB.
Content-Type: multipart/form-data
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | file |
Supported Formats and Limits
| Item | Limit |
|---|---|
| file Format | Limit |
| File size | maximum 100MB |
Request Example
curl -X POST "https://mm-internal-cn.leonecloud.com/api/v2/open/upload" \
-H "Authorization: Bearer your_auth_token_here" \
-F "file=@input.jpg"Response Parameters
| Parameter | Type | Description |
|---|---|---|
| url | string | file URL, can use after Create Task |
| filename | string | after file |
| size | int64 | File size, localized example text |
Response Example
{
"code": 0,
"msg": "success",
"data": {
"url": "https://fc-gw-sh.oss-accelerate.aliyuncs.com/open-uploads/20260513/120000_abc123.jpg",
"filename": "120000_abc123.jpg",
"size": 102400
}
}