Skip to content

TOTP Temporary Password Generation

1. Basic Usage

TIP

The server will not log any of your requests or compromise your privacy in any way!

Base API URL:

txt
https://zeapi.ink/v1/api/key2otp

Generate a one-time password (OTP) using the following URL or POST request:

txt
https://zeapi.ink/v1/api/key2otp?secret=GEZDGNBVGY3TQOI&algorithm=sha1&digits=6&period=30

Or send JSON data via POST request:

json
{
    "secret": "GEZDGNBVGY3TQOI",
    "algorithm": "sha1",
    "digits": 6,
    "period": 30
}

Shell request example:

shell
curl -X POST https://zeapi.ink/v1/api/key2otp \
-d "secret=GEZDGNBVGY3TQOI=" \
-d "algorithm=sha256" \
-d "digits=6" \
-d "period=30"

2. Request Parameters

ParameterTypeRequiredDefault ValueDescription
secretstringYesNoneBase32-encoded TOTP secret (only A-Z and 2-7 allowed)
algorithmstringNosha1Encryption algorithm, supports sha1, sha256, sha512
digitsintNo6OTP length, supports 6 to 8 digits
periodintNo30OTP validity period (seconds), range 1 to 300 seconds

3. JSON Response Format

Success response example:

json
{
    "status": "success",
    "otp": "123456",
    "algorithm": "sha1",
    "digits": 6,
    "period": 30,
    "expires_at": "2025-07-06 10:14:30"
}

Error response example (missing secret):

json
{
    "status": "error",
    "message": "Missing secret parameter"
}

Error response example (invalid secret format):

json
{
    "status": "error",
    "message": "Invalid secret format. Must contain only A-Z and 2-7 (base32)."
}

Error response example (unsupported algorithm):

json
{
    "status": "error",
    "message": "Invalid algorithm. Supported values: sha1, sha256, sha512"
}

Error response example (invalid digits):

json
{
    "status": "error",
    "message": "Invalid digits. Must be between 6 and 8."
}

Error response example (invalid period):

json
{
    "status": "error",
    "message": "Invalid period. Must be between 1 and 300 seconds."
}

Error response example (failed to generate OTP):

json
{
    "status": "error",
    "message": "Failed to generate OTP: [error message]"
}

4. Response Fields Description

FieldTypeDescription
statusstringRequest status (success/error)
otpstringGenerated one-time password (TOTP)
algorithmstringEncryption algorithm used (sha1/sha256/sha512)
digitsintOTP length
periodintOTP validity period (seconds)
expires_atstringOTP expiration time (format: YYYY-MM-DD HH:MM:SS)
messagestringOperation result message (returned only on error)

Released under the MIT License.