---
title: "Create a custom role"
method: POST
path: "/v1/roles"
tags: ["Roles"]
---

# Create a custom role

`POST /v1/roles`

Create a custom role in Comp AI. Create custom roles and resolve permission sets for organization-level access control.

## Request body

- CreateRoleDto
  - `name` string, required — Name of the custom role
  - `permissions` object, required — Permissions for the role. Keys are resource names, values are arrays of allowed actions.
  - `obligations` object — Obligations for the role. Boolean flags for requirements like compliance.

## Response `201`

Role created successfully

- object
  - `id` string
  - `name` string
  - `permissions` object
  - `isBuiltIn` boolean
  - `createdAt` string, date-time
  - `updatedAt` string, date-time

## Other responses

- `400` — Invalid role data or role already exists
- `401` — Unauthorized
- `403` — Forbidden - cannot grant permissions you do not have

---

[API](https://skmtc.net/trycompai/apis/comp-ai-api.md) · [All operations](https://skmtc.net/trycompai/apis/comp-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/trycompai/comp-ai-api/versions/726b9523fb22/schema)
