身份验证
请将 API 密钥作为 bearer 令牌发送。该密钥必须具有 members.role.assign 权限;缺少该权限的密钥将被拒绝并返回 403 状态码,而非 404。
您的组织 ID 应填在此处
此端点直接在 URL 中接受您的组织 ID,即 orgId。请将其替换到路径中——没有其他标头或查询参数可以替代此操作。
您的组织ID位于控制面板的API密钥屏幕上,就在密钥本身的旁边。这是您在每次调用时使用的相同ID。
免费试用
将尖括号中的内容替换为您自己的值,并将键占位符替换为您仪表板中的一个键。
curl -X PATCH https://api.zinndigital.com/v1/orgs/{orgId}/members/{userId} \
-H "Authorization: Bearer zdk_live_…" \
-H "Content-Type: application/json" \
-d '{ "role": <string> }'已登录?您仪表板中的 API 控制台会自动填入您真实的组织 ID 和您自己的密钥,并针对实时 API 运行请求,以便您查看实际的响应。 在 API 控制台中打开此端点
详细信息
Sets this member's role in the organization. Requires `members.role.assign` **on that org**. ⛔ **Replaces** the member's roles with the one given rather than adding to them — a person may hold several `Membership` rows, and collapsing them can only ever reduce what they hold, so no path through this endpoint escalates by accident. Three refusals, and they are the same rules an invitation is held to: **403** if the member holds a permission the caller does not (`more_privileged`), **403** if the *role being granted* holds one (`role_not_grantable` — this is what stops any holder of the key promoting themselves to `owner`), and **409** for the org's last owner (`last_owner`). An unknown role is a **422**, never a 403, so a typo is distinguishable from a permission you lack.
参数
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
orgId (path) | Uuid | 是 | Organization ID (UUIDv7). |
userId (path) | Uuid | 是 | The user to remove from the organization. |
请求正文
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
role | string | 是 | A role key from `GET /v1/orgs/{orgId}/roles`. |
响应
| 名称 | 类型 | 必填 | 内容简介 |
|---|---|---|---|
user_id | Uuid | 是 | UUIDv7 identifier — sortable by creation time (docs/02 §8). |
email | string | 是 | — |
name | string | 是 | Display name; may be empty for an account that never set one. |
roles | string[] | 是 | Every role this person holds in this org, sorted. |
joined_at | string | 是 | When their EARLIEST membership of this org was created. |
is_self | boolean | 是 | Whether this row is the calling user. |
removable | boolean | 是 | — |
not_removable_reason | OrgMemberRemovalBlock | null | 是 | Why not, when `removable` is false. Null when removable — and also null for a caller lacking `members.remove`, because "you cannot remove anyone here" is a fact about the caller… |
role_assignable | boolean | 是 | Whether `PATCH` on this member would be accepted — the caller holds `members.role.assign` here, does not outrank themselves, and this is not the last owner. ⛔ *Which* role may t… |
此端点可能返回的错误
401 · 403 · 404 · 409 · 422 · 429