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

# Update Role

> Requires the **Custom Roles** feature on the workspace and the **Manage Custom Roles** (`CAN_MANAGE_ROLES`) permission on the acting user (the key's default user, or `x-client-user`). The acting user can only grant permissions and touch roles at or below their own level.

Send the full role every time: `title` and `permissions` are required, and `permissions` replaces the whole set. To move users between roles, use the user role endpoint, not this one.

System roles (`editable: false`, such as Owner and Admin) keep their title, description and `reportTo`; only `homepage` changes. Their permissions are also left as they are, except the Admin role when the acting user is an owner.

The response body carries no role. Read it back with [Get Roles](/api-reference/endpoints/roles/get).



## OpenAPI

````yaml PATCH /api/v1/mgt/workspaces/{workspaceId}/roles/{roleId}
openapi: 3.1.0
info:
  title: Xenia Team API - Update Role
  version: 1.0.0
  description: Update a role.
servers:
  - url: https://api.xenia.team
security: []
paths:
  /api/v1/mgt/workspaces/{workspaceId}/roles/{roleId}:
    patch:
      tags:
        - Roles
      summary: Update Role
      description: >-
        Requires the **Custom Roles** feature on the workspace and the **Manage
        Custom Roles** (`CAN_MANAGE_ROLES`) permission on the acting user (the
        key's default user, or `x-client-user`). The acting user can only grant
        permissions and touch roles at or below their own level.


        Send the full role every time: `title` and `permissions` are required,
        and `permissions` replaces the whole set. To move users between roles,
        use the user role endpoint, not this one.


        System roles (`editable: false`, such as Owner and Admin) keep their
        title, description and `reportTo`; only `homepage` changes. Their
        permissions are also left as they are, except the Admin role when the
        acting user is an owner.


        The response body carries no role. Read it back with [Get
        Roles](/api-reference/endpoints/roles/get).
      parameters:
        - name: workspaceId
          in: path
          required: true
          description: UUID of the workspace. Must be your key's own workspace.
          schema:
            type: string
            format: uuid
            example: cb363f7e-c52a-4478-911d-f6a6f791090e
        - name: roleId
          in: path
          required: true
          description: ID of the role.
          schema:
            type: string
            example: 4ccf0b65-fb99-40da-92d6-3f98730df8b2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - title
                - permissions
              additionalProperties: false
              properties:
                title:
                  type: string
                  description: >-
                    Role title. Must be unique in the workspace. Required on
                    every update, even when unchanged.
                  example: Shift Lead
                description:
                  type:
                    - string
                    - 'null'
                  example: Runs the floor on a shift
                reportTo:
                  type:
                    - string
                    - 'null'
                  description: ID of the role this role reports to.
                  example: 9a1e6b0f-3c2d-4e5f-8a7b-6c5d4e3f2a1b
                permissions:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: >-
                    Permission IDs from [List
                    Permissions](/api-reference/endpoints/roles/list-permissions).
                    Replaces the role's whole permission set.
                  example:
                    - 0b8f2c1e-6d4a-4f3b-9e2c-1a7d5b8c9e0f
                    - 5e7a9c3b-2f1d-4c8e-a6b4-3d2e1f0a9b8c
                homepage:
                  type: object
                  description: >-
                    Landing screen for users with this role. When `web` is
                    `CUSTOM`, `dashboard` is required.
                  required:
                    - mobile
                    - web
                  properties:
                    mobile:
                      type: string
                      enum:
                        - DEFAULT
                        - PULSE
                        - FIELD_TEAM
                        - DM_VIEW
                        - COMMS_HUB
                    web:
                      type: string
                      enum:
                        - DEFAULT
                        - PULSE
                        - CUSTOM
                        - FIELD_TEAM
                        - AUDIT_INSIGHTS
                        - DM_VIEW
                        - COMMS_HUB
                    dashboard:
                      type: object
                      description: Required when `web` is `CUSTOM`.
                      required:
                        - id
                        - name
                        - type
                      properties:
                        id:
                          type: string
                          format: uuid
                        name:
                          type: string
                        slug:
                          type: string
                        type:
                          type: string
                          enum:
                            - CUSTOM_DASHBOARD
                            - PRESET_DASHBOARD
            example:
              title: Shift Lead
              description: Runs the floor on a shift
              reportTo: 9a1e6b0f-3c2d-4e5f-8a7b-6c5d4e3f2a1b
              permissions:
                - 0b8f2c1e-6d4a-4f3b-9e2c-1a7d5b8c9e0f
                - 5e7a9c3b-2f1d-4c8e-a6b4-3d2e1f0a9b8c
              homepage:
                mobile: DEFAULT
                web: DEFAULT
      responses:
        '200':
          description: Role updated. `data` is not returned.
          content:
            application/json:
              example:
                meta: {}
        '400':
          description: Bad request.
          content:
            application/json:
              examples:
                duplicateTitle:
                  summary: Role already exist
                  value:
                    error:
                      message: Role already exist
                      meta: {}
        '401':
          description: >-
            Unauthorized - invalid client credentials, or the key does not
            belong to this workspace.
        '403':
          description: >-
            Forbidden - route not allowed for API keys, feature not on the plan,
            missing permission, or the role outranks the acting user.
          content:
            application/json:
              examples:
                featureMissing:
                  summary: Workspace doesn't have "Custom Roles" feature activated.
                  value:
                    error:
                      message: Workspace doesn't have "Custom Roles" feature activated.
                      meta:
                        paywallFeature: Custom Roles
                        message:
                          title: You’ve discovered a Premium Feature!
                          description: >-
                            Custom Roles isn’t available on your current plan.
                            Upgrade Now to access this feature.
                missingPermission:
                  summary: You don't have permission "Can manage roles".
                  value:
                    error:
                      message: You don't have permission "Can manage roles".
                      meta: {}
                outranked:
                  summary: You can only manage peer/subordinate roles!
                  value:
                    error:
                      message: You can only manage peer/subordinate roles!
                      meta: {}
        '404':
          description: Role not found in this workspace.
          content:
            application/json:
              examples:
                notFound:
                  summary: Role not found
                  value:
                    error:
                      message: Role not found
                      meta: {}
        '422':
          description: >-
            Validation failed - a required field is missing, a field has the
            wrong type, or the body has an unknown field.
          content:
            application/json:
              example:
                error:
                  error: 'ValidationError: "permissions" is required'
                  message: '"permissions" is required'
                  meta: {}
        '500':
          description: Internal server error.
      security:
        - clientKey: []
          clientSecret: []
components:
  securitySchemes:
    clientKey:
      type: apiKey
      in: header
      name: x-client-key
    clientSecret:
      type: apiKey
      in: header
      name: x-client-secret

````

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