Two-Factor Authentication#

Two-factor authentication setup and verification

Verify 2FA code during login#

POST/2fa/verify

Request Body#

{
  "temp_token": "string",
  "code": "string",
  "redirect_url": "string"
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/verify" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"temp_token": "string",
"code": "string",
"redirect_url": "string"
}'

Responses#

{
  "redirect_url": "string"
}

Verify backup code during login#

POST/2fa/verify-backup

Request Body#

{
  "temp_token": "string",
  "backup_code": "string",
  "redirect_url": "string"
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/verify-backup" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"temp_token": "string",
"backup_code": "string",
"redirect_url": "string"
}'

Responses#

{
  "redirect_url": "string"
}

Recover a lost authenticator with a backup code#

POST/2fa/recovery

Atomically invalidates the old authenticator and backup codes, revokes interactive grants, and returns only a restricted replacement-factor enrollment session.

Request Body#

{
  "temp_token": "string",
  "backup_code": "string",
  "redirect_url": "string"
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/recovery" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"temp_token": "string",
"backup_code": "string",
"redirect_url": "string"
}'

Responses#

{
  "redirect_url": "string"
}

Setup 2FA#

POST/2fa/setup

Generate TOTP secret and QR code URL for setting up 2FA

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/setup" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

{
  "secret": "string",
  "qr_url": "string"
}

Verify and enable 2FA#

POST/2fa/verify-setup

Verify TOTP code and enable 2FA, returns backup codes

Request Body#

{
  "code": "string"
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/verify-setup" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"code": "string"
}'

Responses#

{
  "enabled": true,
  "backup_codes": [
    "string"
  ],
  "requires_backup_codes_acknowledgement": true
}

Acknowledge backup codes and complete MFA enrollment#

POST/2fa/acknowledge-backup-codes

Persists backup-code acknowledgement and elevates the restricted enrollment session.

Request Body#

{
  "acknowledged": true
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/acknowledge-backup-codes" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"acknowledged": true
}'

Responses#

{
  "redirect_url": "string"
}

Disable 2FA#

POST/2fa/disable

Disable 2FA (requires password and TOTP code)

Request Body#

{
  "password": "string",
  "code": "string"
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/disable" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"password": "string",
"code": "string"
}'

Responses#

{
  "success": true
}

Regenerate backup codes#

POST/2fa/backup-codes

Generate new backup codes (requires password, invalidates old ones)

Request Body#

{
  "password": "string"
}

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/backup-codes" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"password": "string"
}'

Responses#

{
  "backup_codes": [
    "string"
  ]
}

Reissue unacknowledged enrollment backup codes#

POST/2fa/backup-codes/reissue

Replaces and returns recovery codes only for the restricted enrollment session after a prior one-time delivery was lost.

Code Examples#

curl -X POST "https://platform.antfly.io/api/v1/2fa/backup-codes/reissue" \
-H "Authorization: Bearer YOUR_TOKEN"

Responses#

{
  "backup_codes": [
    "string"
  ]
}