Update User Profile
post /v1/user_profiles/{user_profile_id}
Update User Profile
Path Parameters
user_profile_id: string
Header Parameters
-
"anthropic-beta": optional array of AnthropicBeta可选的请求头,用于指定要使用的 beta 版本。
-
string -
"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 22 more-
"message-batches-2024-09-24" -
"prompt-caching-2024-07-31" -
"computer-use-2024-10-22" -
"computer-use-2025-01-24" -
"pdfs-2024-09-25" -
"token-counting-2024-11-01" -
"token-efficient-tools-2025-02-19" -
"output-128k-2025-02-19" -
"files-api-2025-04-14" -
"mcp-client-2025-04-04" -
"mcp-client-2025-11-20" -
"dev-full-thinking-2025-05-14" -
"interleaved-thinking-2025-05-14" -
"code-execution-2025-05-22" -
"extended-cache-ttl-2025-04-11" -
"context-1m-2025-08-07" -
"context-management-2025-06-27" -
"model-context-window-exceeded-2025-08-26" -
"skills-2025-10-02" -
"fast-mode-2026-02-01" -
"output-300k-2026-03-24" -
"user-profiles-2026-03-24" -
"advisor-tool-2026-03-01" -
"managed-agents-2026-04-01" -
"cache-diagnosis-2026-04-07"
-
-
Body Parameters
-
external_id: optional string如果提供,将替换存储的 external_id。省略则保持不变。最多 255 个字符。
-
metadata: optional map[string]要合并到存储元数据中的键值对。提供的键将覆盖现有值。要删除某个键,请将其值设置为空字符串。未提供的键保持不变。最多 16 个键,键最多 64 个字符,值最多 512 个字符。
-
name: optional string如果提供,将替换存储的名称。省略则保持不变。最多 255 个字符。
-
relationship: optional "external" or "resold" or "internal"用户配置文件背后的实体与拥有 API 密钥的平台之间的关系。
external:平台的个人终端用户。resold:平台向其转售 Claude 访问权限的公司。internal:平台自身的使用。-
"external" -
"resold" -
"internal"
-
Returns
-
BetaUserProfile object { id, created_at, metadata, 6 more }-
id: string此用户配置文件的唯一标识符,前缀为
uprof_。 -
created_at: stringRFC 3339 格式的时间戳
-
metadata: map[string]任意键值元数据。最多 16 对,键最多 64 个字符,值最多 512 个字符。
-
relationship: "external" or "resold" or "internal"用户配置文件背后的实体与拥有 API 密钥的平台之间的关系。
external:平台的个人终端用户。resold:平台向其转售 Claude 访问权限的公司。internal:平台自身的使用。-
"external" -
"resold" -
"internal"
-
-
trust_grants: map[BetaUserProfileTrustGrant]此配置文件的信任授权,按授权名称作为键。当没有活跃或进行中的授权时,键将被省略。
-
status: "active" or "pending" or "rejected"信任授权的状态。
-
"active" -
"pending" -
"rejected"
-
-
-
type: "user_profile"对象类型。始终为
user_profile。"user_profile"
-
updated_at: stringRFC 3339 格式的时间戳
-
external_id: optional string平台为此用户自有的标识符。不强制唯一。
-
name: optional string此配置文件所代表实体的显示名称。对于
resold,这是转售公司的名称。
-
Example
curl https://api.anthropic.com/v1/user_profiles/$USER_PROFILE_ID \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
-H 'anthropic-beta: user-profiles-2026-03-24' \
-H "X-Api-Key: $ANTHROPIC_API_KEY" \
-d '{
"external_id": "user_12345"
}'
Response
{
"id": "uprof_011CZkZCu8hGbp5mYRQgUmz9",
"created_at": "2026-03-15T10:00:00Z",
"metadata": {},
"relationship": "external",
"trust_grants": {
"cyber": {
"status": "active"
}
},
"type": "user_profile",
"updated_at": "2026-03-15T10:00:00Z",
"external_id": "user_12345",
"name": "Example User"
}