Skip to main content

Batch Update File ACL

Batch overwrite or append ACL identity tags for files in a file dataset. Only manual-upload and OSS files are processed.

Prerequisites

You have an Alibaba Cloud Model Studio API key (see the API Key page in the console) and authentication configured. For details, see Knowledge (formerly RAG) API overview and Authentication. Data import endpoints use the same base URL and authentication as other Knowledge (formerly RAG) APIs, with the path prefix /api/v1/connector/dash/. The current Workspace must support ACL, and ACL must be enabled for the target FILE dataset.

Endpoint

POST /api/v1/connector/dash/batchUpdateFileAcl Batch overwrite or append ACL identity tags for files in a file dataset. Only manual-upload and OSS files are processed. Read-only sources are skipped and have no corresponding result item.

Request body

FieldRequiredTypeDescription
connectorIdYesstringID of the target file dataset.
codeListYesarray<string>1 to 100 non-empty file codes. Use the fileId from the file list or file details. Duplicate codes are processed only once.
updateModeNostringDefaults to REPLACE, which overwrites existing permissions with the tags in this request. APPEND adds tags per file and deduplicates. Values are case-sensitive.
aclScopeYesarray<string>This field must be provided. Explicit null is treated as []. With REPLACE, [] clears permissions; with APPEND, [] keeps existing values. Files that exceed 2000 tags after appending return an item-level failure. For the tag format, see Describe File.

Request example

curl -X POST "$BASE_URL/api/v1/connector/dash/batchUpdateFileAcl" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "connectorId": "conn_abc123",
    "codeList": ["file_abc123", "file_def456"],
    "updateMode": "REPLACE",
    "aclScope": ["u:bailian:10086", "d:bailian:4521"]
  }'
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": {
    "results": [
      {"fileId": "file_abc123", "success": true},
      {"fileId": "file_def456", "success": true}
    ]
  },
  "requestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Response fields

FieldTypeDescription
codestringResponse code. Success on success. If the whole request fails validation, returns a business error code.
messagestringError or informational message; an empty string on success. If the whole request fails validation, describes the reason.
requestIdstringUnique request identifier. Include this ID when reporting an issue.
dataobjectPer-file processing results. Sub-field: results (array<object>, per-file results returned after the request passes validation. Read-only sources are skipped and have no corresponding item; if all are skipped, returns []. Each element is an object with fields: fileId (string, file code corresponding to codeList), success (boolean, true means the file was processed successfully. If the file does not exist, is deleted, or belongs to another dataset, this item returns false and other files continue to be processed), errorCode (string, business error code for this file when it fails), errorMessage (string, failure reason for this file when it fails)).
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. If the whole request fails validation, read the outer code and message. If an individual file fails, read errorCode and errorMessage in the corresponding data.results[] item.