Generate Time-based One-Time Passwords programmatically. No API key, no registration, no rate limits. Free for everyone.
Endpoint
Returns the current TOTP code for a given secret key along with expiry metadata.
| Parameter | Required | Default | Description |
|---|---|---|---|
| key | required | — | Base32 encoded secret key |
| digits | optional | 6 | OTP length (4–10) |
| period | optional | 30 | Validity window in seconds |
| algorithm | optional | SHA1 | SHA1, 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" }
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"
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.