OpenAI 更新组织用户
2026-11-19 17:49 更新
更新组织用户
post /organization/users/{user_id}
修改用户在组织中的角色。
路径参数
user_id: string
用户 ID。
请求体参数
内容类型为 application/json。
developer_persona: optional string or null
开发者画像元数据。
role: optional string or null
owner or reader
role_id: optional string or null
要分配给用户的角色 ID。
technical_level: optional string or null
技术水平元数据。
返回值
OrganizationUser object { id, added_at, object, 13 more }
表示组织内的一名用户。
id: string
可在 API 端点中引用的标识符。
added_at: integer
用户加入组织时的 Unix 时间戳,单位为秒。
format: unixtime
object: "organization.user"
对象类型,固定为 organization.user。
"organization.user"
api_key_last_used_at: optional integer or null
用户上次使用 API 密钥时的 Unix 时间戳,单位为秒。
format: unixtime
created: optional integer
用户创建时的 Unix 时间戳,单位为秒。
format: unixtime
developer_persona: optional string or null
用户的开发者画像元数据。
email: optional string or null
用户的电子邮件地址。
is_default: optional boolean
用户是否为组织的默认用户。
is_scale_tier_authorized_purchaser: optional boolean or null
用户是否为 Scale Tier 的授权购买者。
is_scim_managed: optional boolean
用户是否由 SCIM 管理。
is_service_account: optional boolean
用户是否为服务账户。
name: optional string or null
用户的姓名。
projects: optional object { data, object } or null
若响应包含此字段,则列出用户关联的项目。
data: array of object { id, name, role }
id: optional string or null
name: optional string or null
role: optional string or null
object: "list"
"list"
role: optional string or null
owner or reader
technical_level: optional string or null
用户的技术水平元数据。
user: optional object { id, object, banned, 5 more }
嵌套的用户详情。
id: string
object: "user"
"user"
banned: optional boolean or null
banned_at: optional integer or null
format: unixtime
email: optional string or null
enabled: optional boolean or null
name: optional string or null
picture: optional string or null
示例
## 从环境变量读取管理员密钥。核对目标用户和要分配的组织角色
curl -X POST "https://api.openai.com/v1/organization/users/user_abc" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"role": "owner"
}'
响应示例
{
"object": "organization.user",
"id": "user_abc",
"name": "First Last",
"email": "user@example.com",
"role": "owner",
"added_at": 1711471533
}以上内容是否对您有帮助:

TRAE-AI编程


更多建议: