cURL
鉴权
string
header
必填
DashScope API Key
更新密钥信息
curl --request POST \
--url 'https://dashscope.aliyuncs.com/api/v1/agentstudio/vaults/{vault_id}/credentials/{credential_id}' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '
{
"display_name": "生产环境 API 密钥",
"auth": {
"type": "environment_variable",
"secret_name": "API_KEY",
"secret_value": "sk-new-value",
"networking": {
"allowed_hosts": [
"api.example.com"
]
},
"injection_location": {
"header": true
}
}
}
'{
"id": "cred_xxx",
"type": "credential",
"vault_id": "vlt_xxx",
"display_name": "生产环境 API 密钥",
"auth": {
"type": "environment_variable",
"secret_name": "API_KEY",
"networking": {
"allowed_hosts": [
"api.example.com"
]
},
"injection_location": {
"header": true
}
},
"metadata": {},
"archived_at": null,
"created_at": "2026-07-10T08:00:00Z",
"updated_at": "2026-07-15T03:00:00Z",
"request_id": "req_xxx"
}DashScope API Key
认证信息,固定为 environment_variable 类型。更新时 type 与 secret_name 不可修改,secret_value 留空表示不修改。
显示子属性
固定为 environment_variable
环境变量名称,不可修改
网络策略,限制只有发往指定域名的请求才会被替换为真实密钥
显示子属性
允许替换真实密钥的域名列表,支持 *.example.com 通配子域,最多 10 个。填 * 对全部域名生效
[
"api.example.com",
"*.example.com"
]替换位置,标识密钥写入请求的位置。当前仅支持 Authorization 请求头,写入请求体暂不支持
显示子属性
是否写入 Authorization 请求头(Bearer 格式)
环境变量值,留空表示不修改,响应中不返回
Credential 可读名称,最大 255 字符
业务自定义键值对元数据
Credential ID,格式 cred_xxx
固定为 credential
所属 Vault ID
Credential 可读名称
业务自定义键值对
归档时间,未归档时为 null
创建时间,ISO 8601
最近更新时间,ISO 8601
请求唯一标识
curl --request POST \
--url 'https://dashscope.aliyuncs.com/api/v1/agentstudio/vaults/{vault_id}/credentials/{credential_id}' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '
{
"display_name": "生产环境 API 密钥",
"auth": {
"type": "environment_variable",
"secret_name": "API_KEY",
"secret_value": "sk-new-value",
"networking": {
"allowed_hosts": [
"api.example.com"
]
},
"injection_location": {
"header": true
}
}
}
'{
"id": "cred_xxx",
"type": "credential",
"vault_id": "vlt_xxx",
"display_name": "生产环境 API 密钥",
"auth": {
"type": "environment_variable",
"secret_name": "API_KEY",
"networking": {
"allowed_hosts": [
"api.example.com"
]
},
"injection_location": {
"header": true
}
},
"metadata": {},
"archived_at": null,
"created_at": "2026-07-10T08:00:00Z",
"updated_at": "2026-07-15T03:00:00Z",
"request_id": "req_xxx"
}