Documentation

Multi-Factor Authentication

Set up and manage MFA for admin accounts

TOTP Setup

Set up time-based one-time password (TOTP) authentication.

Start Setup

POST/auth/admin/mfa/totp/setup

Initialize TOTP setup. Returns a secret and QR code URL for authenticator apps.

Headers

ParameterTypeRequiredDescription
AuthorizationstringYesBearer {access_token}

Response- TOTP setup information

json
{
  "secret": "JBSWY3DPEHPK3PXP",
  "otpauth_url": "otpauth://totp/WalletCore:admin@example.com?secret=JBSWY3DPEHPK3PXP&issuer=WalletCore",
  "recovery_codes": [
    "ABC123DEF456",
    "GHI789JKL012",
    "MNO345PQR678",
    "STU901VWX234",
    "YZA567BCD890"
  ]
}

Error Responses

StatusCodeDescription
400mfa_already_enabledMFA is already enabled for this account

Confirm Setup

POST/auth/admin/mfa/totp/confirm

Confirm TOTP enrollment by providing a valid code from your authenticator app.

Headers

ParameterTypeRequiredDescription
AuthorizationstringYesBearer {access_token}
Content-TypestringYesapplication/json

Request Body- TOTP code to confirm

json
{
  "code": "123456"
}

Response- No content on success (HTTP 204)

json

Error Responses

StatusCodeDescription
401mfa_confirm_failedInvalid TOTP code

MFA Verification

Verify MFA during login flow.

Verify TOTP Code

POST/auth/admin/mfa/verify

Complete login by verifying TOTP code. This endpoint is used after initial login when MFA is required.

Headers

ParameterTypeRequiredDescription
Content-TypestringYesapplication/json

Request Body- Pending token and TOTP code

json
{
  "pending_token": "pending_token_from_login",
  "code": "123456"
}

Response- Authentication tokens

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2g...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Error Responses

StatusCodeDescription
401mfa_verify_failedInvalid or expired TOTP code
429mfa_lockedToo many failed attempts (10/min, 120/day)

Recovery Codes

Manage MFA recovery codes for account recovery.

Use Recovery Code

POST/auth/admin/mfa/recovery

Complete login using a recovery code when TOTP device is unavailable.

Headers

ParameterTypeRequiredDescription
Content-TypestringYesapplication/json

Request Body- Pending token and recovery code

json
{
  "pending_token": "pending_token_from_login",
  "recovery_code": "ABC123DEF456"
}

Response- Authentication tokens

json
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "refresh_token": "dGhpcyBpcyBhIHJlZnJlc2g...",
  "token_type": "Bearer",
  "expires_in": 3600
}

Error Responses

StatusCodeDescription
401recovery_verify_failedInvalid or already used recovery code
429mfa_lockedToo many failed attempts (5/min, 60/day)

Get Recovery Code Count

GET/auth/admin/mfa/recovery/count

Get the number of remaining recovery codes.

Headers

ParameterTypeRequiredDescription
AuthorizationstringYesBearer {access_token}

Response- Recovery code count

json
{
  "remaining": 3
}

Regenerate Recovery Codes

POST/auth/admin/mfa/recovery/regen

Generate new recovery codes. This invalidates all existing recovery codes.

Headers

ParameterTypeRequiredDescription
AuthorizationstringYesBearer {access_token}
Content-TypestringYesapplication/json

Request Body- Optional count of codes to generate

json
{
  "count": 10
}

Response- New recovery codes

json
{
  "recovery_codes": [
    "NEW123ABC456",
    "DEF789GHI012",
    "JKL345MNO678",
    "PQR901STU234",
    "VWX567YZA890"
  ]
}

MFA Login Flow

Understanding the complete MFA authentication flow.

Authentication Steps

StepActionResponse
1POST /auth/admin/login with credentialsReturns pending_token if MFA enabled
2aPOST /auth/admin/mfa/verify with TOTP codeReturns access_token and refresh_token
2bPOST /auth/admin/mfa/recovery with recovery codeAlternative: Returns tokens
2cPOST /auth/admin/webauthn/login with passkeyAlternative: Returns tokens