Free TOTP API

Generate Time-based One-Time Passwords programmatically. No API key, no registration, no rate limits. Free for everyone.

Free forever No auth required CORS enabled JSON response

Endpoint

GET https://webnotronics.com/api/otp

Returns the current TOTP code for a given secret key along with expiry metadata.

Parameter Required Default Description
keyrequiredBase32 encoded secret key
digitsoptional6OTP length (4–10)
periodoptional30Validity window in seconds
algorithmoptionalSHA1SHA1, SHA256, or SHA512
// Response — 200 OK
{
  "otp":          "482931",
  "expires_in":   18,
  "period":       30,
  "digits":       6,
  "algorithm":    "SHA1",
  "generated_at": "2025-01-01T12:00:00Z",
  "valid_until":  "2025-01-01T12:00:18Z"
}
Try it live

Code examples

// JavaScript
const res  = await fetch(
  'https://webnotronics.com/api/otp?key=YOUR_SECRET'
);
const data = await res.json();
console.log(data.otp);  // "482931"
Setup: Upload api/otp/index.php from your project to your server. The endpoint will then be live at yourdomain.com/api/otp. The .htaccess file handles clean URLs automatically.
Need help? Contact on WhatsApp