---
title: "Validate a role"
method: POST
path: "/api/admin/roles/validate"
tags: ["Users"]
---

# Validate a role

`POST /api/admin/roles/validate`

**Enterprise feature**

Check if the role matches schema and has a unique name

## Request body

- union — A write model for the custom role and permissions to allow Unleash to decide what actions a role holder is allowed to perform
  - object
    - `name` string, required — The name of the custom role
    - `description` string — A more detailed description of the custom role and what use it's intended for
    - `type` 'root-custom' | 'custom' — [Custom root roles](https://docs.getunleash.io/concepts/rbac#custom-root-roles) (type=root-custom) are root roles with a custom set of permissions. [Custom project roles](https://docs.getunleash.io/concepts/rbac#custom-project-roles) (type=custom) contain a specific set of permissions for project resources.
    - `permissions` object[] — A list of permissions assigned to this role
      - `name` string, required — The name of the permission
      - `environment` string, nullable — The environments of the permission if the permission is environment specific
  - object
    - `name` string, required — The name of the custom role
    - `description` string — A more detailed description of the custom role and what use it's intended for
    - `type` 'custom' — [Custom project roles](https://docs.getunleash.io/concepts/rbac#custom-project-roles) contain a specific set of permissions for project resources.
    - `permissions` object[] — A list of permissions assigned to this role
      - `id` number, required — The id of the permission
      - `name` string — The name of the permission
      - `environment` string, nullable — The environments of the permission if the permission is environment specific

## Response `200`

This response has no body.

## Other responses

- `400` — The request data does not match what we expect.
- `401` — Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.

---

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