---
title: "Create a new role"
method: POST
path: "/v1/organizations/{organizationId}/roles"
tags: ["Role Management"]
---

# Create a new role

`POST /v1/organizations/{organizationId}/roles`

## Request

- Base URL: `https://api.clickhouse.cloud`
- URL: `https://api.clickhouse.cloud/v1/organizations/{organizationId}/roles`
- Auth: HTTP basic

Creates a new custom role for an organization with specified policies and actors.

## Path parameters

- `organizationId` string, uuid, required

## Request body

- RoleCreateRequest
  - `name` string, required: Name of the role
  - `actors` string[], required: List of actor resource IDs to assign to this role (e.g., ["user/uuid", "apiKey/uuid"])
  - `policies` RBACPolicyCreateRequest[], required: List of policies to create for this role
    - `allowDeny` 'ALLOW' | 'DENY', required: Whether this policy allows or denies access
    - `permissions` string[], required: List of permissions to grant or deny (e.g., ["control-plane:organization:view"])
    - `resources` string[], required: List of resource IDs this policy applies to (e.g., ["instance/uuid", "instance/*"])
    - `tags` RBACPolicyTags
      - `grants` string[]: Optional list of database grants (e.g., database names)
      - `roleV2` 'sql-console-readonly' | 'sql-console-admin': Optional SQL console role type

## Response `200`

Successful response

- object
  - `status` number: HTTP status code.
  - `requestId` string, uuid: Unique id assigned to every request. UUIDv4
  - `result` RBACRole
    - `id` string: Unique role identifier
    - `tenantId` string: Tenant resource ID (e.g., organization/uuid)
    - `ownerId` string: Owner resource ID (e.g., organization/uuid)
    - `name` string: Name of the role
    - `type` 'system' | 'custom': Whether this is a system role or a custom role
    - `actors` string[]: List of actor resource IDs assigned to this role (e.g., user/uuid, apiKey/uuid)
    - `policies` RBACPolicy[]: List of policies associated with this role
      - `id` string: Unique policy identifier
      - `roleId` string: ID of the role this policy belongs to
      - `tenantId` string: Tenant resource ID (e.g., organization/uuid)
      - `allowDeny` 'ALLOW' | 'DENY': Whether this policy allows or denies access
      - `permissions` string[]: List of permissions granted or denied by this policy
      - `resources` string[]: List of resource IDs this policy applies to (e.g., instance/uuid, instance/*)
      - `tags` RBACPolicyTags
        - `grants` string[]: Optional list of database grants (e.g., database names)
        - `roleV2` 'sql-console-readonly' | 'sql-console-admin': Optional SQL console role type
    - `createdAt` string, date-time: Timestamp when the role was created. ISO-8601.
    - `updatedAt` string, date-time: Timestamp when the role was last updated. ISO-8601.

## Other responses

- `400`: The request cannot be processed due to a client error. Please verify your request parameters and try again.
- `500`: An internal server error has occurred. If this issue persists, please contact ClickHouse Cloud support for assistance.

---

[API](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud.md) - [All operations](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/llms.txt) - [OpenAPI document](https://skmtc.dev/clickhouse/apis/openapi-spec-for-clickhouse-cloud/revisions/eac345053548?raw)
