Other APIs / open-api-file-upload.md

File Upload

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:

MethodendpointDescription
Direct Client UploadPOST /api/v2/open/upload/presignedRecommended. First get a presigned upload URL, then let the client PUT the file to the storage service
Server-side UploadPOST /api/v2/open/uploadusemultipart/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

ParameterTypeRequiredDescription
filenamestringYesFile name. It must include an extension, localized example textinput.jpg, demo.mp4
contentTypestringNoFile MIME type. If omitted, it is inferred from the extension

Supported Formats

TypeSupported Extensions
Imagejpg, jpeg, png, gif, webp
Videomp4, 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

ParameterTypeDescription
uploadUrlstringURL, usePUT upload a file
fileUrlstringFile access URL after upload succeeds, can use after Create Task
keystringFile storage path
expireint64uploadUrl 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

ParameterTypeRequiredDescription
filefileYesfile

Supported Formats and Limits

ItemLimit
file FormatLimit
File sizemaximum 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

ParameterTypeDescription
urlstringfile URL, can use after Create Task
filenamestringafter file
sizeint64File 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
 }
}

Error| Scenario | Description | |-----|------| | not Authorization| return Failure| | filename as| endpoint return ParameterError| | file supported| endpoint return ParameterError| | Form File Uploadexceeds 100MB| endpoint return ParameterError| | `PUT Failure| localized example textuploadUrl,Content-Type, RequestMethod asPUT` |

Updated 2026-09-02