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

# Sign in

> Exchanges a person credential for the token the Console and the API use.



## OpenAPI

````yaml openapi/en/control.json POST /v1/auth/login
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/auth/login:
    post:
      summary: Sign in
      description: >-
        Signs a person in with e-mail, password and the TOTP code, and returns
        the token the Console and the control API use. The token lasts 15
        minutes and is bound to one space; a person whose authenticator is not
        confirmed yet gets 401 "second factor enrollment required" and sets it
        up with POST /v1/auth/second-factor. The Console usually signs people in
        through SAML 2.0 or OIDC.


        **Authentication.** No authentication.
      operationId: login_v1_auth_login_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
            example:
              email: ana@acme.example
              password: correct horse battery staple
              totp: '492817'
              space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenOut'
              example:
                access_token: >-
                  eyJhbGciOiJFZERTQSIsImtpZCI6ImN0bC0yMDI2LTA5In0.eyJzdWIiOiIwMTkyZjBhMC00ZTVmIiwiZXhwIjoxNzU4NTYyMTIzfQ.Q2sX...
                token_type: Bearer
                expires_in: 900
                space_id: 0192f0a0-3d4e-7f50-8b61-7c8d9e0f1a23
          description: The token, its lifetime in seconds and the space it opens.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security: []
components:
  schemas:
    LoginRequest:
      additionalProperties: false
      properties:
        email:
          maxLength: 320
          minLength: 3
          title: Email
          type: string
        password:
          maxLength: 1024
          minLength: 1
          title: Password
          type: string
        space_id:
          anyOf:
            - format: uuid
              type: string
            - type: 'null'
          title: Space Id
          description: >-
            The space the token opens. Defaults to the first space the person
            can reach.
        totp:
          anyOf:
            - pattern: ^\d{6}$
              type: string
            - type: 'null'
          title: Totp
          description: >-
            The current code of the authenticator app. Required when the person
            enrolled a second factor.
      required:
        - email
        - password
      title: LoginRequest
      type: object
    TokenOut:
      additionalProperties: false
      properties:
        access_token:
          title: Access Token
          type: string
        expires_in:
          title: Expires In
          type: integer
          description: Seconds until the token expires.
        space_id:
          format: uuid
          title: Space Id
          type: string
        token_type:
          default: Bearer
          title: Token Type
          type: string
      required:
        - access_token
        - expires_in
        - space_id
      title: TokenOut
      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

````