Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

TOTP Code Generator API

Generate the current and next TOTP (RFC 6238) codes for a Base32 secret, as an authenticator app would, plus an otpauth:// URI.

POST /api/v1/tools/totp-generatorMCP totp_generatorSecurity & Privacy

Generate time-based 2FA codes from a Base32 secret or otpauth:// URI, with a live countdown. Supports SHA-1, SHA-256 and SHA-512 with 6 or 8 digits.

Input

Send these as a JSON object. Unknown fields are rejected.

secret
The shared secret in Base32 (spaces and lowercase are fine), e.g. JBSWY3DPEHPK3PXP. (string, up to 1000 characters, required)
time
Unix time in seconds to generate codes for. Defaults to now. (number, 0 to 253402300799)
digits
Code length. (integer, 6 to 8, default 6)
period
Seconds each code is valid for. (integer, 1 to 3600, default 30)
algorithm
HMAC hash. Almost every service uses SHA-1. (string, one of SHA-1, SHA-256, SHA-512, default "SHA-1")
issuer
Service name for the otpauth:// URI, e.g. GitHub. (string, up to 200 characters, default "")
account
Account name for the otpauth:// URI, e.g. [email protected]. (string, up to 200 characters, default "")
curl https://pithlab.com/api/v1/tools/totp-generator \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"secret":"JBSWY3DPEHPK3PXP","time":1700000000}'