curl --request POST \
--url https://api.langdock.com/user-management/v1/update-user-role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "user@example.com",
"role": "editor",
"customRoleIds": [
"33333333-3333-4333-8333-333333333333"
]
}
'{
"status": "success",
"email": "user@example.com",
"role": "editor",
"customRoleIds": [
"33333333-3333-4333-8333-333333333333"
]
}Update User Role
Change an active member’s system role, and keep, replace, or clear their custom roles
curl --request POST \
--url https://api.langdock.com/user-management/v1/update-user-role \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "user@example.com",
"role": "editor",
"customRoleIds": [
"33333333-3333-4333-8333-333333333333"
]
}
'{
"status": "success",
"email": "user@example.com",
"role": "editor",
"customRoleIds": [
"33333333-3333-4333-8333-333333333333"
]
}member, editor, or admin. Pass custom role IDs in customRoleIds to replace that member’s custom roles.
The call is authorized by the workspace API key’s USER_MANAGEMENT_API scope. It does not run as the person who created the key, so it keeps working after that admin leaves the workspace.
Base URL
https://api.langdock.com/user-management/v1/update-user-role
api.langdock.com with <your-deployment-url>/api/public in all requests.Prerequisites
- API Key with the
USER_MANAGEMENT_APIscope - The API key must be created by a workspace admin
Behavior
- Omit
customRoleIds? Onmemberoreditor, the member’s current custom roles stay. - Send
customRoleIds? The list replaces those roles.[]removes every custom role. Send at most 15 IDs. Get them from List Roles. Duplicate IDs count toward that limit and are applied once. - An ID in
customRoleIdsis not a UUID, or the list has more than 15 IDs? Returns400and changes nothing. - Unknown, deleted, or another workspace’s custom role? Returns
400withcode: "BAD_REQUEST"and messageUnknown custom role. Nothing is written. - Promote to
admin? Custom roles and extra permissions are removed, even if you omitcustomRoleIds. customRoleIdsis not empty, androleisadmin? Returns400withcode: "BAD_REQUEST"and messageAdmins already have every permission. Custom roles can only be assigned to members and editors.Nothing is written.- Extra permissions on
memberoreditor? They stay. This call cannot set them. - The response
customRoleIdslists the custom roles the member has after the call, ordered by when each role was assigned. - Not an active human member? Returns
404(unknown email, invited, deactivated, service account, or another workspace). - Last remaining admin? Returns
400withcode: "BAD_REQUEST". - Repeating the member’s current role succeeds.
- Email matching is case-insensitive. Role values are lowercase:
member,editor,admin.ADMINreturns400.
Authorizations
API key as Bearer token. Format "Bearer YOUR_API_KEY"
Body
Email address of the active workspace member
"user@example.com"
Workspace system role. Values are lowercase.
member, editor, admin "editor"
Custom role UUIDs from GET /user-management/v1/roles. Omit the field
to keep the member's current custom roles, except when role is
admin. Send a list, including an empty list, to replace them.
At most 15 IDs. Duplicate IDs count toward that limit and are applied once.
System role names are not accepted.
15Response
Role updated successfully
Always "success" when the role is updated
success "success"
Email address of the updated member
"user@example.com"
System role after the update
member, editor, admin "editor"
Custom role IDs assigned to the member after this call, ordered by
when each role was assigned. Empty after a promotion to admin.
Was this page helpful?