Skip to main content

Import from OSS

Batch-import files from an authorized Alibaba Cloud OSS bucket. Before calling, grant Model Studio access to OSS via a service-linked role (SLR).

Prerequisites

You have an Alibaba Cloud Model Studio API key (see the API Key page in the console) and authentication configured. For details, see RAG API overview and Authentication. Data import endpoints use the same base URL and authentication as other RAG APIs, with the path prefix /api/v1/connector/dash/.
Before using this endpoint, grant Alibaba Cloud Model Studio access to your OSS bucket via a service-linked role (SLR). Confirm in the Alibaba Cloud RAM console that the AliyunServiceRoleForBailian SLR has been created — otherwise the call returns a permission error.

Endpoint

POST /api/v1/connector/dash/addFilesFromAuthorizedOss Batch-import files from an authorized Alibaba Cloud OSS bucket. Before calling, grant Model Studio access to OSS via a service-linked role (SLR).

Request body

FieldRequiredTypeDescription
categoryIdYesstringCategory ID. Returned by listCategory.
categoryTypeYesstringCategory type. Defaults to UNSTRUCTURED. Enum: UNSTRUCTURED, SESSION_FILE.
ossBucketYesstringOSS bucket name.
ossRegionIdYesstringOSS region, for example cn-beijing.
fileDetailsYesarray<object>Files to import, 1 to 10 elements. Each element is an object with sub-fields: fileName (string, required, file name after import, 1 to 500 characters), ossKey (string, required, OSS object key (path of the file in the bucket), 1 to 256 characters), parser (string, parser type. Defaults to AUTO_SELECT. AUTO_SELECT picks a parser automatically; DOCMIND intelligent document parsing; DOCMIND_DIGITAL digital document parsing; DOCMIND_LLM_VERSION LLM-based document parsing; DASH_QWEN_VL_PARSER Qwen VL parsing (requires parserConfig); DOCMIND_LLM_VERSION_MEDIA audio and video parsing. When categoryType is UNSTRUCTURED, files are parsed according to the category's data parsing settings; when it is SESSION_FILE, the system uses its default parsing method, which cannot be changed), parserConfig (object, parser configuration. Required only when parser is DASH_QWEN_VL_PARSER; not needed for other parsers. Sub-fields: modelName (string, visual parsing model; enum qwen3-vl-plus), modelPrompt (string, parsing prompt, 1 to 1500 characters)).
tagsNoarray<string>Tags associated with the files. Up to 10 tags.
overWriteFileByOssKeyNobooleanWhether to overwrite an existing file with the same ossKey. Defaults to false.

Request example

curl -X POST "$BASE_URL/api/v1/connector/dash/addFilesFromAuthorizedOss" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "categoryId": "cate_abc123",
    "categoryType": "UNSTRUCTURED",
    "ossBucket": "my-docs-bucket",
    "ossRegionId": "cn-beijing",
    "fileDetails": [
      {"fileName": "product-guide.pdf", "ossKey": "docs/product-guide.pdf"},
      {"fileName": "faq.docx", "ossKey": "docs/faq.docx"}
    ]
  }'
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the Workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API key.

Response example

Returns 200 on success.
{
  "code": "Success",
  "status_code": 200,
  "data": {},
  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response fields

FieldTypeDescription
codestringResponse code. Success on success.
messagestringError or informational message; an empty string on success.
requestIdstringUnique request identifier. Include this ID when reporting an issue.
dataobjectImport result. Sub-field: fileIds (array<string>, IDs of the successfully imported files).
statusintegerBusiness status code. 200 on success, 400 for failures such as invalid parameters. Note that the HTTP status code remains 200 even on failure, so rely on this field and code to determine the result.

Error codes

HTTP status codeError code codeDescription
400InvalidParameterInvalid request parameters. Example message: Required parameter missing or invalid.
401InvalidApiKeyAuthentication failed; the API key is invalid or missing. Example message: Invalid API-key provided.
On business failures the HTTP status code remains 200. Check status and code in the response body to determine the result.
Managed Agent API
Flow Agent API
Sandbox API
Long-term Memory
ParseX API
Security API
Framework Integration