cURL
鉴权
string
header
必填
DashScope API Key
路径参数
string
必填
Vault ID,格式 vlt_xxx
在密钥库中创建密钥
curl --request POST \
--url 'https://dashscope.aliyuncs.com/api/v1/agentstudio/vaults/{vault_id}/credentials' \
--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-xxxx",
"networking": {
"allowed_hosts": [
"api.example.com",
"*.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",
"*.example.com"
]
},
"injection_location": {
"header": true
}
},
"metadata": {},
"archived_at": null,
"created_at": "2026-07-10T08:00:00Z",
"updated_at": "2026-07-10T08:00:00Z",
"request_id": "req_xxx"
}DashScope API Key
Vault ID,格式 vlt_xxx
认证信息,固定为 environment_variable 类型。
显示子属性
固定为 environment_variable
环境变量名称,创建后不可修改
环境变量值,仅写入时传入,响应中不返回
网络策略,限制只有发往指定域名的请求才会被替换为真实密钥
显示子属性
允许替换真实密钥的域名列表,支持 *.example.com 通配子域,最多 10 个。填 * 对全部域名生效
[
"api.example.com",
"*.example.com"
]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' \
--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-xxxx",
"networking": {
"allowed_hosts": [
"api.example.com",
"*.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",
"*.example.com"
]
},
"injection_location": {
"header": true
}
},
"metadata": {},
"archived_at": null,
"created_at": "2026-07-10T08:00:00Z",
"updated_at": "2026-07-10T08:00:00Z",
"request_id": "req_xxx"
}