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 have the required API permissions for Alibaba Cloud Model Studio and be added to a workspace. The required policy is
AliyunBailianDataFullAccess, which includes thesfm:AddFilepermission. 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
Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.
RAM authorization
The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:
-
Action: The actions can be used in the
Actionelement of RAM permission policy statements to grant permissions to perform the operation. -
API: The API that you can call to perform the action.
-
Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.
-
Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
Resourceelement of the policy. - For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the
Resourceelement of the policy.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
-
Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.
-
Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.
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 where you want to upload the file. 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 (-). | 产品介绍 | |
| 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 if you set | |
| ModelName | string | No | The model name. | qwen-vl-max |
| 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 | The response object. | ||
| 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 parser that was used for the file. A possible value is:
| 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
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.