Two-Factor Authentication
Two-factor authentication setup and verification
Verify 2FA code during login
POST
/2fa/verifyRequest 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"
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/verify", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"temp_token": "string",
"code": "string",
"redirect_url": "string"
})
});
const data = await response.json();Responses
{
"redirect_url": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Verify backup code during login
POST
/2fa/verify-backupRequest 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"
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/verify-backup", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"temp_token": "string",
"backup_code": "string",
"redirect_url": "string"
})
});
const data = await response.json();Responses
{
"redirect_url": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Recover a lost authenticator with a backup code
POST
/2fa/recoveryAtomically 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"
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/recovery", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"temp_token": "string",
"backup_code": "string",
"redirect_url": "string"
})
});
const data = await response.json();Responses
{
"redirect_url": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Setup 2FA
POST
/2fa/setupGenerate 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"const response = await fetch("https://platform.antfly.io/api/v1/2fa/setup", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"secret": "string",
"qr_url": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Verify and enable 2FA
POST
/2fa/verify-setupVerify 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"
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/verify-setup", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"code": "string"
})
});
const data = await response.json();Responses
{
"enabled": true,
"backup_codes": [
"string"
],
"requires_backup_codes_acknowledgement": true
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Acknowledge backup codes and complete MFA enrollment
POST
/2fa/acknowledge-backup-codesPersists 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
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/acknowledge-backup-codes", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"acknowledged": true
})
});
const data = await response.json();Responses
{
"redirect_url": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Disable 2FA
POST
/2fa/disableDisable 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"
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/disable", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"password": "string",
"code": "string"
})
});
const data = await response.json();Responses
{
"success": true
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Regenerate backup codes
POST
/2fa/backup-codesGenerate 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"
}'const response = await fetch("https://platform.antfly.io/api/v1/2fa/backup-codes", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"password": "string"
})
});
const data = await response.json();Responses
{
"backup_codes": [
"string"
]
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}Reissue unacknowledged enrollment backup codes
POST
/2fa/backup-codes/reissueReplaces 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"const response = await fetch("https://platform.antfly.io/api/v1/2fa/backup-codes/reissue", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_TOKEN"
}
});
const data = await response.json();Responses
{
"backup_codes": [
"string"
]
}{
"error": "string",
"message": "string"
}{
"error": "string",
"message": "string"
}