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

# Submit a 6-digit MFA code to complete login

> Second leg of the MFA login flow. The first leg (POST /api/auth/signin
or /autosignup) returned `{mfaRequired: true, challengeId, maskedEmail}`
and emailed a 6-digit code. This endpoint accepts the typed code, and
on success returns the same shape as a normal signin response (token +
profile) and sets a long-lived `pria_mfa_trust` cookie that lets the
same browser skip MFA for the next 7 days (or whatever MFA_TRUST_DAYS
sets, bounded to [1, 30]).

**Embedded (SDK / Canvas) launches:** when the code was requested from
an SDK launch, the success answer also carries `mfaTrust`, a device
handle for the embedded page. The page keeps it and sends it as
`mfaTrust` in the body of its later SDK launches (the embedded frame
never receives the cookie). It lasts 24 hours, or until trusted
devices are signed out in Security settings or the password changes;
logging out inside the embedded page also forgets it. It is honoured
only on SDK launches (`/api/auth/autosignup` with `institution_id` or
`lticontextid`), for the same person, from the same network.

The accepted code signs the person in to the Digital Twin and course the launch named, with
the launch's own checks: a Digital Twin that is no longer usable answers 400 with the reason;
a Digital Twin that requires Canvas sign-in answers `{ consent, mfaTrust }`, and the launch
that follows the Canvas step needs no second code when it carries that `mfaTrust`. A launch
challenge answers only on the network that started it (see 410).

**Brute-force protection:** 5 wrong attempts per code; the 6th burns
the challenge (status invalidated) and the user must request a new
code via /mfa-resend. Every wrong code also counts toward the person's
limit for that kind of sign-in (an embedded / Canvas launch, a password
sign-in, or any other sign-in): 10 an hour or 20 a day. Over it, that
kind of sign-in answers 423 `MFA_LOCKED` with `retryAfter` (seconds) —
here and at sign-in — while the other kinds stay open; the wrong code
that reaches the limit already answers 423. A correct code clears the
count; an administrator can clear it by changing the person's MFA setting
or signing out their trusted devices.

**Rate limit:** 100 req/min per IP (authLimiter).




## OpenAPI

````yaml /mdx/api-reference/admin/admin-api.json post /api/auth/mfa-verify
openapi: 3.0.0
info:
  title: Pria Admin API
  version: 2.0.321
  description: >-
    Pria API Documentation Praxis's developer platform is a core part of our
    mission to empower organizations to grow better. Our APIs are designed to
    enable teams of any shape or size to build robust integrations that help
    them customize and get the most value out of Pria. All Pria APIs are built
    using REST conventions and designed to have a predictable URL structure.
    <br/>  <br/>They use many standard HTTP features, including methods (POST,
    GET, PUT, DELETE) and error response codes.  <br/> <br/>All API calls are
    made under https://hiimpria.ai/api and all responses return standard JSON.
    In these docs, you'll find lists of all available endpoints for a given API,
    along with interactive code blocks for building requests. For walkthroughs
    of basic usage for these APIs, check out the API guides. <br/> <br/>A
    session that a course page (Canvas) opened for an administrator — or that a
    Digital Twin's sign-in provider opened for one of its people — starts with
    user rights in that twin only: until the person confirms it's them with a
    code (POST /api/user/launch-scope/challenge, then /api/auth/mfa-resend and
    /api/auth/mfa-verify), every route outside that twin's day-to-day work
    answers 403 with code LAUNCH_SCOPE_STEP_UP and the twin's id.
servers:
  - url: https://hiimpria.ai
    description: Pria API Server
security: []
tags:
  - name: Authentication
    description: User authentication, registration, and password management (/api/auth)
  - name: OAuth
    description: OAuth authentication providers - Google, GitHub, SSO (/api/auth/oauth)
  - name: User
    description: User profile management and account operations (/api/user)
  - name: User Institutions
    description: User institution memberships and switching (/api/user/institution)
  - name: User Tools
    description: Available tools for authenticated users (/api/user/tools)
  - name: Institutions
    description: Institution settings and configuration (/api/user/institution)
  - name: Conversation
    description: AI conversation and Q&A endpoints (/api/ai)
  - name: Realtime
    description: Real-time voice AI and WebRTC sessions (/api/ai/rt)
  - name: Assistant
    description: AI assistant configuration and management (/api/user/assistant)
  - name: History
    description: Conversation history and favorites (/api/user/history)
  - name: RAG
    description: >-
      Document upload, embedding, and retrieval-augmented generation
      (/api/user/files, /api/user/rag)
  - name: Setting
    description: Instance variables and settings management (/api/user/setting)
  - name: Branding
    description: Digital twin branding and customization (/api/agent/branding)
  - name: Agent
    description: Agent engagement and session management (/api/agent)
  - name: SDK Launch
    description: >-
      SDK launch token signing and verification for secure iframe embedding
      (/api/auth/sdk-sign, /api/auth/sdk-verify)
  - name: Testing
    description: Health checks, diagnostics, and test endpoints (/api/test)
  - name: Admin Accounts
    description: Account management for account managers (/api/admin/account)
  - name: Admin Institutions
    description: Institution management for admins (/api/admin/institution)
  - name: Admin Users
    description: User management for admins (/api/admin/user)
  - name: Admin Entitlements
    description: >-
      User-institution relationships and permissions
      (/api/admin/userInstitution)
  - name: Admin Sessions
    description: Session management for admins (/api/admin/session)
  - name: Admin Histories
    description: Conversation history management and analytics (/api/admin/history)
  - name: Admin Assistants
    description: AI assistant management for admins (/api/admin/assistant)
  - name: Admin Questions
    description: Institution question and prompt management (/api/admin/question)
  - name: Admin Tools
    description: Tool configuration management (/api/admin/tool)
  - name: Admin AI Models
    description: AI model configuration (/api/admin/aimodel)
  - name: Admin MCP Servers
    description: Model Context Protocol server management (/api/admin/mcpserver)
  - name: Admin Feedbacks
    description: User feedback management (/api/admin/feedback)
  - name: Admin Uploads
    description: Upload management (/api/admin/upload)
  - name: Admin Charts
    description: Analytics and visualization chart management (/api/admin/chart)
  - name: Admin Memory
    description: Admin inspection and editing of user/instance memory parameters.
  - name: Admin Usage Limits
    description: Per-user usage-vs-cap reporting and account-wide at-limit counts.
paths:
  /api/auth/mfa-verify:
    post:
      tags:
        - Authentication
      summary: Submit a 6-digit MFA code to complete login
      description: >
        Second leg of the MFA login flow. The first leg (POST /api/auth/signin

        or /autosignup) returned `{mfaRequired: true, challengeId, maskedEmail}`

        and emailed a 6-digit code. This endpoint accepts the typed code, and

        on success returns the same shape as a normal signin response (token +

        profile) and sets a long-lived `pria_mfa_trust` cookie that lets the

        same browser skip MFA for the next 7 days (or whatever MFA_TRUST_DAYS

        sets, bounded to [1, 30]).


        **Embedded (SDK / Canvas) launches:** when the code was requested from

        an SDK launch, the success answer also carries `mfaTrust`, a device

        handle for the embedded page. The page keeps it and sends it as

        `mfaTrust` in the body of its later SDK launches (the embedded frame

        never receives the cookie). It lasts 24 hours, or until trusted

        devices are signed out in Security settings or the password changes;

        logging out inside the embedded page also forgets it. It is honoured

        only on SDK launches (`/api/auth/autosignup` with `institution_id` or

        `lticontextid`), for the same person, from the same network.


        The accepted code signs the person in to the Digital Twin and course the
        launch named, with

        the launch's own checks: a Digital Twin that is no longer usable answers
        400 with the reason;

        a Digital Twin that requires Canvas sign-in answers `{ consent, mfaTrust
        }`, and the launch

        that follows the Canvas step needs no second code when it carries that
        `mfaTrust`. A launch

        challenge answers only on the network that started it (see 410).


        **Brute-force protection:** 5 wrong attempts per code; the 6th burns

        the challenge (status invalidated) and the user must request a new

        code via /mfa-resend. Every wrong code also counts toward the person's

        limit for that kind of sign-in (an embedded / Canvas launch, a password

        sign-in, or any other sign-in): 10 an hour or 20 a day. Over it, that

        kind of sign-in answers 423 `MFA_LOCKED` with `retryAfter` (seconds) —

        here and at sign-in — while the other kinds stay open; the wrong code

        that reaches the limit already answers 423. A correct code clears the

        count; an administrator can clear it by changing the person's MFA
        setting

        or signing out their trusted devices.


        **Rate limit:** 100 req/min per IP (authLimiter).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MfaVerifyRequest'
      responses:
        '200':
          description: >-
            Code accepted. Response shape matches POST /api/auth/signin success
            — a JWT token plus the user profile. A Set-Cookie pria_mfa_trust=...
            header is also set.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SignupResponse'
        '400':
          description: >-
            Missing challengeId or code; or `CODE_NOT_SENT` — the challenge came
            from an SDK / Canvas launch and no code has been emailed yet (call
            /mfa-resend first). No attempt is counted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MfaVerifyError'
        '401':
          description: >-
            Wrong code — `attemptsRemaining` indicates how many tries remain
            before the challenge is invalidated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MfaVerifyError'
        '403':
          description: >-
            `LAUNCH_SIGNIN_OFF` — this course sign-in cannot be completed on the
            consumer app service or for a consumer app Digital Twin. Open Pria
            directly and sign in there. No trusted-device cookie is issued for
            this refusal.
        '410':
          description: >-
            Challenge unknown / expired / already verified / cancelled — client
            must restart the signin flow. When the same correct code arrives
            twice at once, one signs in: the other answers 410 for an emailed
            code, and 401 `WRONG_CODE` (already used) for an authenticator or
            backup code. A challenge from an embedded / Canvas launch answered
            from another network than the one that started it: 410 too, nothing
            counted — the embedded page reloads for a fresh challenge.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MfaVerifyError'
        '423':
          description: >-
            `TOO_MANY_ATTEMPTS`: too many wrong attempts on this code; the
            challenge is invalidated — request a fresh code via /mfa-resend.
            `MFA_LOCKED`: too many failed codes for this kind of sign-in; no
            code is checked until `retryAfter` (seconds) has passed. Both limits
            hold for requests sent at the same time: each try is counted before
            its code is checked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MfaVerifyError'
        '429':
          description: >-
            Too many requests. On the consumer app service the budgets are
            shared across the whole service and keyed per address (20 a minute)
            and per `challengeId` (10 a minute); the body carries `keyClass`
            naming the budget that answered. Elsewhere, the per-address limit of
            this route.
        '500':
          description: >-
            `MFA_NOT_CONFIGURED`: the server cannot check this kind of code
            right now (an emailed code or a backup code); nothing was counted.
            An authenticator-app code is still checked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MfaVerifyError'
components:
  schemas:
    MfaVerifyRequest:
      type: object
      required:
        - challengeId
        - code
      properties:
        challengeId:
          type: string
          description: >-
            Opaque server-issued challenge identifier returned by POST
            /api/auth/signin (or /autosignup) when the response carried
            mfaRequired=true.
          example: 65f2c9a1d8e4b3c5a1234567
        code:
          type: string
          pattern: ^[0-9]{6}$
          description: The 6-digit numeric code the user received by email.
          example: '472918'
    SignupResponse:
      type: object
      properties:
        token:
          type: string
          description: JWT authentication token
        profile:
          $ref: '#/components/schemas/UserProfile'
    MfaVerifyError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          enum:
            - BAD_REQUEST
            - WRONG_CODE
            - CHALLENGE_EXPIRED
            - TOO_MANY_ATTEMPTS
            - USER_MISSING
            - RESEND_COOLDOWN
            - MFA_NOT_CONFIGURED
            - MFA_EMAIL_FAILED
            - CODE_NOT_SENT
            - MFA_LOCKED
            - MFA_SEND_LIMIT
        message:
          type: string
        attemptsRemaining:
          type: integer
          description: Only present on WRONG_CODE / TOO_MANY_ATTEMPTS responses.
          example: 4
        retryAfter:
          type: integer
          description: >-
            Seconds the client should wait before retrying. Present on
            RESEND_COOLDOWN, MFA_LOCKED and MFA_SEND_LIMIT.
          example: 24
        serverTime:
          type: integer
          description: >-
            The server clock in epoch seconds, on every 410. An embedded page
            measures how old its launch is on this clock before reloading to get
            a new challenge.
          example: 1790000000
    UserProfile:
      type: object
      properties:
        _id:
          type: string
        email:
          type: string
          format: email
        fname:
          type: string
        lname:
          type: string
        picture:
          type: string
        accountType:
          type: string
        permissions:
          type: array
          items:
            type: string
        customerId:
          type: string
        lxp_user_id:
          type: string
        lxp_user_type:
          type: integer
        lxp_partner_id:
          type: string
        lxp_partner_name:
          type: string
        lxp_role_id:
          type: integer
        lxp_role_name:
          type: string
        credits:
          type: integer
        creditsUsed:
          type: integer
        plan:
          type: string
        status:
          type: string
        trial_end:
          type: string
          format: date-time
        trial_used:
          type: boolean
        current_period_end:
          type: string
          format: date-time
        cancel_at_period_end:
          type: boolean
        referralId:
          type: string
          format: uuid
        referrerPaid:
          type: boolean
        resetCodeId:
          type: string
          format: uuid
        invoices_urls:
          type: array
          items:
            type: string
        remember_history_count:
          type: integer
        browser_voice:
          type: string
        rt_voice:
          type: string
        use_location:
          type: boolean
        showSideBar:
          type: boolean
        sideBarCollapsed:
          type: boolean
        dark_mode:
          type: boolean
        created:
          type: string
          format: date-time
        __v:
          type: integer
        institution:
          $ref: '#/components/schemas/InstitutionProfile'
    InstitutionProfile:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        picture:
          type: string
        picture_bg:
          type: string
        picture_dark_bg:
          type: string
        picture_animated:
          type: string
        elevenlabs_agent_id:
          type: string
        credits:
          type: integer
        status:
          type: string
        allowJoining:
          type: string
        joiningAdminOnly:
          type: boolean
        publicId:
          type: string
          format: uuid
        publicAuthorizedUrls:
          type: array
          items:
            type: string
        ainame:
          type: string
        contactEmail:
          type: string
          format: email
        creditAward:
          type: integer
        poolCredits:
          type: boolean
        invoices_urls:
          type: array
          items:
            type: string
        maxCompletionTokens:
          type: integer
        disableFileUploadForUser:
          type: boolean
        disableAudioNotesForUser:
          type: boolean
        toolsDisabled:
          type: array
          items:
            type: string
        ltiContextIds:
          type: array
          items:
            type: string
        personalisationAsked:
          type: boolean
        locationEnabled:
          type: boolean
        rtEnabled:
          type: boolean
        rtAdminOnly:
          type: boolean
        displayAgentDetails:
          type: boolean
        displayThinkingDetails:
          type: boolean
        displayRagSearchDetails:
          type: boolean
        displayMemoryDetails:
          type: boolean
        displayThinkingExecution:
          type: boolean
        displayToolExecution:
          type: boolean
        assistantsDisabled:
          type: array
          items:
            type: string
        disableAssistantsForUser:
          type: boolean
        rtVoice:
          type: string
        maxFiles:
          type: integer
        questionType:
          type: string
        creditsTotal:
          type: integer
          nullable: true
        creditsUsagePct:
          type: number
        id:
          type: string
        account:
          type: object
          description: The twin's parent account (same shape as /api/user/refresh/profile).
          properties:
            _id:
              type: string
            name:
              type: string
            status:
              type: string
            canvasCredsResolved:
              type: boolean
            privacyPolicyHTML:
              type: string
              description: >-
                The account privacy policy the user must accept before using the
                twin (empty or absent = no policy).
            privacyPolicyUpdatedAt:
              type: string
              format: date-time
              description: >-
                When the policy text last changed (absent for policies set
                before this field existed).
            privacyPolicyHash:
              type: string
              nullable: true
              description: >-
                Server-computed policy version (first 16 hex of sha256 of the
                trimmed HTML). null when there is no policy. Send it to POST
                /api/user/account-policy/accept.
              example: 3bfb489f9bd077f0

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.