API

A tiny JSON API over the ciphertext store. All encryption happens in the client — the server never sees plaintext, keys, or passphrases. Base URL: https://onetimepass.app.

Authentication

Programmatic access requires an API key. Sign in and generate one under Account → API keys; it's shown once, so copy it then. Send it on every request:

Authorization: Bearer otp_sk_…

Create one with the CLI (--key or OTP_API_KEY), or with curl:

curl -H "Authorization: Bearer $OTP_API_KEY" \
     -H "content-type: application/json" \
     -d '{"ct":"…","iv":"…","kdf":"none","ttl":"1d"}' \
     https://onetimepass.app/api/secrets

A key identifies your account, so secrets created with it appear in My links and honour your notify options. Keys can create secrets and manage your own links — they can't reach the vault, account settings, admin, or mint more keys. Reveal and existence checks are public (recipients have no account) and never need a key. Requests with an invalid or missing key get 401.

POST /api/secrets

Create a secret. Requires an API key for API/CLI use (the website's own form is exempt). Rate-limited per IP. Body:

{
  "ct":        "base64url AES-256-GCM ciphertext (required)",
  "iv":        "base64url 96-bit IV (required)",
  "kdf":       "none | pbkdf2 (default none)",
  "salt":      "base64url PBKDF2 salt (pbkdf2 only)",
  "iters":     310000,          // PBKDF2 iterations (pbkdf2 only, 1000..5000000)
  "burn_hash": "base64url SHA256(SHA256(linkKey)) (optional, enables burn-proof)",
  "ttl":       "10m | 1h | 1d | 7d | 30d | 90d (required)",
  "views":     1                // opens allowed, 1..10 (default 1)
}

Returns 201 { "id", "expires_at", "views" }.

What each field does

All encryption happens on your side before you call this. The server stores the ciphertext and a few public parameters and can never derive the key — so these fields describe ciphertext and public metadata, never anything that could decrypt the secret.

ct — ciphertext (required)
Your secret, encrypted with AES-256-GCM, base64url-encoded (the GCM authentication tag is appended). The server stores it byte-for-byte and returns it unchanged at reveal; it never sees the plaintext. Max ~225 KB.
iv — initialization vector (required)
The 96-bit (12-byte) nonce for AES-GCM, base64url. Generate fresh random bytes for every secret — reusing an IV with the same key breaks GCM. Stored and returned at reveal so the recipient can decrypt.
kdf — key-derivation mode (default none)
How the AES key is formed.
  • none — link-only mode: the AES key is a random 256-bit “link key” you generate and put in the share URL’s #fragment. The fragment is never sent to any server, so the key stays with whoever holds the link.
  • pbkdf2 — passphrase mode: the AES key is derived from the link key combined with a passphrase (PBKDF2 → HKDF), so both the link and the passphrase are needed to open. Send salt and iters with this mode.
salt — PBKDF2 salt (pbkdf2 only)
Random base64url salt, unique per secret, used when stretching the passphrase. Public by design: it’s stored and returned at reveal so the recipient can re-derive the key from their passphrase. Max 64 chars.
iters — PBKDF2 iterations (pbkdf2 only)
How many PBKDF2 rounds to stretch the passphrase (1000–5000000; the web app and CLI use 310000). Higher is slower to brute-force but also slower to open. Returned at reveal so the recipient re-derives with the same cost.
burn_hash — burn-proof token (optional)

An anti-griefing control. Reveal is a one-shot, destructive action (it consumes the secret). Without this, anyone who learns the id could call /reveal and burn the secret even without the key — so a scanner hitting ids could destroy secrets they can’t even read.

Set burn_hash to base64url( SHA-256( SHA-256(linkKey) ) ). To then consume the secret, the reveal call must present burn_proof = base64url( SHA-256(linkKey) ); the server destroys the secret only if SHA-256(burn_proof) equals the stored burn_hash.

Only someone who actually holds the link key can compute a valid proof, so only a real recipient can burn the secret — yet the key itself never reaches the server (it only ever sees these hashes), so zero-knowledge is preserved. The web app and CLI always set this; it’s optional purely for backward compatibility.

ttl — lifetime (required)
How long before the secret auto-expires and is purged: 10m, 1h, 1d, 7d, 30d, or 90d. Expiry is enforced on read and swept hourly.
views — allowed opens (default 1)
How many times the secret may be revealed, 1–10. Each successful reveal decrements the counter atomically; at 0 the record is deleted. 1 is the classic read-once link.

GET /api/secrets/:id

Non-destructive existence check (used by the open page). Returns 200 { "exists": true, "kdf", "remaining" } or 404 { "exists": false }. Never consumes the secret.

POST /api/secrets/:id/reveal

Consume the secret: atomically returns the stored blob and decrements its remaining opens (deleting it at zero). Body (optional, for burn-proofed secrets): { "burn_proof": "base64url SHA256(linkKey)" }. Returns 200 { "ct", "iv", "kdf", "salt", "iters", "remaining" } or 404 when it is gone, expired, or the proof does not match.

GET /api/my/secrets

API key or session required. Lists the links your account created — metadata only (id, times, view count, status, open count), never the key. Also: POST /api/my/secrets/:id/revoke to kill a link, and GET /api/my/secrets/:id/opens for its access log.

GET /api/password

API key required (a Bearer key only — a logged-in session or a browser request is not accepted here). Generate a strong random password server-side with the same engine as the in-browser tool. Stateless — the password is returned and never stored or logged. Query parameters (all optional):

length   1..256   (default 20)
lower    1|0      include a–z        (default 1)
upper    1|0      include A–Z        (default 1)
digits   1|0      include 0–9        (default 1)
symbols  1|0      include symbols    (default 1)
words    1|0      fill with random words; digits/symbols
                  become the separators between them (default 0)

Returns 200 { "password", "length", "entropy_bits" }. Example:

curl -H "Authorization: Bearer $OTP_API_KEY" \
     "https://onetimepass.app/api/password?length=32&words=1"

For zero-trust use, prefer generating locally — the browser tool and the CLI never transmit the password. This endpoint exists for scripts and integrations that want one over the API.

Notes