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

# Enroll MFA

> Enroll in multi-factor authentication

Enroll in multi-factor authentication (MFA) using TOTP (Time-based One-Time Password).

<RequestExample>
  ```bash theme={null}
  curl -X POST https://api.gosentrix.io/api/v1/mfa/enroll \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json"
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "secret": "JBSWY3DPEHPK3PXP",
    "qr_code": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    "backup_codes": [
      "ABCD-1234-EFGH",
      "IJKL-5678-MNOP",
      "QRST-9012-UVWX",
      "YZAB-3456-CDEF",
      "GHIJ-7890-KLMN"
    ]
  }
  ```
</ResponseExample>

## Headers

<ParamField path="Authorization" type="string" required>
  Bearer token (access token)
</ParamField>

## Response

<ResponseField name="secret" type="string">
  TOTP secret key (for manual entry in authenticator apps)
</ResponseField>

<ResponseField name="qr_code" type="string">
  QR code data URL (for scanning with authenticator apps)
</ResponseField>

<ResponseField name="backup_codes" type="array">
  One-time backup codes (save securely)
</ResponseField>

## Next Steps

1. Scan the QR code with an authenticator app (Google Authenticator, Authy, etc.)
2. Verify MFA setup using [MFA Verify](/authentication-api/mfa-verify)
3. Save backup codes in a secure location

## Errors

<ResponseField name="401" type="object">
  Invalid or missing token
</ResponseField>

<ResponseField name="409" type="object">
  MFA already enrolled
</ResponseField>
