Skip to main content
More

Update model permissions

Call the POST /api/v1/models/permissions endpoint to update model authorization (inference / fine-tuning / deployment) in a specified workspace. Both per-model authorization and "authorize all" modes are supported.

Prerequisites

An API key has been created and configured as the environment variable DASHSCOPE_API_KEY. For more information, see Configure an API key in environment variables.

Request

  • HTTP method: POST
  • Request URL
    Replace {WorkspaceId} with your workspace ID.

    Region

    Endpoint

    China (Beijing)

    https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/models/permissions

  • Authentication Set Authorization: Bearer {API_KEY} in the request header.

Request parameters

All parameters are passed through the request body.

Parameter

Type

Required

Description

models

Array[Object]

Conditionally required

List of per-model authorization items. Can be empty when access_all_entities is OPEN/CLOSE; required when it is KEEP or not specified, in which case the number of items must be 1 to 20. Example: [{"model":"qwen-plus","inference":true}]

models[].model

String

Yes

The model ID. Cannot be empty. Examples: qwen-plus, qwen3-max.

models[].inference

Boolean

No

Model calling permission. true = grant inference permission, false = revoke, not specified = keep unchanged. Default value: null (no change).

models[].finetune

Boolean

No

Model training permission. true = grant fine-tuning permission, false = revoke, not specified = keep unchanged. Default value: null (no change).

models[].deploy

Boolean

No

Model deployment permission. true = grant deployment permission, false = revoke, not specified = keep unchanged. Default value: null (no change).

access_all_entities

String

No

Authorize-all switch. Valid values:

  • OPEN: Authorize all inference models in the current workspace with one click (including models added later).

  • CLOSE: Cancel authorize-all and clear historical inference authorizations.

  • KEEP: Keep the original per-model authorization behavior (default).

When OPEN/CLOSE is passed, models can be omitted. Default value: KEEP. Example: OPEN

Response parameters

Parameter

Type

Description

request_id

String

The request ID. Example: d5f5201f-ee7a-9e3d-8569-bc0eedec21f9

code

String

Error code. null on success.

message

String

Error message. null on success.

success

Boolean

Whether the call succeeded. Example: true

output

Object

Business data. null for this endpoint.

Sample requests

Example 1: Per-model authorization
curl -X POST "https://dashscope.aliyuncs.com/api/v1/models/permissions" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{
        "models": [
            {"model": "qwen-plus", "inference": true, "fine_tune": true, "deploy": false},
            {"model": "qwen3-max", "inference": true}
        ]
    }'
Example 2: Authorize all
curl -X POST "https://dashscope.aliyuncs.com/api/v1/models/permissions" \
    --header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
    --header 'Content-Type: application/json' \
    --data '{"access_all_entities": "OPEN"}'

Sample response

Success example
{
    "code": null,
    "message": null,
    "success": true,
    "output": null,
    "request_id": "d5f5201f-ee7a-9e3d-8569-bc0eedec21f9"
}
Failure example
{
    "code": "InvalidParameter",
    "message": "Model qwen-xxx is not authorized for Inference",
    "success": false,
    "output": null,
    "request_id": "d5f5201f-ee7a-9e3d-8569-bc0eedec21f9"
}

Error codes

If the call fails, an error message is returned. For more information about error codes and solutions, see Error messages.