/{app_slug}/v1/admin/users/{user_id}/roleAuthAssign an end-user a role
Sets `app_membership.role_id` for the target user. For M2M callers the assignable role is bounded by the token's scopes (the guard already enforced `role.assign`); the role's own permission set is NOT additionally narrowed against the M2M scopes because M2M scopes are typically broader than per-user role perms by design (a backend cron with `user.list` + `role.assign` SHOULD be able to promote a user into a role carrying any per-app perm). EndUser admins are bounded by their own role's perms transitively — they couldn't authenticate as an admin without holding the perm.
Path parameters
app_slug*stringSlug of the app.
user_id*stringId of the user.
Request body
role_name*stringTarget role name (must already exist in this app).
Example: "member"
Response · 200 Membership updated.
user_id*stringAccount UUID of the end-user whose role changed.
role_name*stringRole name now bound to the app membership.
Example: "admin"
Example
Request
PATCH https://api.auth.productcraft.co/{app_slug}/v1/admin/users/{user_id}/role
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"role_name": "member"
}Response
{
"user_id": "string",
"role_name": "admin"
}