Skip to content
NimbusNexus

Two-factor authentication

Two-factor authentication adds a second factor (TOTP code from an authenticator app) on top of password login. The endpoints here turn it on, report it, and turn it off:

  • GET /api/v1/2fa/credential — generates a TOTP secret and returns its QR code as an image. The secret itself comes in the X-Secret-Key response header.
  • POST /api/v1/2fa/totp_passcode_validation — send that secret as secretKey, with a current six-digit passcode from the app. If the code matches, 2FA is on.
  • GET /api/v1/2fa/status — two_factor_enabled says whether 2FA is on.
  • POST /api/v1/2fa/off — turns 2FA off.

Each user has one TOTP secret; enrolling again replaces it.

For dashboard users, 2FA is browser-driven from the account settings page. Through the API, each call reads or changes only the signed-in caller's own 2FA, never another user's. API-key callers don't need 2FA — keys are themselves a "something you have" factor.

Strong recommendation: enable 2FA on every human account with role grants on production projects. Most account compromises trace to password reuse + no second factor.

What's next

Reference

GET/api/v1/2fa/credential

Two Factor Credential

Generate a TOTP secret for the calling user and return its QR code as a PNG image; the secret itself is in the X-Secret-Key response header.

Responses

  • 200The QR code of the new TOTP secret
  • 401Unauthorized
  • 403Forbidden
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/2fa/credential" \
  -H "Authorization: Bearer $NIMBUS_KEY"
POST/api/v1/2fa/off

Two Factor Off

Disable two-factor authentication for the calling user.

Responses

  • 200Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/2fa/off" \
  -H "Authorization: Bearer $NIMBUS_KEY"
GET/api/v1/2fa/status

Two Factor Status

Report whether two-factor authentication is currently enabled for the calling user.

Responses

  • 200Successful Response
  • 401Unauthorized
  • 403Forbidden
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X GET "https://api.nimbusnexus.net/api/v1/2fa/status" \
  -H "Authorization: Bearer $NIMBUS_KEY"
POST/api/v1/2fa/totp_passcode_validation

Totp Passcode Validation

Validate a TOTP passcode against the supplied secret and enable two-factor authentication on success.

Request body

FieldTypeDescription
passcode*string—
secretKey*string—

Responses

  • 200Successful Response
  • 400Bad Request
  • 401Unauthorized
  • 403Forbidden
  • 422Validation error
  • 429Too Many Requests
  • 500Internal Server Error

Example

curl -X POST "https://api.nimbusnexus.net/api/v1/2fa/totp_passcode_validation" \
  -H "Authorization: Bearer $NIMBUS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "passcode": "example",
    "secretKey": "example"
  }'

Need to make a real call? Try these endpoints in the live Swagger UI →