---
title: "Replace User Assignments"
method: PUT
path: "/rbac/user-assignments"
tags: ["rbac"]
---

# Replace User Assignments

`PUT /rbac/user-assignments`

## Request

- Base URL: `https://platform.tracecat.com/api`
- URL: `https://platform.tracecat.com/api/rbac/user-assignments`
- Auth: one of:
  - API key in cookie `fastapiusersauth`
  - HTTP bearer

Save a member's staged direct role changes in one transaction.

## Request body

- UserRoleAssignmentsReplace: Replace a member's direct roles only if their access has not changed.
  - `user_id` string, uuid, required
  - `assignments` UserRoleAssignmentSpec[], required
    - `role_id` string, uuid, required
    - `workspace_id` string, uuid, nullable
  - `expected_assignments` RoleAssignmentSnapshot[], required
    - `role_id` string, uuid, required
    - `workspace_id` string, uuid, nullable
    - `id` string, uuid, required
  - `expected_group_assignments` RoleAssignmentSnapshot[], nullable
    - `role_id` string, uuid, required
    - `workspace_id` string, uuid, nullable
    - `id` string, uuid, required

## Response `204`

Successful Response

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/tracecat/apis/tracecat-api.md) - [All operations](https://skmtc.dev/tracecat/apis/tracecat-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tracecat/apis/tracecat-api/revisions/2efdda25045f?raw)
