Skip to main content
PUT
Assign a role to a user
🔒 Admin only. Requires administrator privileges — the authenticated principal (API key, embed JWT, or any bearer token) must belong to a user with the admin role. Gives the user everything the role grants. Idempotent — assigning a role the user already holds changes nothing. Returns 404 if either the user or the role is unknown. Unlike the other endpoints here, this one is not limited to your custom roles: it also accepts the id of a built-in role, and assigning one grants everything that role confers. Cube’s Admin role is the exception and cannot be granted this way — it is not among the built-in roles this endpoint resolves, so its id returns 404. No call to this endpoint can make a user an account-wide administrator.

Authorizations

Authorization
string
header
required

Token authentication. Send Authorization: Bearer <YOUR_TOKEN>.

Path Parameters

roleId
number
required
userId
number
required

Response

Successful response