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

# Attach realm roles to a client

> Attach one or more existing realm roles to a `gravitino-shared` client's
service account. Returns the full, refreshed set of attached roles.



## OpenAPI

````yaml post /api/data_shares/{name}/realm-roles
openapi: 3.1.0
info:
  title: Nx1 AI API
  description: |

    AI API for Nx1 Data Platform Management and Automated Data Tasks.

    Authentication is required via PSK in Authorization header.

    Default PSK is | [ask a friend] |
  version: 0.10.2
servers: []
security: []
paths:
  /api/data_shares/{name}/realm-roles:
    post:
      tags:
        - Data shares
      summary: Attach realm roles to a client
      description: |-
        Attach one or more existing realm roles to a `gravitino-shared` client's
        service account. Returns the full, refreshed set of attached roles.
      operationId: add_client_realm_roles_api_data_shares__name__realm_roles_post
      parameters:
        - name: name
          in: path
          required: true
          schema:
            type: string
            title: Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddRealmRolesRequest'
      responses:
        '200':
          description: Updated attached realm roles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClientRealmRolesResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - insufficient permissions.
        '404':
          description: Client not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - OAuth2AuthorizationCodeBearer: []
        - APIKeyHeader: []
components:
  schemas:
    AddRealmRolesRequest:
      properties:
        realm_roles:
          items:
            type: string
          type: array
          minItems: 1
          title: Realm Roles
          description: Existing realm role names to attach to the service account.
      type: object
      required:
        - realm_roles
      title: AddRealmRolesRequest
    ClientRealmRolesResponse:
      properties:
        client_id:
          type: string
          title: Client Id
        realm_roles:
          items:
            type: string
          type: array
          title: Realm Roles
          description: Realm roles attached to the client's service account.
      type: object
      required:
        - client_id
      title: ClientRealmRolesResponse
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
          description: A brief description of the error that occurred.
        code:
          type: integer
          title: Code
          description: The HTTP status code associated with the error.
          default: 500
      type: object
      required:
        - error
      title: ErrorResponse
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    OAuth2AuthorizationCodeBearer:
      type: oauth2
      flows:
        authorizationCode:
          scopes: {}
          authorizationUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/auth
          tokenUrl: >-
            https://sso-rapid.rapid.nx1cloud.com/realms/rapid/protocol/openid-connect/token
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization-PSK

````