Skip to main content

Batch Update File Tags

Update tags on multiple files in one call. Supports overwrite and append modes.

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

Endpoint

POST /api/v1/connector/dash/batchUpdateFileTag Update tags on multiple files in one call. Supports overwrite and append modes.
The two updateMode values: OVERWRITE replaces a file's existing tags entirely; APPEND adds to the existing tags.

Request body

FieldRequiredTypeDescription
fileInfosYesarray<object>File tag information list, 1 to 20 elements. Each element is an object with required sub-fields: fileId (string, file ID. Returned by listFile), tags (array<string>, tags associated with the file. Up to 100 tags; the total length of all tags must not exceed 700 characters; each tag is at most 32 characters).
updateModeNostringUpdate mode: OVERWRITE (replace existing tags), APPEND (add to existing tags).

Request example

curl -X POST "$BASE_URL/api/v1/connector/dash/batchUpdateFileTag" \
  -H "Authorization: Bearer $BAILIAN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fileInfos": [
      {"fileId": "file_abc123", "tags": ["产品", "V2"]},
      {"fileId": "file_def456", "tags": ["FAQ"]}
    ],
    "updateMode": "OVERWRITE"
  }'
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.
dataobjectPer-file update results. Sub-field: results (array<object>, list of per-file update results. Each element is an object with fields: fileId (string, file ID), success (boolean, whether tags were updated successfully for this file)).
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