---
title: "Create roles"
method: POST
path: "/resources/roles/v1"
tags: ["Roles"]
---

# Create roles

`POST /resources/roles/v1`

## Request

- Base URL: `http://localhost:8181`
- URL: `http://localhost:8181/resources/roles/v1`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/frontegg/apis/entitlements-agent-pdp/docs/resources/roles/v1/post.ts> (a function with typed inputs; its response is checked against the schema)

This route adds a new role for all tenants. To add a role for a specific tenant, send tenant ID in the **`frontegg-tenant-id`** header. Each role you add requires information about the role in the POST body. Note that you do not assign permissions to the role here. Use the attach permissions to role route to do that.

## Headers

- `frontegg-tenant-id` string

## Request body

- AddRoleRequest[]
  - `key` string, required
  - `name` string, required
  - `description` string
  - `isDefault` boolean: This role will be assigned for every user that will be added without specified roles
  - `migrateRole` boolean: Set this property to `true` together with `isDefault` in order to assign this role to all users
  - `firstUserRole` boolean: This role will be assigned to the first user of a tenant (new tenants only)
  - `level` number, required: Role level for roles elevation, lower level means stronger role.

## Response `201`

- RoleResponse[]
  - `id` string, required
  - `vendorId` string, required
  - `tenantId` string, required
  - `key` string, required
  - `name` string, required
  - `description` string, required
  - `isDefault` boolean, required
  - `firstUserRole` boolean, required
  - `level` number, required
  - `createdAt` string, date-time, required
  - `updatedAt` string, date-time, required
  - `permissions` string[], required

---

[API](https://skmtc.dev/frontegg/apis/entitlements-agent-pdp.md) - [All operations](https://skmtc.dev/frontegg/apis/entitlements-agent-pdp/llms.txt) - [OpenAPI document](https://skmtc.dev/frontegg/apis/entitlements-agent-pdp/revisions/c496ae9e1c3e?raw)
