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

# Set roles

> The roles of a person: admin, security, integration, review, analysis or vendor.



## OpenAPI

````yaml openapi/en/control.json PUT /v1/users/{user_id}/roles
openapi: 3.1.0
info:
  title: Niadra control API
  version: '1'
  description: >-
    Tenants, projects, sources, keys, people, configuration and usage. It never
    receives customer content.
servers:
  - url: https://control.api.niadra.com
security: []
paths:
  /v1/users/{user_id}/roles:
    put:
      summary: Set roles
      description: >-
        Replaces the role bindings of a person. A binding can hold on every
        space of the tenant or on one space; a vendor binding names the sources
        that person may see. The tenant always keeps at least one admin. Needs
        the admin role.


        **Authentication.** Person token issued by the control plane
        (`Authorization: Bearer <JWT>`), with the role the operation needs.
      operationId: set_roles_v1_users__user_id__roles_put
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            format: uuid
            title: User Id
            type: string
          example: 0192f0a0-4e5f-7061-9c72-8d9e0f1a2b35
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RolesSet'
            example:
              roles:
                - role: security
                - role: review
                  space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/BindingOut'
                title: Response Set Roles V1 Users  User Id  Roles Put
                type: array
              example:
                - role: security
                  space_id: null
                  source_ids: []
                - role: review
                  space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
                  source_ids: []
          description: The bindings now in force.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - personToken: []
components:
  schemas:
    RolesSet:
      additionalProperties: false
      properties:
        roles:
          items:
            $ref: '#/components/schemas/BindingIn'
          maxItems: 32
          minItems: 1
          title: Roles
          type: array
      required:
        - roles
      title: RolesSet
      type: object
    BindingOut:
      additionalProperties: false
      properties:
        role:
          $ref: '#/components/schemas/Role'
        source_ids:
          items:
            format: uuid
            type: string
          title: Source Ids
          type: array
        space_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Space Id
      required:
        - role
        - space_id
        - source_ids
      title: BindingOut
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    BindingIn:
      additionalProperties: false
      properties:
        role:
          $ref: '#/components/schemas/Role'
        source_ids:
          items:
            format: uuid
            type: string
          title: Source Ids
          type: array
          description: 'For the vendor role: the sources this person may see.'
        space_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Space Id
          description: >-
            The role holds on this space only. Empty means every space of the
            tenant.
      required:
        - role
      title: BindingIn
      type: object
    Role:
      description: Console roles, combinable.
      enum:
        - admin
        - security
        - integration
        - review
        - analysis
        - vendor
      title: Role
      type: string
  securitySchemes:
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````