Skip to content

Assign a role to a user (admin)

PUT
/auth/users/{ref}/role
ref
required
integer format: int64
object
role_id
required
string format: uuid

Role assigned

Role change refused — would leave the system with zero users holding system.admin (last-admin invariant guard). Grant the capability to another user first.

object
error
required

Human-readable error summary

string
Example
the request could not be completed

Authentication required, missing, or invalid

object
error
required

Human-readable error summary

string
Example
the request could not be completed
Example
{
"error": "authentication required: sign in and retry with a valid session or API token"
}

Authenticated but missing required capabilities

object
error
required

Human-readable error summary

string
Example
the request could not be completed

Resource not found

object
error
required

Human-readable error summary

string
Example
the request could not be completed