---
title: "Create a new role mapping"
method: POST
path: "/admin/roleMappings"
tags: ["Admin"]
---

# Create a new role mapping

`POST /admin/roleMappings`

## Request

- The document declares no server URL.
- Auth: none declared

Creates a new mapping between a user/principal and a role.

This operation can fail for the following reasons:

* A server error occurred (HTTP error `500`)

## Request body

- RoleMapping: The mapping between a user/principal and their role.
  - `principalId` string, required
  - `role` 'READ_ONLY' | 'DEVELOPER' | 'ADMIN', required
  - `principalName` string: A friendly name for the principal.

## Response `204`

Returned when the role mapping was successfully created.

## Other responses

- `401`: Common response for all operations that can return a `401` error indicating authentication is required.
- `403`: Common response for all operations that can return a `403` error indicating the user is authenticated but not authorized.
- `500`: Common response for all operations that can fail with an unexpected server error.

## Changes

> 65 revisions in range; 1 not diffed.

- **2021-10-14** (v2) `2012531f6634`: 1 info
  - added the new optional request property `principalName`
- **2021-07-14** (v2) `8fa966d5a3de`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/apicurio/apis/apicurio-registry-api-v2/changes/admin/roleMappings/post.md)

---

[API](https://skmtc.dev/apicurio/apis/apicurio-registry-api-v2.md) - [All operations](https://skmtc.dev/apicurio/apis/apicurio-registry-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/apicurio/apis/apicurio-registry-api-v2/revisions/8c48f413fa1f?raw)
