> ## 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.

# Convidar pessoa

> Uma pessoa nova no Console.



## OpenAPI

````yaml openapi/pt/control.json POST /v1/users
openapi: 3.1.0
info:
  title: API de controle da Niadra
  version: '1'
  description: >-
    Tenants, projetos, fontes, chaves, pessoas, configuração e uso. Nunca recebe
    conteúdo de cliente.
servers:
  - url: https://control.api.niadra.com
security: []
paths:
  /v1/users:
    post:
      summary: Convidar pessoa
      description: >-
        Cria uma pessoa com os papéis dela. Com `with_totp`, a resposta traz
        `totp_uri` uma vez só, para cadastrar o segundo fator num aplicativo
        autenticador. Exige o papel admin.


        **Autenticação.** Token de pessoa emitido pelo controle (`Authorization:
        Bearer <JWT>`), com o papel que a operação pede.
      operationId: create_user_v1_users_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
            example:
              email: rui@acme.example
              password: a-long-passphrase-2026
              roles:
                - role: security
              with_totp: true
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserOut'
              example:
                user_id: 0192f0a0-4e5f-7061-9c72-8d9e0f1a2b35
                email: rui@acme.example
                active: true
                last_login_at: null
                roles:
                  - role: security
                    space_id: null
                    source_ids: []
                totp_uri: >-
                  otpauth://totp/Niadra:rui%40acme.example?secret=JBSWY3DPEHPK3PXP&issuer=Niadra
          description: >-
            A pessoa, com o endereço de cadastro quando o segundo fator foi
            pedido.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: O pedido não bate com o contrato.
      security:
        - personToken: []
components:
  schemas:
    UserCreate:
      additionalProperties: false
      properties:
        email:
          maxLength: 320
          minLength: 3
          title: Email
          type: string
        password:
          maxLength: 1024
          minLength: 12
          title: Password
          type: string
          description: Pelo menos 12 caracteres.
        roles:
          items:
            $ref: '#/components/schemas/BindingIn'
          maxItems: 32
          minItems: 1
          title: Roles
          type: array
        with_totp:
          default: true
          title: With Totp
          type: boolean
          description: Cria um segredo TOTP e devolve o endereço de cadastro uma vez só.
      required:
        - email
        - password
        - roles
      title: UserCreate
      type: object
    UserOut:
      additionalProperties: false
      properties:
        active:
          title: Active
          type: boolean
        email:
          title: Email
          type: string
        last_login_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Login At
        roles:
          items:
            $ref: '#/components/schemas/BindingOut'
          title: Roles
          type: array
        totp_uri:
          anyOf:
            - type: string
            - type: 'null'
          description: Aparece uma vez só, na criação, para cadastrar o segundo fator.
          title: Totp Uri
        user_id:
          format: uuid
          title: User Id
          type: string
      required:
        - user_id
        - email
        - active
        - roles
      title: UserOut
      type: object
    Problem:
      additionalProperties: false
      description: >-
        Detalhes do problema no formato da RFC 9457; `code` vem do catálogo de
        erros versionado.
      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: 'No papel vendor: as fontes que esta pessoa pode ver.'
        space_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Space Id
          description: >-
            O papel vale só neste espaço. Vazio quer dizer todos os espaços do
            tenant.
      required:
        - role
      title: BindingIn
      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
    Role:
      description: Papéis do Console, combináveis.
      enum:
        - admin
        - security
        - integration
        - review
        - analysis
        - vendor
      title: Role
      type: string
  securitySchemes:
    personToken:
      type: http
      scheme: bearer
      bearerFormat: JWT

````