BIO.RE
Authentication

Get 2FA Status

Read whether 2FA is currently enabled on the calling user. Read-only — useful for rendering the right UI on settings screens.

GET /api/v1/auth/2fa/status — 🔑 Bearer · No throttle

Returns the current User.twoFactorEnabled value. No mutations — purely a read.

The same flag is also returned by GET /auth/me as twoFactorEnabled. Use this dedicated endpoint when you only need that single bit and want to keep the me cache untouched (e.g., to drive a "Two-Factor Authentication" toggle on a settings screen).

Request

No body, no params.

HeaderRequiredNotes
Authorization: Bearer <accessToken>JWT from POST /auth/login

Response

200 OKApiResponseOf<TwoFactorStatusResponseDto>

{
  "success": true,
  "data": {
    "enabled": true
  }
}
FieldTypeNotes
enabledbooleanMirrors User.twoFactorEnabled

Errors

HTTPcode / i18nKeyReason
401(guard)Missing / invalid bearer token

Side effects

  1. Lookup User.twoFactorEnabled (single field select).
  2. Return { enabled }. No mutations.

Code samples

curl https://api.bio.re/api/v1/auth/2fa/status \
  -H "Authorization: Bearer $ACCESS_TOKEN"
async function getTwoFactorStatus(accessToken: string): Promise<boolean> {
  const res = await fetch('https://api.bio.re/api/v1/auth/2fa/status', {
    headers: { Authorization: `Bearer ${accessToken}` },
  });
  const json = await res.json();
  if (!res.ok || !json.success) {
    throw Object.assign(new Error(json?.error?.message ?? 'Status check failed'), {
      code: json?.error?.code,
    });
  }
  return json.data.enabled;
}
import { useQuery } from '@tanstack/react-query';

export const twoFactorKeys = {
  status: () => ['auth', '2fa', 'status'] as const,
};

export function useTwoFactorStatus() {
  return useQuery({
    queryKey: twoFactorKeys.status(),
    queryFn: async () => {
      const res = await fetch('/api/v1/auth/2fa/status');
      const json = await res.json();
      if (!res.ok || !json.success) {
        throw Object.assign(new Error(json?.error?.message ?? 'Status check failed'), {
          code: json?.error?.code,
          i18nKey: json?.error?.i18nKey,
        });
      }
      return json.data.enabled as boolean;
    },
    staleTime: 60_000, // 1 min — flips rarely outside of explicit setup/disable
  });
}

Try it

GET
/api/v1/auth/2fa/status
AuthorizationBearer <token>

In: header

Response Body

application/json

application/json

curl -X GET "https://loading/api/v1/auth/2fa/status"
{
  "success": true,
  "data": {
    "enabled": false
  }
}
{
  "success": false,
  "error": {
    "code": "AUTH_UNAUTHORIZED",
    "message": "Invalid credentials",
    "i18nKey": "auth.login.invalid_credentials",
    "i18nVars": {
      "field": "email"
    },
    "details": [
      {
        "message": "email must be an email"
      }
    ],
    "correlationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Source

SourcePathLines
Controllerapps/api-core/src/modules/auth/two-factor.controller.ts88–95 (isEnabled)
DTO (response)apps/api-core/src/modules/auth/dto/response.dto.ts132–135 (TwoFactorStatusResponseDto)
Serviceapps/api-core/src/modules/auth/two-factor.service.ts166–172 (isEnabled)
Prisma modelpackages/prisma/prisma/schema.prismaUser.twoFactorEnabled

On this page