Skip to main content
File Management

Upload a file

Upload files to the Model Studio platform. You can upload multiple files at once and reuse them across different jobs.

Usage limits

The following usage limits apply when you use this service:
  • The maximum size of a single file varies by purpose: 150 MB for file-extract, 500 MB for batch, and 300 MB for fine-tune.
  • The total storage quota for active (not deleted) files is 100 GB.
  • The total number of active (not deleted) files is limited to 10,000.
For OpenAI-compatible calls, see the relevant documentation.
Fine-tuning files uploaded by using the fine-tune purpose are visible and available in both the Model Studio console model fine-tuning page and API calls.

Upload a file

POST https://dashscope-intl.aliyuncs.com/api/v1/files
Content-type: multipart/form-data

Request example

curl --request POST "https://dashscope-intl.aliyuncs.com/api/v1/files" \
  --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
  --form 'files=@"/path/to/your/file1.jsonl"' \
  --form 'purpose="fine-tune"'\
  --form 'descriptions="a sample fine-tune data file for qwen"' \
  --form 'files=@"/path/to/your/file2.jsonl"' \
  --form 'purpose="fine-tune"'\
  --form 'descriptions="a sample fine-tune data file for qwen"'

Request parameters

Parameter

Type

In

Required

Description

files

file stream

multipart/form-data

Yes

The file to upload. You can upload multiple files in one request.

purpose

string

multipart/form-data

No

Value

Purpose

fine-tune

Use the uploaded file_id for model fine-tuning. Training data for fine-tuning video or image generation models must be uploaded in .zip format (a single .zip package must not exceed 1 GB). You can also load data by using OSS mount: upload the entire uncompressed dataset folder to OSS. Zip files are not supported in this case.

file-extract

Use the uploaded file_id for content analysis.

batch

Use the uploaded file_id to create a batch job.

If you do not specify purpose, the file can still be uploaded successfully. We recommend that you explicitly specify purpose to manage files by usage later.

descriptions

file stream

multipart/form-data

No

A description of the file.

Response example

{
    "request_id": "xxx",
    "data": {
        "uploaded_files": [
            {
                "file_id": "9G2EaQtq7p1fw7oRhYXdHTtDFYAMVQSh95432B38CAB211EDB8F952C2E8001733",
                "name": "test.txt"
            }
        ],
        "failed_uploads": [
            {
                "name": "test1.jpg",
                "code": "BadRequest.TooLarge",
                "message": "Out of space, <839> B of <1024> B storage space has been used."
            },
            {
                "name": "test2.jpg",
                "code": "BadRequest.TooMany",
                "message": "Out of number, <10> of <10> files has been uploaded."
            }
        ]
    }
}

Response parameters

Parameter

Type

Description

data.failed_uploads

array

Information about files that failed to upload.

data.uploaded_files

array

Information about successfully uploaded files.

data.uploaded_files.$.file_id

string

The file ID, which can be used in the Retrieve file details and Delete file APIs.

data.uploaded_files.$.name

string

The file name.

request_id

string

The unique ID of the request.

Error responses

Response example

A non-200 HTTP status code indicates that the request failed. The following is an example of an error response.
{
    "request_id": "8f25f57c-5cc0-9881-9c83-62bc173dc9ad",
    "code": "InvalidParameter",
    "message": "File not found."
}

Response parameters

Parameter

Type

Description

code

string

The error code.

request_id

string

The unique ID of the request.

message

string

The error message.