Set a user's roles
POST
/v1/users/{id}/roles
const url = 'http://localhost:8080/v1/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/roles';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"roles":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/v1/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/roles \ --header 'Content-Type: application/json' \ --data '{ "roles": [ "example" ] }'Replaces the user’s roles and revokes their refresh tokens so the change takes effect within one access-token lifetime; before/after are recorded as an auth event. Administrators only. 404 for an unknown user, 400 for an unknown role, 409 when removing your own admin role.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string format: uuid
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
roles
Array<string>
Examplegenerated
{ "roles": [ "example" ]}Responses
Section titled “Responses”OK
Media typeapplication/json
object
id
required
string format: uuid
email
required
string
displayName
required
string
roles
required
Array<string>
isActive
required
boolean
lastLoginAt
required
null | string format: date-time
totpEnrolled
required
boolean
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "email": "example", "displayName": "example", "roles": [ "example" ], "isActive": true, "lastLoginAt": "2026-04-15T12:00:00Z", "totpEnrolled": true}