---
title: "Modify a role"
method: POST
path: "/v1/{organization}/role/{role_name}"
tags: ["Role"]
---

# Modify a role

`POST /v1/{organization}/role/{role_name}`

Modify an existing role. The roles are modified in-place unless immutable fields are modified, in which case a new role with the same name
is created, and all users/API keys assigned to the previous role are switched to the new role. The old role document will expire after 1 day.

#### Permissions
This endpoint requires the following permissions:
* `Role:ModifyRole` for the role.

This endpoint may require the authenticated user to have great privileges than the new role if a new role document is created as a result of
immutable field changes.

## Path parameters

- `role_name` string, required — The name of the role.
- `organization` string, required

## Headers

- `x-mongo-cluster-name` string, nullable — The Mongo cluster name to perform this request in. This is usually not needed unless the organization does not exist yet in the Amigo organization infra config database.
- `Sec-WebSocket-Protocol` string[]

## Request body

- SrcAppEndpointsRoleModifyRoleRequest
  - `description` string
  - `permission_grants` PermissionGrantInput[], nullable — A list of permission grants associated with this role. Only updated if specified. This field is an immutable field.
    - `permission_name` string, required — The name of the permission.
    - `conditions` object, required — A dictionary of attribute name to condition that must be met for this grant to be applicable.
  - `frontend_view` 'client' | 'admin'

## Response `200`

Succeeded

- SrcAppEndpointsRoleModifyRoleResponse
  - `role_id` string, required — The identifier of the updated role.

## Other responses

- `400` — Base roles cannot inherit from other roles.
- `401` — Invalid authorization credentials.
- `403` — Missing required permissions.
- `404` — Specified organization, role, or inherited role is not found.
- `422` — Invalid request path parameter or request body failed validation.
- `429` — The user has exceeded the rate limit of 10 requests per minute for this endpoint.
- `503` — The service is going through temporary maintenance.

---

[API](https://skmtc.net/amigo/apis/amigo-api.md) · [All operations](https://skmtc.net/amigo/apis/amigo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/amigo/amigo-api/revisions/f0f28319e448/schema)
