Skip to main content

Two Factor Auth - Disable

Endpoint

/i/two-factor-auth?method=disable

Overview

Disables 2FA for the authenticated user.

Authentication

Countly API supports three authentication methods:

  1. api_key=YOUR_API_KEY
  2. auth_token=YOUR_AUTH_TOKEN
  3. countly-token: YOUR_AUTH_TOKEN

Permissions

Requires authenticated user context.

Request Parameters

ParameterTypeRequiredDescription
methodStringYesMust be disable.
api_keyStringYes (or use auth_token)API key for authentication.
auth_tokenStringNoAuth token as query parameter or countly-token header.

Configuration Impact

SettingDefaultAffectsUser-visible impact
two-factor-auth.globally_enabledfalseDisable flowWhen true, user self-disable is blocked with 403.

Response

Success Response

{
"result": "Disabled 2FA for user"
}

Response Fields

FieldTypeDescription
resultStringResult message.

Error Responses

  • 403
{
"result": "Can not disable 2FA for user when it is globally enabled"
}
  • 500
{
"result": "Database error while disabling 2FA"
}

Behavior/Processing

  • Clears two_factor_auth.secret_token and sets two_factor_auth.enabled=false.
  • Emits system log action: two_factor_auth_disabled.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersUser account settingsDisables user 2FA and removes stored secret.
countly.systemlogsAudit trailReceives two_factor_auth_disabled action.

Examples

Disable 2FA for current user

/i/two-factor-auth?api_key=YOUR_API_KEY&method=disable

Last Updated

2026-03-05