---
title: "Assign a role to a user"
method: POST
path: "/rbac/users/{userId}/roles"
tags: ["RBAC"]
---

# Assign a role to a user

`POST /rbac/users/{userId}/roles`

Assigns a role to a user.

## Path parameters

- `userId` string, required

## Request body

- object
  - `roleId` integer

## Response `200`

Role assigned successfully.

## Other responses

- `400` — Role ID is required.
- `403` — System roles cannot be manually assigned.
- `404` — User or role not found.
- `409` — Role already assigned.
- `500` — Failed to assign role.

---

[API](https://skmtc.dev/termix/apis/termix-api.md) · [All operations](https://skmtc.dev/termix/apis/termix-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/termix/termix-api/revisions/f4ef343eff1b/schema)
