AddFile
Imports a file from the temporary storage space of Alibaba Cloud Model Studio into a data connection (formerly known as application data).
Operation description
- To call this API, a RAM user (sub-account) must first obtain the API permissions for Alibaba Cloud Model Studio (the
AliyunBailianDataFullAccesspolicy, which includes thesfm:AddFilepermission) and join a business space. An Alibaba Cloud account (primary account) can call this API directly without authorization. We recommend using the latest Alibaba Cloud Model Studio SDK to call this API. - This API is not idempotent.
Throttling: Frequent calls to this API are subject to throttling. Do not exceed a rate of 10 calls per second. If your request is throttled, try again later.
Try it now
You can run this API directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After the API runs successfully, OpenAPI Explorer can automatically generate SDK code examples.
RAM authorization
The following table lists the authorization information for this API. You can use it in the Action element of a RAM policy statement to grant RAM users or RAM roles the permission to call this API. Details:
-
Action: the specific permission point.
-
Access level: the access level of each operation. Valid values: Write, Read, or List.
-
Resource type: the resource types that support authorization for the operation. Details:
- Required resource types are marked with a preceding asterisk (*).
- For operations that do not support resource-level authorization,
All Resourcesis shown.
-
Condition key: the condition keys defined by the cloud service itself.
-
Dependent action: other permissions required for the operation to succeed. The caller must have the permissions of all dependent actions before the operation can succeed.
Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
sfm:AddFile | create | *All Resource
| None | None |
Request syntax
PUT /{WorkspaceId}/datacenter/file HTTP/1.1
Path parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The ID of the workspace to which the file will be uploaded. For information about how to obtain the workspace ID, see How to use workspaces. | llm-3shx2gu255oqxxxx |
Request parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| LeaseId | string | Yes | The upload lease ID. This value maps to the | 68abd1dea7b6404d8f7d7b9f7fbd332d.17166xxxxxxxx |
| Parser | string | Yes | The type of parser. Valid values:
If CategoryType is set to UNSTRUCTURED, the parser parses your uploaded file based on the category’s data parsing settings.If CategoryType is set to SESSION_FILE, the system uses a default parsing method that cannot be changed. | AUTO_SELECT |
| CategoryId | string | Yes |
| cate_cdd11b1b79a74e8bbd675c356a91ee35xxxxxxxx |
| Tags | array | No |
| |
string | No | A tag for the file. Each tag can be up to 32 characters long and can contain Unicode letters (including English letters, Chinese characters, and digits), underscores (_), and hyphens (-). | Product introduction | |
| CategoryType | string | No | The type of category. This parameter is optional. Default value:
| UNSTRUCTURED |
| OriginalFileUrl | string | No | The URL of the file. The system records this link when building a document retrieval-based knowledge base. When you interact with an agent in the Alibaba Cloud Model Studio console, this URL is returned with the retrieval results for the file in the For this parameter to take effect, the knowledge base feature must be enabled for the agent, and the display the source of the answer option must be enabled. | |
| ParserConfig | object | No | The parser configuration. This parameter is required only when the parser type is set to Qwen-VL parsing. | |
| ModelName | string | No | The model name. | qwen3-vl-plus |
| ModelPrompt | string | No | The prompt to use when calling the Qwen-VL parser. | # Role You are a professional image content annotator, skilled at recognizing and describing the content of images. # Task Based on the input image, describe its content in detail. |
Response elements
Element | Type | Description | Example |
|---|---|---|---|
object | Schema of Response | ||
| Code | string | The error code. | DataCenter.FileTooLarge |
| Data | object | The data returned for the request. | |
| FileId | string | The ID of the file. Save this ID for use in subsequent API calls involving this file. | file_9a65732555b54d5ea10796ca5742ba22_xxxxxxxx |
| Parser | string | The type of parser used to parse the file. Possible values:
| DASHSCOPE_DOCMIND |
| Message | string | The error message. | User not authorized to operate on the specified resource. |
| RequestId | string | The request ID. | 778C0B3B-xxxx-5FC1-A947-36EDD13606AB |
| Status | string | The status code of the request. | 200 |
| Success | string | Indicates whether the API call was successful. Valid values:
| true |
Examples
Success response
JSON format
{
"Code": "DataCenter.FileTooLarge",
"Data": {
"FileId": "file_9a65732555b54d5ea10796ca5742ba22_xxxxxxxx",
"Parser": "DASHSCOPE_DOCMIND"
},
"Message": "User not authorized to operate on the specified resource.",
"RequestId": "778C0B3B-xxxx-5FC1-A947-36EDD13606AB",
"Status": "200",
"Success": "true"
}
Error codes
For more error codes, visit the Error Center.
Release notes
For more information, see Change details.