TOTP Generate API - Free 2FA Code Generator
Compute a time-based one-time password (TOTP) from a shared secret. The code rotates every 30 seconds by default and is compatible with authenticator apps like Google Authenticator, Authy, and 1Password.
Code examples
curl -X POST https://api.botoi.com/v1/totp/generate \
-H "Content-Type: application/json" \
-d '{"secret":"JBSWY3DPEHPK3PXP","period":30,"digits":6}'When to use this API
Testing 2FA enrollment flows
Generate valid TOTP codes from a known secret to automate end-to-end tests of your two-factor authentication setup.
Server-side 2FA verification
Generate the expected TOTP code on your server and compare it to the code submitted by the user, with a configurable time window for clock skew.
Frequently asked questions
Is this compatible with Google Authenticator?
Yes. The default settings (6 digits, 30-second period, SHA-1) match Google Authenticator exactly.
What format should the secret be in?
The secret must be Base32-encoded, which is the standard format used by authenticator apps and QR code provisioning URIs.
What does remainingSeconds mean?
It indicates how many seconds remain before the current code expires and a new one is generated.
Can I generate HOTP (counter-based) codes?
No. This endpoint generates only TOTP (time-based) codes. HOTP uses a counter instead of a timestamp and is not supported here.
Get your API key
Free tier includes 5 requests per minute with no credit card required. Upgrade for higher limits.