Catalog/util-totp

Utilities

TOTP 2FA code API

Generate or verify a time-based one-time password (TOTP, RFC 6238) from a base32 secret — the 6-digit codes used by authenticator apps. Answers 'generate a 2FA code', 'verify this TOTP', 'current authenticator code'.

Price$0.01per request
MethodPOST
Route/v1/util/totp
StatusLive
MIME typeapplication/json
Rate limit120/minute
CacheNo cache
utiltotp2faotpmfaauthenticatorsecurity
API URLhttps://x402.hexl.dev/v1/util/totp
Integration docs
Example request
{
  "secret": "JBSWY3DPEHPK3PXP",
  "op": "generate"
}
Example response
{
  "op": "generate",
  "code": "282760",
  "secondsRemaining": 18,
  "digits": 6,
  "period": 30
}
Input schema
{
  "type": "object",
  "required": [
    "secret"
  ],
  "properties": {
    "secret": {
      "type": "string",
      "description": "base32"
    },
    "op": {
      "type": "string",
      "enum": [
        "generate",
        "verify"
      ],
      "default": "generate"
    },
    "code": {
      "type": "string"
    },
    "digits": {
      "type": "number",
      "default": 6
    },
    "period": {
      "type": "number",
      "default": 30
    },
    "algorithm": {
      "type": "string",
      "enum": [
        "sha1",
        "sha256",
        "sha512"
      ],
      "default": "sha1"
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}