---
title: "Create Role"
method: POST
path: "/v1/admin/roles"
tags: ["Admin"]
---

# Create Role

`POST /v1/admin/roles`

## Request

- The document declares no server URL.
- Auth: HTTP bearer

## Request body

- CreateRoleBody
  - `name` string, nullable: Name of the role.
  - `permissions` PermissionType[], nullable: List of permissions.
  - `limits` Limit[], nullable: List of limits.
    - `router_id` integer, required: The router ID.
    - `type` 'tpm' | 'tpd' | 'rpm' | 'rpd', required
    - `value` integer, nullable: The limit value.

## Response `201`

Successful Response

- RoleResponse
  - `object` 'role': Type of the object.
  - `id` integer, required: ID of the role.
  - `name` string, required: Name of the role.
  - `permissions` PermissionType[], required: List of permissions.
  - `limits` Limit[], required: List of limits.
    - `router_id` integer, required: The router ID.
    - `type` 'tpm' | 'tpd' | 'rpm' | 'rpd', required
    - `value` integer, nullable: The limit value.
  - `users` integer, required: Number of users assigned to the role.
  - `created` integer, required: Time of creation, as Unix timestamp.
  - `updated` integer, required: Time of last update, as Unix timestamp.

## Other responses

- `401`: Invalid authentication scheme.<br>Invalid API key.
- `403`: User has no admin rights.<br>Your account has expired. Please contact support to renew your account.
- `409`: Role {role_name} already exists.
- `422`: Validation Error

## Changes

- **2026-09-29** `2f7a4a0aac8f`: 1 info
  - endpoint added
- **2026-09-29** `da70d9cd1957`: 1 breaking
  - api path removed without deprecation
- **2026-08-20** `0db3023472ef`: 1 breaking, 1 info
  - removed the enum value `create_public_collection` of the request property `permissions/anyOf[subschema #1]/items/`
  - removed the `create_public_collection` enum value from the `permissions/items/` response property for the response status `201`
- **2026-05-06** `27a773824667`: 3 info
  - the request property `name` became optional
  - request property `name` list-of-types was widened by adding types `null` to media type `application/json`
  - the `name` request property's minLength was decreased from `1` to `0`
- **2026-04-30** `d5f1d3d5614e`: 13 info
  - the `limits` request property default value `` was removed
  - the `permissions` request property default value `` was removed
  - request property `limits` list-of-types was widened by adding types `null` to media type `application/json`
  - added the non-success response with the status `401`
  - …9 more

[Operation history](https://skmtc.dev/betagouv/apis/opengatellm/changes/v1/admin/roles/post.md)

---

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