> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a role

> Updates an existing custom role. System roles cannot be updated. All fields are optional - only provided fields will be updated.

Updates an existing custom role. System roles cannot be updated. All fields are optional - only provided fields will be updated.


## OpenAPI

````yaml /_specs/cloud-openapi.json patch /v1/organizations/{organizationId}/roles/{roleId}
openapi: 3.1.2
info:
  title: OpenAPI spec for ClickHouse Cloud
  version: '1.0'
  contact:
    name: ClickHouse Support
    url: >-
      https://clickhouse.com/docs/en/cloud/manage/openapi?referrer=openapi-910487
    email: support@clickhouse.com
servers:
  - url: https://api.clickhouse.cloud
security:
  - basicAuth: []
tags:
  - name: Organization
  - name: User management
  - name: Billing
  - name: Role Management
  - name: Service
  - name: Backup
  - name: OpenAPI
  - name: Prometheus
  - name: ClickPipes
  - name: ClickStack
  - name: Postgres
paths:
  /v1/organizations/{organizationId}/roles/{roleId}:
    patch:
      tags:
        - Role Management
      summary: Update a role
      description: >-
        Updates an existing custom role. System roles cannot be updated. All
        fields are optional - only provided fields will be updated.
      operationId: organizationRolePatch
      parameters:
        - in: path
          name: organizationId
          description: ID of the requested organization.
          required: true
          schema:
            type: string
            format: uuid
        - in: path
          name: roleId
          description: ID of the requested role.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleUpdateRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 200
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
                  result:
                    $ref: '#/components/schemas/RBACRole'
        '400':
          description: >-
            The request cannot be processed due to a client error. Please verify
            your request parameters and try again.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: number
                    description: HTTP status code.
                    example: 400
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
        '500':
          description: >-
            An internal server error has occurred. If this issue persists,
            please contact ClickHouse Cloud support for assistance.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: HTTP status code.
                    example: 500
                  error:
                    type: string
                    description: Detailed error description.
                  requestId:
                    type: string
                    description: Unique id assigned to every request. UUIDv4
                    format: uuid
components:
  schemas:
    RoleUpdateRequest:
      properties:
        name:
          description: New name for the role
          type: string
        actors:
          type: array
          description: New list of actor resource IDs (replaces existing actors)
          items:
            type: string
        policies:
          type: array
          description: New list of policies (replaces existing policies)
          items:
            $ref: '#/components/schemas/RBACPolicyCreateRequest'
    RBACRole:
      properties:
        id:
          description: Unique role identifier
          type: string
        tenantId:
          description: Tenant resource ID (e.g., organization/uuid)
          type: string
        ownerId:
          description: Owner resource ID (e.g., organization/uuid)
          type: string
        name:
          description: Name of the role
          type: string
        type:
          description: Whether this is a system role or a custom role
          type: string
          enum:
            - system
            - custom
        actors:
          type: array
          description: >-
            List of actor resource IDs assigned to this role (e.g., user/uuid,
            apiKey/uuid)
          items:
            type: string
        policies:
          type: array
          description: List of policies associated with this role
          items:
            $ref: '#/components/schemas/RBACPolicy'
        createdAt:
          description: Timestamp when the role was created. ISO-8601.
          type: string
          format: date-time
        updatedAt:
          description: Timestamp when the role was last updated. ISO-8601.
          type: string
          format: date-time
    RBACPolicyCreateRequest:
      properties:
        allowDeny:
          description: Whether this policy allows or denies access
          type: string
          enum:
            - ALLOW
            - DENY
        permissions:
          type: array
          description: >-
            List of permissions to grant or deny (e.g.,
            ["control-plane:organization:view"])
          items:
            type: string
        resources:
          type: array
          description: >-
            List of resource IDs this policy applies to (e.g., ["instance/uuid",
            "instance/*"])
          items:
            type: string
        tags:
          $ref: '#/components/schemas/RBACPolicyTags'
      required:
        - allowDeny
        - permissions
        - resources
    RBACPolicy:
      properties:
        id:
          description: Unique policy identifier
          type: string
        roleId:
          description: ID of the role this policy belongs to
          type: string
        tenantId:
          description: Tenant resource ID (e.g., organization/uuid)
          type: string
        allowDeny:
          description: Whether this policy allows or denies access
          type: string
          enum:
            - ALLOW
            - DENY
        permissions:
          type: array
          description: List of permissions granted or denied by this policy
          items:
            type: string
        resources:
          type: array
          description: >-
            List of resource IDs this policy applies to (e.g., instance/uuid,
            instance/*)
          items:
            type: string
        tags:
          $ref: '#/components/schemas/RBACPolicyTags'
    RBACPolicyTags:
      properties:
        grants:
          type: array
          description: Optional list of database grants (e.g., database names)
          items:
            type: string
        roleV2:
          description: Optional SQL console role type
          type: string
          enum:
            - sql-console-readonly
            - sql-console-admin
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Use key ID and key secret obtained in ClickHouse Cloud console:
        https://clickhouse.com/docs/cloud/manage/openapi

````