---
title: Verify MFA code and complete authentication
slug: api-documentation/verify-mfa-code-and-complete-authentication
docTags: 
createdAt: 2026-08-27T16:53:30.249Z
---

{
  "id": "Y3pmCDkRzRnzdGw7Ue46U",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.upstartcommerce.com/api/v1/auth/mfa/verify",
    "servers": [
      {
        "url": "https://api.upstartcommerce.com/api/v1/auth/mfa/verify",
        "description": "Production"
      }
    ],
    "name": "Verify MFA code and complete authentication",
    "description": "<p>Verifies the MFA code (TOTP, SMS OTP, or backup code) and completes the\nauthentication process started by the login endpoint.</p>\n<p>Upon successful verification, returns access and refresh tokens.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "example": "{\"challengeId\":\"ch_abc123xyz\",\"code\":\"123456\"}",
          "description": "MFA verification details",
          "customType": "MfaVerifyRequest",
          "schema": [
            {
              "name": "challengeId",
              "kind": "required",
              "type": "string",
              "description": "MFA challenge ID from login response",
              "example": "ch_abc123xyz"
            },
            {
              "name": "code",
              "kind": "required",
              "type": "string",
              "description": "<p>MFA verification code (TOTP, SMS OTP, or backup code)</p>",
              "example": "123456",
              "minLength": 6,
              "maxLength": 10
            }
          ],
          "modelRef": "#/components/schemas/MfaVerifyRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>MFA verification successful - tokens issued</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"accessToken\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\"refreshToken\":\"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...\",\"expiresIn\":3600,\"tokenType\":\"Bearer\"}",
            "description": "Successful authentication response containing tokens",
            "customType": "AuthResponse",
            "schema": [
              {
                "name": "accessToken",
                "kind": "required",
                "type": "string",
                "description": "<p>JWT access token for API authorization.</p>\n<p>Include in API requests as: <code>Authorization: Bearer &#x3C;accessToken></code></p>\n<p><strong>Claims</strong>:</p>\n<ul>\n<li><code>sub</code>: User ID (UUID)</li>\n<li><code>type</code>: Token type (consumer/management)</li>\n<li><code>roles</code>: List of role identifiers</li>\n<li><code>tenant</code>: Active tenant ID</li>\n<li><code>iat</code>: Issued at (Unix timestamp)</li>\n<li><code>exp</code>: Expiration (Unix timestamp)</li>\n<li><code>iss</code>: Issuer (auth-svc)</li>\n</ul>",
                "example": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl..."
              },
              {
                "name": "refreshToken",
                "kind": "required",
                "type": "string",
                "description": "<p>Refresh token for obtaining new access tokens.</p>\n<p>Store securely (e.g., httpOnly cookie or secure storage).\nUse with <code>/api/v1/auth/refresh</code> when access token expires.</p>",
                "example": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl..."
              },
              {
                "name": "expiresIn",
                "kind": "required",
                "type": "integer<int64>",
                "description": "Access token validity duration in seconds",
                "example": 3600,
                "format": "int64"
              },
              {
                "name": "tokenType",
                "kind": "required",
                "type": "string",
                "description": "<p>Token type (always \"Bearer\")</p>",
                "example": "Bearer"
              }
            ],
            "modelRef": "#/components/schemas/AuthResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Invalid request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"error\":\"invalid_request\",\"message\":\"Challenge ID and code are required\",\"code\":\"BAD_REQUEST\"}",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Invalid MFA code or challenge expired",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Invalid MFA code or challenge expired\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "invalidCode",
            "code": "// Invalid MFA code\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid MFA code. 4 attempts remaining.\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "challengeExpired",
            "code": "// Challenge expired\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"MFA challenge has expired. Please login again.\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Account locked due to too many failed attempts",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"error\":\"forbidden\",\"message\":\"Account locked due to too many failed MFA attempts\",\"code\":\"FORBIDDEN\"}",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "500",
        "description": "Internal server error",
        "jsonExample": "",
        "isExpanded": true,
        "subExamples": [
          {
            "label": "GENERATED",
            "code": "// Internal server error\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
          },
          {
            "label": "tokenGenerationFailed",
            "code": "// Token generation failed\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Token generation failed\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
          },
          {
            "label": "serviceError",
            "code": "// Upstream service error\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Failed to communicate with authentication backend\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
          }
        ],
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "Standard error response format",
            "customType": "ErrorResponse",
            "schema": [
              {
                "name": "error",
                "kind": "required",
                "type": "string",
                "description": "<p>Error type identifier:</p>\n<ul>\n<li><code>invalid_request</code>: Malformed request or missing required fields</li>\n<li><code>unauthorized</code>: Invalid credentials or token</li>\n<li><code>account_not_verified</code>: Account exists but email/phone not verified</li>\n<li><code>session_expired</code>: Maximum session lifetime exceeded, full re-login required</li>\n<li><code>unauthorized_tenant</code>: User not authorized for requested tenant</li>\n<li><code>tenant_required</code>: Multi-tenant user must specify tenant</li>\n<li><code>unauthorized_site</code>: User not authorized for requested site</li>\n<li><code>site_required</code>: Site context required for this operation</li>\n<li><code>no_authorized_sites</code>: User has no authorized sites</li>\n<li><code>forbidden</code>: Access denied (e.g., no authorized tenants)</li>\n<li><code>rate_limited</code>: Too many requests, try again later</li>\n<li><code>account_locked</code>: Account temporarily locked due to failed attempts</li>\n<li><code>internal_error</code>: Server-side error</li>\n</ul>",
                "example": "unauthorized"
              },
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "<p>Human-readable error description</p>",
                "example": "Invalid username or password"
              },
              {
                "name": "code",
                "kind": "required",
                "type": "string<BAD_REQUEST | UNAUTHORIZED | UNAUTHORIZED_TENANT | TENANT_REQUIRED | FORBIDDEN | RATE_LIMITED | ACCOUNT_LOCKED | INTERNAL_SERVER_ERROR>",
                "description": "HTTP status code name",
                "example": "UNAUTHORIZED",
                "enum": [
                  "BAD_REQUEST",
                  "UNAUTHORIZED",
                  "UNAUTHORIZED_TENANT",
                  "TENANT_REQUIRED",
                  "FORBIDDEN",
                  "RATE_LIMITED",
                  "ACCOUNT_LOCKED",
                  "INTERNAL_SERVER_ERROR"
                ]
              }
            ],
            "modelRef": "#/components/schemas/ErrorResponse",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "JnJGab9kS7add-XYsD2am",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.upstartcommerce.com/api/v1/auth/mfa/verify \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"challengeId\": \"ch_abc123xyz\",\n     \"code\": \"123456\"\n     }'"
        },
        {
          "id": "wsbOqMwskQNs5sODH47q2",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"challengeId\": \"ch_abc123xyz\",\n   \"code\": \"123456\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.upstartcommerce.com/api/v1/auth/mfa/verify\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "TAUXSb0DNQfrYxIgsFxqQ",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.upstartcommerce.com/api/v1/auth/mfa/verify\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"challengeId\": \"ch_abc123xyz\",\n   \"code\": \"123456\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "ZZN62VNggZzkkypWZnTZn",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.upstartcommerce.com/api/v1/auth/mfa/verify\"\n\npayload = json.dumps({\n   \"challengeId\": \"ch_abc123xyz\",\n   \"code\": \"123456\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "JnJGab9kS7add-XYsD2am"
    },
    "results": {
      "languages": [
        {
          "id": "Qqmdmm0k4GS7G3SH5lF9_",
          "language": "200",
          "code": "// MFA verification successful - tokens issued\n{\n  \"accessToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl...\",\n  \"refreshToken\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1NTBl...\",\n  \"expiresIn\": 3600,\n  \"tokenType\": \"Bearer\"\n}"
        },
        {
          "id": "wacXN8yzQ6A2fy91Z7EzS",
          "language": "400",
          "code": "// Invalid request\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
        },
        {
          "id": "IObOIq5Af1Vpe20y7kgzX",
          "language": "401",
          "code": "// Invalid MFA code or challenge expired\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Invalid MFA code or challenge expired\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "invalidCode",
              "code": "// Invalid MFA code\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid MFA code. 4 attempts remaining.\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "challengeExpired",
              "code": "// Challenge expired\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"MFA challenge has expired. Please login again.\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            }
          ]
        },
        {
          "id": "-6BybmEbYZIZusDgUwqgf",
          "language": "403",
          "code": "// Account locked due to too many failed attempts\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
        },
        {
          "id": "7KpD__dNtC-UDjyTQczbh",
          "language": "500",
          "code": "// Internal server error\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}",
          "subExamples": [
            {
              "label": "GENERATED",
              "code": "// Internal server error\n{\n  \"error\": \"unauthorized\",\n  \"message\": \"Invalid username or password\",\n  \"code\": \"UNAUTHORIZED\"\n}"
            },
            {
              "label": "tokenGenerationFailed",
              "code": "// Token generation failed\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Token generation failed\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
            },
            {
              "label": "serviceError",
              "code": "// Upstream service error\n{\n  \"error\": \"internal_error\",\n  \"message\": \"Failed to communicate with authentication backend\",\n  \"code\": \"INTERNAL_SERVER_ERROR\"\n}"
            }
          ]
        }
      ],
      "selectedLanguageId": "Qqmdmm0k4GS7G3SH5lF9_"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}