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

# Verificar el código de MFA

> Utiliza este endpoint para verificar el código de MFA introducido por el usuario durante la configuración. Debe llamarse después de iniciar la configuración y antes de habilitar MFA.



## OpenAPI

````yaml es/openapi/v3-current/AM-identity.yaml post /v1/users/{id}/mfa/verify
openapi: 3.1.0
info:
  title: Plugin de identidad
  description: ''
  version: 2.4.5
servers:
  - url: https://identity.sandbox.lerian.net
security: []
tags:
  - name: API de grupos
  - name: API de aplicaciones
  - name: API de usuarios
  - name: API de MFA
  - name: API de proveedores
  - name: API de proveedores de aplicación
paths:
  /v1/users/{id}/mfa/verify:
    post:
      tags:
        - API de MFA
      summary: Verificar el código de MFA
      description: >-
        Utiliza este endpoint para verificar el código de MFA introducido por el
        usuario durante la configuración. Debe llamarse después de iniciar la
        configuración y antes de habilitar MFA.
      parameters:
        - $ref: '#/components/parameters/UserId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFAVerifyInput'
            example:
              passcode: '123456'
              secret: JBSWY3DPEHPK3PXP
              mfaType: app
      responses:
        '200':
          description: Código de MFA verificado correctamente.
          content:
            application/json:
              schema:
                type: object
                properties:
                  verified:
                    type: boolean
              example:
                verified: true
          headers: {}
        '400':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              examples:
                Error0001:
                  $ref: '#/components/examples/Error0001'
                Error0004:
                  $ref: '#/components/examples/Error0004'
                Error0007:
                  $ref: '#/components/examples/Error0007'
                Error0042:
                  $ref: '#/components/examples/Error0042'
                Error0043:
                  $ref: '#/components/examples/Error0043'
                Error0044:
                  $ref: '#/components/examples/Error0044'
                Error0046:
                  $ref: '#/components/examples/Error0046'
                Error0047:
                  $ref: '#/components/examples/Error0047'
                Error0048:
                  $ref: '#/components/examples/Error0048'
                Error0050:
                  $ref: '#/components/examples/Error0050'
          headers: {}
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              examples:
                Error1003:
                  $ref: '#/components/examples/Error1003'
          headers: {}
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
              examples:
                Error0006:
                  $ref: '#/components/examples/Error0006'
                Error0045:
                  $ref: '#/components/examples/Error0045'
          headers: {}
      security:
        - bearer: []
components:
  parameters:
    UserId:
      name: id
      in: path
      description: Identificador único del usuario que deseas consultar.
      required: true
      example: 019c96a0-0c21-71f9-a487-66a1258278a1
      schema:
        type: string
  schemas:
    MFAVerifyInput:
      description: >-
        Información necesaria para verificar un código de MFA durante la
        configuración.
      type: object
      required:
        - passcode
        - mfaType
      properties:
        passcode:
          type: string
          description: Código OTP que se desea verificar.
          minLength: 6
          maxLength: 8
        secret:
          type: string
          description: Secreto TOTP (requerido para MFA basado en aplicación).
        mfaType:
          type: string
          description: Tipo de MFA que se está verificando.
          enum:
            - app
            - email
            - sms
        countryCode:
          type: string
          description: >-
            Código de país ISO 3166-1 alpha-2 (p. ej. "BR", "US"). Se usa para
            resolver el número de teléfono en MFA por SMS. No es un prefijo de
            marcado (+55).
    ErrorMessage:
      description: Mensaje de error devuelto en la respuesta.
      type: object
      properties:
        code:
          type: string
          description: Identificador único y estable del error.
        title:
          type: string
          description: Resumen breve del problema.
        message:
          type: string
          description: Orientación detallada para resolver el error.
  examples:
    Error0001:
      summary: Missing Fields in Request
      value:
        code: IDE-0001
        title: Missing Fields in Request
        message: Your request is missing one or more required fields.
    Error0004:
      summary: Unexpected Fields in the Request
      value:
        code: IDE-0004
        title: Unexpected Fields in the Request
        message: >-
          The request body contains more fields than expected. Please send only
          the allowed fields.
    Error0007:
      summary: Bad Request
      value:
        code: IDE-0007
        title: Bad Request
        message: The server could not understand the request due to malformed syntax.
    Error0042:
      summary: MFA Invalid Passcode
      value:
        code: IDE-0042
        title: MFA Invalid Passcode
        message: The provided MFA passcode is invalid.
    Error0043:
      summary: MFA Setup Not Initiated
      value:
        code: IDE-0043
        title: MFA Setup Not Initiated
        message: >-
          MFA setup has not been initiated for this user. Please call the setup
          endpoint first.
    Error0044:
      summary: MFA Invalid Type
      value:
        code: IDE-0044
        title: MFA Invalid Type
        message: >-
          The provided MFA type is invalid. Accepted values are app, email, and
          sms.
    Error0046:
      summary: MFA Verification Failed
      value:
        code: IDE-0046
        title: MFA Verification Failed
        message: MFA verification failed. Please check the passcode and try again.
    Error0047:
      summary: MFA Secret Required
      value:
        code: IDE-0047
        title: MFA Secret Required
        message: A secret is required for this MFA operation.
    Error0048:
      summary: MFA Destination Not Configured
      value:
        code: IDE-0048
        title: MFA Destination Not Configured
        message: The MFA destination (email or phone) is not configured for this user.
    Error0050:
      summary: MFA Country Code Required
      value:
        code: IDE-0050
        title: MFA Country Code Required
        message: A country code is required for SMS-based MFA verification.
    Error1003:
      summary: User ID Not Found
      value:
        code: IDE-1003
        title: User ID Not Found
        message: The provided user ID does not exist in our records.
    Error0006:
      summary: Internal Server Error
      value:
        code: IDE-0006
        title: Internal Server Error
        message: The server encountered an unexpected error. Please try again later.
    Error0045:
      summary: MFA Operation Failed
      value:
        code: IDE-0045
        title: MFA Operation Failed
        message: >-
          The MFA operation failed due to an unexpected error. Please try again
          later.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: El token de autorización en formato 'Bearer <token>'.

````