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 |
models[].model | String | Yes | The model ID. Cannot be empty. Examples: |
models[].inference | Boolean | No | Model calling permission. |
models[].finetune | Boolean | No | Model training permission. |
models[].deploy | Boolean | No | Model deployment permission. |
access_all_entities | String | No | Authorize-all switch. Valid values:
When |
Response parameters
Parameter | Type | Description |
|---|---|---|
request_id | String | The request ID. Example: |
code | String | Error code. |
message | String | Error message. |
success | Boolean | Whether the call succeeded. Example: |
output | Object | Business data. |
Sample requests
Example 1: Per-model authorizationcurl -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.