更新 API 密钥
post /v1/organizations/api_keys/{api_key_id}
更新 API 密钥
路径参数
-
api_key_id: stringAPI 密钥的 ID。
请求体参数
-
name: optional stringAPI 密钥的名称。
-
status: optional "active" or "inactive" or "archived"API 密钥的状态。
-
"active" -
"inactive" -
"archived"
-
返回值
-
APIKey object { id, created_at, created_by, 6 more }-
id: stringAPI 密钥的 ID。
-
created_at: stringRFC 3339 日期时间字符串,表示 API 密钥的创建时间。
-
created_by: object { id, type }创建该 API 密钥的操作者的 ID 和类型。
-
id: string创建该对象的操作者的 ID。
-
type: string创建该对象的操作者的类型。
-
-
expires_at: stringRFC 3339 日期时间字符串,表示 API 密钥的过期时间,如果永不过期则为
null。 -
name: stringAPI 密钥的名称。
-
partial_key_hint: stringAPI 密钥的部分脱敏提示。
-
status: "active" or "inactive" or "archived" or "expired"API 密钥的状态。
-
"active" -
"inactive" -
"archived" -
"expired"
-
-
type: "api_key"对象类型。
对于 API 密钥,此值始终为
"api_key"。"api_key"
-
workspace_id: string与 API 密钥关联的工作区 ID,如果 API 密钥属于默认工作区则为
null。
-
示例
curl https://api.anthropic.com/v1/organizations/api_keys/$API_KEY_ID \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
-H "X-Api-Key: $ANTHROPIC_ADMIN_API_KEY" \
-d '{}'
响应
{
"id": "apikey_01Rj2N8SVvo6BePZj99NhmiT",
"created_at": "2024-10-30T23:58:27.427722Z",
"created_by": {
"id": "user_01WCz1FkmYMm4gnmykNKUu3Q",
"type": "user"
},
"expires_at": "2024-10-30T23:58:27.427722Z",
"name": "Developer Key",
"partial_key_hint": "sk-ant-api03-R2D...igAA",
"status": "active",
"type": "api_key",
"workspace_id": "wrkspc_01JwQvzr7rXLA5AGx3HKfFUJ"
}