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

# Update custom role

> Update a custom role



## OpenAPI

````yaml /api-reference/openapi/Evo-Auth-Service/custom-roles.yaml patch /api/v1/custom_roles/{id}
openapi: 3.0.1
info:
  title: Evolution Foundation - Auth Service - Custom Roles
  description: Authentication and user and account management
  version: v1.0.0
servers:
  - url: https://api.evoai.app
    description: Production server
  - url: http://localhost:3001
    description: Development server
    variables:
      port:
        default: '3001'
  - url: '{customUrl}'
    description: Custom server
    variables:
      customUrl:
        default: https://your-instance.com
        description: Enter your server URL
security: []
paths:
  /api/v1/custom_roles/{id}:
    parameters:
      - name: id
        in: path
        description: Custom Role ID
        required: true
        schema:
          type: string
          format: uuid
    patch:
      summary: Update custom role
      description: Update a custom role
      operationId: updateCustomRole
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                custom_role:
                  type: object
                  properties:
                    key:
                      type: string
                    name:
                      type: string
                    description:
                      type: string
                    is_active:
                      type: boolean
                permissions:
                  type: array
                  items:
                    type: string
                resource_scopes:
                  type: array
                  items:
                    type: object
      responses:
        '200':
          description: Custom role updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      custom_role:
                        $ref: '#/components/schemas/CustomRole'
                  meta:
                    type: object
                    properties:
                      timestamp:
                        type: string
                        format: date-time
                  message:
                    type: string
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Account ID is required
                  value:
                    success: false
                    error:
                      code: VALIDATION_ERROR
                      message: >-
                        Account ID is required (provide account-id header or
                        account_id in URL)
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/custom_roles/{id}
                      method: PATCH
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_token:
                  summary: Invalid or missing token
                  value:
                    success: false
                    error:
                      code: INVALID_TOKEN
                      message: Invalid token
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/custom_roles/{id}
                      method: PATCH
        '404':
          description: Not Found (custom role not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                custom_role_not_found:
                  summary: Custom role not found
                  value:
                    success: false
                    error:
                      code: NOT_FOUND
                      message: Custom role not found
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/custom_roles/{id}
                      method: PATCH
        '422':
          description: Unprocessable Entity (validation error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                validation_error:
                  summary: Validation failed
                  value:
                    success: false
                    error:
                      code: OPERATION_FAILED
                      message: Validation failed
                      details:
                        - Name is required
                        - Key is invalid
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/custom_roles/{id}
                      method: PATCH
        '500':
          description: Internal Server Error (erro interno do servidor)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                internal_error:
                  summary: Internal server error
                  value:
                    success: false
                    error:
                      code: INTERNAL_ERROR
                      message: An unexpected error occurred
                    meta:
                      timestamp: '2024-01-15T10:30:00Z'
                      path: /api/v1/custom_roles/{id}
                      method: PATCH
      security:
        - ApiAccessTokenAuth: []
components:
  schemas:
    CustomRole:
      type: object
      properties:
        id:
          type: string
          format: uuid
        key:
          type: string
        name:
          type: string
        description:
          type: string
          nullable: true
        is_active:
          type: boolean
        account_id:
          type: string
          format: uuid
        created_by_id:
          type: string
          format: uuid
          nullable: true
        updated_by_id:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - success
        - error
        - meta
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: VALIDATION_ERROR
            message:
              type: string
              example: Validation failed
            details:
              type: object
              additionalProperties: true
              nullable: true
        meta:
          type: object
          required:
            - timestamp
            - path
            - method
          properties:
            timestamp:
              type: string
              format: date-time
              example: '2024-01-15T10:30:00Z'
            path:
              type: string
              example: /api/v1/super_admin/accounts/123
            method:
              type: string
              example: POST
  securitySchemes:
    ApiAccessTokenAuth:
      type: apiKey
      in: header
      name: api_access_token
      description: API access token authentication

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.