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

# Update Role

> Update a role.

Updates the role name and description.
Only superadmins can update roles.

Args:
    role_id: Role ID.
    role_request: Role update request.
    current_user: Authenticated superadmin user.
    session: Database session.

Returns:
    Updated role.



## OpenAPI

````yaml put /api/v1/roles/{role_id}
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/roles/{role_id}:
    put:
      tags:
        - roles
      summary: Update Role
      description: |-
        Update a role.

        Updates the role name and description.
        Only superadmins can update roles.

        Args:
            role_id: Role ID.
            role_request: Role update request.
            current_user: Authenticated superadmin user.
            session: Database session.

        Returns:
            Updated role.
      operationId: update_role_api_v1_roles__role_id__put
      parameters:
        - name: role_id
          in: path
          required: true
          schema:
            type: integer
            title: Role Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRoleRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleResponse'
        '403':
          description: Superadmin access required
        '404':
          description: Role not found
        '409':
          description: Role name already exists
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UpdateRoleRequest:
      properties:
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      type: object
      required:
        - name
      title: UpdateRoleRequest
      description: |-
        Request schema for updating a role.

        Attributes:
            name: Role name.
            description: Optional description of the role's purpose.
    RoleResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
      type: object
      required:
        - id
        - name
      title: RoleResponse
      description: |-
        Response schema for a role.

        Attributes:
            id: Role ID.
            name: Role name.
            description: Role description.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````