---
title: "Create a new role for a tenant"
method: POST
path: "/roles"
tags: ["Role"]
---

# Create a new role for a tenant

`POST /roles`

Creates a new role under the tenant identified by the required `tenant-id` header. Use this to define a named grouping of permissions that can later be assigned to users; to modify an existing role use `PATCH /roles/{roleId}`. The request body accepts a `name` and an optional `description` for the new role. Returns 201 with the created role object including the server-assigned `id`, `tenantId`, `createdAt`, and `createdBy` fields. Returns 400 if the `tenant-id` header is absent or blank.

## Headers

- `tenant-id` string

## Request body

- RoleCreateRequest — Request body for creating a new role
  - `name` string, required — Role name
  - `description` string — Role description

## Response `201`

Role created successfully

- RoleResponseDto — Role information response
  - `id` string — Role ID
  - `name` string — Role name
  - `tenantId` string — Tenant ID
  - `description` string — Role description
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `createdBy` string — ID of the user who created the role
  - `updatedBy` string — ID of the user who last updated the role

## Other responses

- `400` — Bad request - Invalid request data or missing required fields
- `401` — Authentication required - Valid authentication token is missing or invalid
- `403` — Forbidden - User does not have the required permissions to create roles
- `500` — Internal server error - An unexpected error occurred while processing the request. No response body is returned.

---

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