All Products
Search
Document Center

Alibaba Cloud Model Studio:AddFilesFromAuthorizedOss

Last Updated:Jul 07, 2026

Imports files from an authorized OSS bucket into Alibaba Cloud Model Studio application data.

Operation description

  • Make sure the OSS bucket belongs to the same Alibaba Cloud account as Model Studio and that authorization has been completed as described in Importing data from OSS configuration instructions.

    • Supported bucket storage types do not include Archive, Cold Archive, or Deep Cold Archive. Buckets with content encryption enabled are supported. Buckets with public read/write, public read, or private access are supported.

    • To use a bucket with Referer-based hotlink protection enabled, add the domain name *.console.aliyun.com to the Referer whitelist as described in Allow access only from trusted websites.

  • Resource Access Management (RAM) users must first obtain API permissions for Model Studio (the AliyunBailianDataFullAccess permission is required, which includes the sfm:AddFilesFromAuthorizedOss permission) and join a workspace before invoking this operation. Alibaba Cloud accounts can invoke this operation directly without authorization. Call this operation by using the latest Model Studio SDK.

  • This operation does not have idempotence.

Rate limit: This operation is throttled if called too frequently. Do not exceed 5 calls per second. If throttled, retry 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.

Test

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 Action element 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 Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • 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: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 are imported into this workspace. For more information about how to obtain the workspace ID, see How to use a workspace.

llm-3z7uw7fwz0vxxxx

Request parameters

Parameter

Type

Required

Description

Example

CategoryId

string

Yes

The ID of the category to which the files are imported. This is the CategoryId returned by the AddCategory operation. You can also obtain the category ID by clicking the ID icon next to the category name on the Application Data - Files tab. You can pass in default to use the system-created default category.

cate_cdd11b1b79a74e8bbd675c356a91ee35xxxxxxxx

CategoryType

string

Yes

The category type. Optional. Default value: UNSTRUCTURED. Valid values:

  • UNSTRUCTURED: category for building knowledge base scenarios.

Valid values:

  • UNSTRUCTURED :

    UNSTRUCTURED

UNSTRUCTURED

OssRegionId

string

Yes

The region ID of the OSS bucket. For more information, see OSS regions and endpoints.

cn-beijing

OssBucketName

string

Yes

The name of the OSS bucket. For more information, see Buckets.

bucketNamexxxxx

FileDetails

array<object>

Yes

The list of files to import. A maximum of 10 files can be uploaded at a time.

Note

A maximum of 10 files can be uploaded at a time.

array<object>

Yes

The file object.

FileName

string

Yes

The name of the file to import. The file name must include the file format extension.

  • Supported formats: pdf, docx, doc, txt, md, pptx, ppt, xlsx, xls, html, png, jpg, jpeg, bmp, and gif.

  • The file name must be 4 to 128 characters in length.

  • For file upload requirements and limits, see Knowledge base quotas and limits.

Important If the name of the imported file is the same as an existing file in the knowledge base, the operation still returns a Status of SUCCESS, but the file is not actually imported. The existing file with the same name remains unchanged. Make sure that each imported file name is unique.
Note

To create a data table and upload data, use the Model Studio console. This is not supported through the API.

this_is_temp_xxxx.pdf

OssKey

string

Yes

The key of the file in the OSS bucket. For more information, see Object naming conventions.

root/path/this_is_temp_xxxx.pdf

Parser

string

No

The parser type. Valid values:

  • DOCMIND: intelligent document parsing.

  • DOCMIND_DIGITAL: electronic document parsing.

  • DOCMIND_LLM_VERSION: LLM-based document parsing.

  • DASH_QWEN_VL_PARSER: Qwen VL parsing.

  • DOCMIND_LLM_VERSION_MEDIA: audio and video parsing.

  • AUTO_SELECT: automatic parser selection.

Note The uploaded file is parsed by using the specified parser. If you set this parameter to AUTO_SELECT, the parser configured for the category is used.

AUTO_SELECT

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.

qwen-vl-max

ModelPrompt

string

No

The prompt used when calling Qwen VL parsing.

#角色 你是一个专业的图片内容标注人员,擅长识别并描述出图片中的内容。 # 任务目标 请结合输入图片,详细描述图片中的内容。

Tags

array

No

The list of tags associated with the file. Default value: empty, which means the file is not associated with any tags. A maximum of 10 tags can be specified.

string

No

The tag of the file. Each tag can be up to 12 characters in length and supports characters in the Unicode letter category (including English letters, Chinese characters, and digits), underscores (_), and hyphens (-).

产品介绍

OverWriteFileByOssKey

boolean

No

Specifies whether to overwrite files with the same OssKey in the category. Default value: false, which means files are not overwritten.

false

Response elements

Element

Type

Description

Example

object

Schema of Response

Code

string

The error code.

success

Data

object

The 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. Please keep this value safe, as it will be used for all subsequent API operations related to this file.

file_809f469a59ac449586ec692576xxxxx_102248XXX

OssKey

string

The key name (Key) of the imported file in the OSS Bucket.

root/path/this_is_temp_xxxx.pdf

Status

string

File import status. Possible values:

  • SUCCESS: Import (application data) completed.

  • FAILED: Import (application data) failed.

Note

Only files with the SUCCESS status can be used to create or update knowledge bases.

SUCCESS

Msg

string

Error information returned when file import fails.

size too large

Message

string

The error message.

Cant find out category for category_id param.

RequestId

string

The request ID.

17204B98-xxxx-4F9A-8464-2446A84821CA

Status

string

The status code returned by the operation.

200

Success

string

Indicates whether the call was successful. Valid values:

  • true: Successful.

  • false: Failed.

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

See Release Notes for a complete list.