> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Role

> Creates an Enterprise custom role. If is_default is true, the new role becomes the subscription default and the previous default is cleared.

export const EnterprisePlanBadge = ({tip = "This feature is available exclusively as part of the Enterprise plan. Please refer to our pricing page for more information about our plans and features.", title = "Enterprise Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="building-2" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<EnterprisePlanBadge />

## Create Custom Role

Creates an Enterprise custom role. If `is_default` is true, the new role becomes the subscription default and the previous default is cleared.

You can either specify individual permissions or use `duplicate_from` to copy permissions from an existing role. When permissions are omitted and `duplicate_from` is not specified, permissions default to the `cr_member` role.

<Info>
  Requires **Admin** role. See [Role-based access](/management/roles) for details.
</Info>


## OpenAPI

````yaml post /v1/roles
openapi: 3.0.3
info:
  title: CodeRabbit API spec
  version: 1.0.0
servers:
  - url: https://api.coderabbit.ai
security:
  - ApiKeyAuth: []
paths:
  /v1/roles:
    post:
      tags:
        - Role Management
      summary: Create a custom role
      description: >-
        Creates an Enterprise custom role. If is_default is true, the new role
        becomes the subscription default and the previous default is cleared.
      operationId: create-role
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  example: Security Reviewer
                description:
                  type: string
                is_default:
                  type: boolean
                  default: false
                duplicate_from:
                  type: string
                  description: >-
                    Role ID to copy permissions from. Defaults to cr_member when
                    permissions are omitted.
                permissions:
                  type: array
                  items:
                    type: object
                    properties:
                      resource_id:
                        type: string
                        example: user_management
                      access_type:
                        type: string
                        enum:
                          - read
                          - write
                          - delete
      responses:
        '201':
          description: Custom role created
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-coderabbitai-api-key
      description: >-
        API key for authentication. You can create an API key from the
        CodeRabbit dashboard.

````