AddFilesFromAuthorizedOss
Imports files from an authorized OSS Bucket into Alibaba Cloud Model Studio (Bailian) application data.
Operation description
-
Please ensure that the OSS Bucket and Alibaba Cloud Model Studio belong to the same Alibaba Cloud account (main account) and that authorization has been completed according to the Configuration instructions for importing data from OSS.
- Supported Bucket storage types do not include Archive, Cold Archive, or Deep Cold Archive. Buckets with content encryption are supported. Public read/write, public read, and private Buckets are supported.
- If you want to use a Bucket with Referer hotlink protection enabled, refer to Allow access only from trusted websites to add the domain
*.console.aliyun.comto the Referer allowlist.
-
A RAM user (sub-account) must first obtain the API permissions for Alibaba Cloud Model Studio (requires
AliyunBailianDataFullAccess, which includes the sfm:AddFilesFromAuthorizedOss permission point) and join a workspace before calling this operation. The Alibaba Cloud account (main account) can call this directly without authorization. We recommend that you call this operation through the latest version of the Alibaba Cloud Model Studio SDK. -
This operation is not idempotent.
Throttling description: Frequent calls to this operation will be throttled. The frequency should not exceed 5 calls per second. If throttled, please try again later.
Try it now
You can run this operation directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After the operation runs successfully, OpenAPI Explorer can automatically generate SDK code examples.
RAM authorization
The table below describes the authorization information for this API. You can use it in the Action element of RAM permission policy statements to grant RAM users or RAM roles the permission to call this API. Details:
-
Action: refers to the specific permission point.
-
Access level: refers to the access level of each action. Valid values: Write, Read, or List.
-
Resource type: refers to the resource types that support authorization for the action. Details:
- For required resource types, an asterisk (*) is added as a prefix.
- For operations that do not support resource-level authorization,
All Resourcesis used.
-
Condition key: refers to the condition keys defined by the cloud service itself.
-
Dependent action: refers to other permissions required to successfully perform the action. The operator must also have the permissions of the dependent actions for the operation to succeed.
Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
sfm:AddFilesFromAuthorizedOss | create | *All Resource
| None | None |
Request syntax
POST /{WorkspaceId}/datacenter/file/fromoss HTTP/1.1
Path Parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| WorkspaceId | string | Yes | The workspace ID. Files will be imported into this workspace. For how to obtain it, see How to use workspaces. | llm-3z7uw7fwz0vxxxx |
Request parameters
Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| CategoryId | string | Yes | Specifies the target category for file import. This is the | cate_cdd11b1b79a74e8bbd675c356a91ee35xxxxxxxx |
| CategoryType | string | Yes | Category type. Optional. The default value is UNSTRUCTURED. Valid values:
This operation does not support importing SESSION_FILE used for agent application session interaction. Please use the AddFile operation to upload SESSION_FILE from local. Valid values:
| UNSTRUCTURED |
| OssRegionId | string | Yes | The region ID of the OSS Bucket. For how to obtain it, see OSS regions and endpoints. | cn-beijing |
| OssBucketName | string | Yes | The OSS Bucket name. For details, see Buckets. | bucketNamexxxxx |
| FileDetails | array<object> | Yes | The list of files to import. Up to 10 files can be uploaded at a time. Up to 10 files can be uploaded at a time. | |
array<object> | Yes | File object. | ||
| FileName | string | Yes | The name of the file to import. Note that the suffix must include the file format type.
When the imported file name duplicates an existing file name in the knowledge base, the operation still returns Status as SUCCESS, but the file will not actually be imported into the knowledge base, and the existing file with the same name remains unchanged. Please ensure that each imported file name is unique.To add a new data table and upload data, please use the Alibaba Cloud Model Studio console; the API does not support this. | this_is_temp_xxxx.pdf |
| OssKey | string | Yes | The key name (Key) of the imported file in the OSS Bucket. For details, see Object naming. | root/path/this_is_temp_xxxx.pdf |
| Parser | string | No | Parser type. Possible values include:
When CategoryType is UNSTRUCTURED, the parser parses your uploaded files according to the data parsing settings of the current category. When CategoryType is SESSION_FILE, the system uses the default method (not changeable) to parse file content. | AUTO_SELECT |
| ParserConfig | object | No | Parser configuration. Required only when the parser type is set to Qwen VL parsing. | |
| ModelName | string | No | Model name. | qwen3-vl-plus |
| ModelPrompt | string | No | The prompt used when invoking Qwen VL parsing. | # Role You are a professional image content annotator, skilled at recognizing and describing the content of images. # Task Goal Based on the input image, describe its content in detail. |
| Tags | array | No | The list of tags associated with the file. The default is empty, meaning the file is not associated with any tags. Up to 10 tags can be passed in. | |
string | No | The tag of the file. Each tag can contain up to 12 characters, supporting characters in the Unicode letter category (including English, Chinese, numbers, etc.), underscores (_), and hyphens (-). | Product Introduction | |
| OverWriteFileByOssKey | boolean | No | Whether to overwrite the same file in the category by OssKey. The default value is false, meaning no overwrite. | false |
Response elements
Element | Type | Description | Example |
|---|---|---|---|
object | Schema of Response | ||
| Code | string | Error status code. | success |
| Data | object | Business data field returned by the operation. | |
| AddFileResultList | array<object> | The list of file import results. | |
object | The list of file import results. | ||
| FileId | string | The file ID. Store this ID securely. It is required for subsequent API operations on this file. | file_809f469a59ac449586ec692576xxxxx_102248XXX |
| OssKey | string | The key of the imported file in the OSS bucket. | root/path/this_is_temp_xxxx.pdf |
| Status | string | The import status of the file. Valid values:
Only files with a status of | SUCCESS |
| Msg | string | The error message returned when the file import fails. | size too large |
| Message | string | Error information. | Cant find out category for category_id param. |
| RequestId | string | The ID of the request. | 17204B98-xxxx-4F9A-8464-2446A84821CA |
| Status | string | The status code returned by the operation. | 200 |
| Success | string | Whether the operation call succeeded. Possible values:
| true |
Examples
Success response
JSON format
{
"Code": "success",
"Data": {
"AddFileResultList": [
{
"FileId": "file_809f469a59ac449586ec692576xxxxx_102248XXX",
"OssKey": "root/path/this_is_temp_xxxx.pdf",
"Status": "SUCCESS",
"Msg": "size too large"
}
]
},
"Message": "Cant find out category for category_id param.",
"RequestId": "17204B98-xxxx-4F9A-8464-2446A84821CA",
"Status": "200",
"Success": "true"
}
Error codes
See Error Codes for a complete list.
Release notes
For more information, see Change details.