POST
crypto
totp_generate
1 creditGenerate a TOTP secret and current one-time code, or compute the current code for an existing secret. Returns an otpauth URI for authenticator apps.
Endpoint
POST /api/v1/tools/crypto/totp_generate
Body Parameters
digits
integer
optional
default: 6
Options:
6
7
8
issuer
string
optional
default: ""
secret
string | null
optional
default: null
interval
integer
optional
default: 30
account_name
string
optional
default: ""
Example
input
Request
{
"issuer": "MyApp",
"secret": "JBSWY3DPEHPK3PXP",
"account_name": "user@example.com"
}
output
Response
{
"uri": "otpauth://totp/user%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=MyApp",
"digits": 6,
"secret": "JBSWY3DPEHPK3PXP",
"interval": 30,
"current_code": "123456"
}
Response Format
HTTP/1.1 200 OK
SUCCESS
{
"success": true,
"data": {
"uri": "otpauth://totp/user%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=MyApp",
"digits": 6,
"secret": "JBSWY3DPEHPK3PXP",
"interval": 30,
"current_code": "123456"
},
"meta": {
"tool": "totp_generate",
"credits_consumed": 1
}
}
HTTP/1.1 422 Unprocessable Entity
ERROR
{
"success": false,
"data": null,
"error": {
"code": "validation_error",
"message": "The given data was invalid."
}
}
Sign in to try this tool directly from the docs.
Code Examples
Request Example
lightbulb
Developer Tip
Credits are deducted before execution. If the upstream tool fails, credits are automatically refunded to your account.