POST /v1/crypto/totp-generate

TOTP codes

The six-digit code for a shared secret, or an enrolment URI to turn into a QR code.

Generate two-factor codes now No key, no code — 1 credit either way.

curl -X POST "$DOATHING_API/v1/crypto/totp-generate" \
  -H "x-api-key: $DOATHING_KEY" \
  -H "content-type: application/json" \
  -d '{"secret": "JBSWY3DPEHPK3PXP", "issuer": "DoAThing", "account": "you@example.test"}'

The six-digit code for a shared secret, or an enrolment URI to turn into a QR code.

Generate the current TOTP code for a base32 secret, or an otpauth:// provisioning URI.

Response

The result carries your remaining balance alongside it, so you can track spend without a second call.

{
  "code": "492039",
  "seconds_remaining": 17,
  "provisioning_uri": "otpauth://totp/DoAThing:you@example.test?secret=…",
  "request_id": "37f01edb-0163-42a1-ac51-0acaef979800",
  "credits_remaining": 96
}

Cost

1 credit per call, whether it is run from the site or from the API — the credential differs, the price does not. A new account starts with 20 credits.

A rejected request still costs a credit: the authorizer decrements before the tool validates. A call rejected for a missing or invalid key is free.

Parameters

Generated from the endpoint’s own validation, so this is exactly what it accepts. A body field goes at the top level; an option goes inside options.

NameInTypeDefaultNotes
secretbodystringThe base32 secret shared with the authenticator app.
issuerbodystring
accountbodystring
algorithmoptionsstring"sha1"sha1, sha256 or sha512. one of sha1, sha256, sha512
generate_secretoptionsbooleanfalseMake a new 160-bit secret instead of using one.
atoptionsintegerUnix time to generate the code for, for testing. 0 to 4102444800
digitsoptionsinteger6Code length, 6 to 10. Six is what apps expect. 6 to 10
periodoptionsinteger30Seconds each code is valid for. Thirty is standard. 15 to 300