Skip to main content

Import from OSS

Batch-import files from an authorized Alibaba Cloud OSS bucket into the data center.

POST
/api/v1/connector/dash/addFilesFromAuthorizedOss
cURL
curl -X POST "https://{workspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/connector/dash/addFilesFromAuthorizedOss" \
  -H "Authorization: Bearer $DASHSCOPE_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"}
    ]
  }'
{
  "code": "Success",
  "status_code": 200,
  "data": {},
  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
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.

Authorizations

string
header
required

DashScope API Key, obtained from the API Key page in the console.

Body

application/json
string
required

Category ID. Returned by listCategory.

enum<string>
default"UNSTRUCTURED"
required

Category type.

UNSTRUCTURED,SESSION_FILE
string
required

OSS bucket name.

string
required

OSS region, for example cn-beijing.

cn-beijing
object[]
required

Files to import.

items: 1–10
string[]

Tags associated with the files. Up to 10 tags.

items <= 10
boolean
defaultfalse

Whether to overwrite an existing file with the same ossKey. Defaults to false.

Response

200-application/json
string

Response code. Success on success.

string

Error or informational message; an empty string on success.

string

Unique request identifier. Include this ID when reporting an issue.

object

Import result.

integer

Business 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.