---
title: "Create Project Role"
method: POST
path: "/v1/projects/{projectId}/roles"
tags: ["Project Roles"]
---

# Create Project Role

`POST /v1/projects/{projectId}/roles`

## Request

- Base URL: `https://api.confident-ai.com`
- URL: `https://api.confident-ai.com/v1/projects/{projectId}/roles`
- Auth: none declared
- TypeScript: <https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/docs/v1/projects/:projectId/roles/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a custom project role from a set of policies. The role name must be unique within the project and cannot collide with a system-defined role name.

## Path parameters

- `projectId` string, required

## Request body

- CreateOrUpdateRole
  - `name` string, required: Name of the role (must be unique within the organization and cannot be a system role name)
  - `description` string, nullable: Optional description of the role
  - `policyIds` string[], required: The ids of the policies to attach to this role

## Response `200`

- ProjectRoleResponse
  - `success` boolean, required: Indicates if the request was successful
  - `data` object, required
    - `role` ProjectRole
      - `id` string, required: Unique identifier for the role
      - `name` string, required: Name of the role
      - `description` string, nullable: Optional description of the role
      - `projectId` string, nullable: The owning project id, or `null` for global, system-defined roles that are available to every project.
      - `policies` NamedRef[]: The policies attached to this role
        - `id` string, required: Unique identifier
        - `name` string, required: Name

## Changes

> 54 revisions in range; 3 not diffed.

- **2026-05-31** `173563ada468`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/changes/v1/projects/:projectId/roles/post.md)

---

[API](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api.md) - [All operations](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/llms.txt) - [OpenAPI document](https://skmtc.dev/confident-ai/apis/confident-ai-metrics-api/revisions/95cdde71b65e?raw)
