Change the role or status of a Member
PATCH /v1/members/{member_id}
| Property | Value |
|---|---|
| Operation | update_member |
| Group | Members |
| Scope | members:write |
| Route class | control |
| Idempotency | No Idempotency-Key |
| Audit | Audited identity.member.update (mutation) |
| Released in | 1.12.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Applies the named fields at the revision If-Match names; disabled stops the Member signing in. From 1.51.0 a write that would leave the Organization without an owner (removing the only owner, demoting it to another role or disabling it) is refused with last_owner and one detail whose reason is a LastOwnerChange, and changes nothing. That rule is checked first; then a caller that is not an owner and removes, demotes or disables an owner is refused with forbidden and the detail owner_required, because only an owner changes an owner. From 1.34.0 a write that gives the operator role is refused with forbidden and the one detail operator_role_not_grantable, at path /role, in any Organization but the operator Organization, whoever asks, and there to any caller that does not hold the operator role; a write that keeps the role or takes it away is not a grant. Phase 0 accepts a Member ID token for this route, so an operator signed in to the cockpit makes the write.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the members:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X PATCH "$VOCAL_API/v1/members/mem_..." \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H 'If-Match: "1"' \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/members/mem_...`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'If-Match': '"1"',
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import requests
response = requests.patch(
f"{os.environ['VOCAL_API']}/v1/members/mem_...",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"If-Match": '"1"',
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
member_id | path | MemberId | yes | The id of a Member: mem_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
if-match | header | string | yes | The revision the change was made against, quoted as the ETag returns it, or * to overwrite. |
Request body
Content type application/json, required: MemberUpdateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
role | MemberRole | no | |
status | one of "active", "disabled" | no | disabled stops the Member signing in; active allows it again. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | Member | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | last_owner |
412 | application/json | ErrorEnvelope | revision_mismatch |
422 | application/json | ErrorEnvelope | validation_failed |
428 | application/json | ErrorEnvelope | precondition_required |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is Member.
| Field | Type | Required | Description |
|---|---|---|---|
created_at | Timestamp | yes | |
display_name | string or null | yes | A display name. |
email | string | yes | An email address, compared ignoring case. |
id | MemberId | yes | |
invitation_expires_at | Timestamp or null | no | When the invitation of an invited Member lapses (1.51.0): 72 hours after the invitation or the approval that created it. Null once the Member is active or disabled, and for a Member the seed created; absent from an api before 1.51.0. After it a sign-in with the email is refused with invitation_expired. |
invited_by | MemberId or null | no | The Member who invited or approved this Member (1.51.0), or null when the seed or an operator command created it; absent from an api before 1.51.0. |
last_sign_in_at | Timestamp or null | yes | The last sign-in, or null before the first. |
object | "member" | yes | |
revision | integer | yes | Counts writes to the Member; returned as the ETag and required in If-Match. |
role | MemberRole | yes | |
status | MemberStatus | yes | |
updated_at | Timestamp | yes |