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

# Iniciar sesión

> Iniciar sesión mediante clave API. Devuelve un código de verificación y una URL de redirección.



## OpenAPI

````yaml /es/scribe-api/openapi.json post /v1/auth/login
openapi: 3.1.0
info:
  title: Scribe Public API
  description: >-
    API REST externa para integración con la plataforma Telepatia. Autentíquese
    con claves API, establezca el contexto de consulta y consulte sesiones de
    scribe.
  version: 0.1.0
servers:
  - url: https://scribe-api.telepatia.ai
    description: Production
security:
  - BearerAuth: []
paths:
  /v1/auth/login:
    post:
      tags:
        - Authentication
      summary: Iniciar sesión
      description: >-
        Iniciar sesión mediante clave API. Devuelve un código de verificación y
        una URL de redirección.
      operationId: api_login_v1_auth_login_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
            example:
              consultationInternalId: cons_abc123
        required: true
      responses:
        '200':
          description: Respuesta exitosa
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
              example:
                code: K7M2P9X4A1B8N3Q6R5T0V7W2Y9Z4C1D8
                expiresAt: '2026-02-20T18:30:00Z'
                expiresIn: 900
                redirectUrl: >-
                  https://scribe.telepatia.ai/sign-in?code=K7M2P9X4A1B8N3Q6R5T0V7W2Y9Z4C1D8&consultationInternalId=cons_abc123
        '400':
          description: >-
            Solicitud incorrecta — parámetros inválidos, fallos de validación o
            campos faltantes.
          content:
            application/json:
              examples:
                parameter_invalid:
                  summary: Invalid consultation ID format
                  value:
                    error:
                      type: invalid_request_error
                      code: parameter_invalid
                      message: >-
                        consultationInternalId must contain only alphanumeric
                        characters, hyphens, and underscores.
                      param: consultationInternalId
                account_invalid:
                  summary: Account has no auth ID
                  value:
                    error:
                      type: invalid_request_error
                      code: account_invalid
                      message: Account has no valid authId.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: No autorizado — clave API faltante o inválida.
          content:
            application/json:
              examples:
                authentication_required:
                  summary: Invalid or missing API key
                  value:
                    error:
                      type: authentication_error
                      code: authentication_required
                      message: Invalid API key.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Servicio no disponible — una dependencia externa no está disponible.
          content:
            application/json:
              examples:
                service_unavailable:
                  summary: External service unavailable
                  value:
                    error:
                      type: api_error
                      code: service_unavailable
                      message: >-
                        Unable to generate verification code. Please try again
                        later.
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    LoginRequest:
      properties:
        consultationInternalId:
          anyOf:
            - type: string
              maxLength: 128
            - type: 'null'
          title: Consultationinternalid
          examples:
            - cons_abc123
      type: object
      title: LoginRequest
      description: Cuerpo de solicitud de inicio de sesión.
      examples:
        - consultationInternalId: cons_abc123
    LoginResponse:
      properties:
        code:
          type: string
          maxLength: 255
          title: Code
          examples:
            - K7M2P9X4A1B8N3Q6R5T0V7W2Y9Z4C1D8
        expiresAt:
          type: string
          maxLength: 255
          title: Expiresat
          examples:
            - '2026-02-20T18:30:00Z'
        expiresIn:
          type: integer
          title: Expiresin
          examples:
            - 900
        redirectUrl:
          type: string
          title: Redirecturl
          examples:
            - >-
              https://scribe.telepatia.ai/sign-in?code=K7M2P9X4A1B8N3Q6R5T0V7W2Y9Z4C1D8&consultationInternalId=cons_abc123
      type: object
      required:
        - code
        - expiresAt
        - expiresIn
        - redirectUrl
      title: LoginResponse
      description: >-
        Respuesta de inicio de sesión con código de verificación y URL de
        redirección.
      examples:
        - code: K7M2P9X4A1B8N3Q6R5T0V7W2Y9Z4C1D8
          expiresAt: '2026-02-20T18:30:00Z'
          expiresIn: 900
          redirectUrl: >-
            https://scribe.telepatia.ai/sign-in?code=K7M2P9X4A1B8N3Q6R5T0V7W2Y9Z4C1D8&consultationInternalId=cons_abc123
    ErrorResponse:
      description: Envoltorio estandarizado de respuesta de error.
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      required:
        - error
      title: ErrorResponse
      type: object
    ErrorDetail:
      description: >-
        Detalle del error con códigos legibles por máquina y mensaje legible por
        humanos.
      properties:
        type:
          description: Broad error category for high-level handling.
          examples:
            - invalid_request_error
          title: Type
          type: string
        code:
          description: Machine-readable error code. Clients should switch on this value.
          examples:
            - parameter_invalid
          title: Code
          type: string
        message:
          description: Human-readable error message ending with a period.
          examples:
            - >-
              idCountry must be a valid country name, ISO alpha-2, or ISO
              alpha-3 code.
          title: Message
          type: string
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: The request field that caused the error, if applicable.
          examples:
            - idCountry
          title: Param
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          default: null
          description: Optional structured, machine-readable context for the error.
          examples:
            - pendingConsultations:
                - sessionId: abc123
                  url: https://...
          title: Details
      required:
        - type
        - code
        - message
      title: ErrorDetail
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Clave API enviada como token Bearer

````