Skip to content
Ephemer.pw

Public API v1

Create secrets from your code

A simple REST API to create self-destructing links from your scripts, CI/CD pipelines or applications, with the same end-to-end encryption as the website.

  • Zero knowledge

    You encrypt, we store. The server never sees the secret or the key.

  • No API key

    No account, no token. Requests are rate limited per IP address.

  • OpenAPI 3.1

    Full specification and reference clients in Node.js, Python, C# and Java.

How it works

The API never receives the secret in clear. Your code encrypts it locally with a random key, sends only the encrypted result, then builds the link to share itself.

The key travels in the link fragment, after the #. Browsers never send the fragment to the server: only the recipient, opening the link, can decrypt.

link
https://ephemer.pw/s/{id}#{urlKey}

The recipient opens the link in a browser, exactly as for a secret created on the website. Nothing else to integrate on that side.

Quick start

The fastest way: download the reference client and hand it the secret. It encrypts, calls the API and prints the link.

Bash
# 1. Download the reference client (Node.js 20+, no dependency)
curl -fsSLO https://ephemer.pw/cli/ephemer.mjs

# 2. Create a link. The secret is read from stdin: never from your shell history
node ephemer.mjs --views 1 --expires 24h < secret.txt
# → https://ephemer.pw/s/K_xEr7XyYQ22dxO_#39dh_OBrXnZ1ovM-1TUrIikpu19lFxSR8O-LzQ35c0s

Options: --views (1 to 10, default 1), --expires (5m, 30m, 1h, 12h, 24h, 3d or 7d, default 24h), --passphrase and --api (another instance).

With a passphrase

The passphrase is read from the EPHEMER_PASSPHRASE environment variable, never from the arguments. It needs an Argon2id library, which depends on the language (see the table below). Send it to the recipient through another channel than the link.

bash
npm install hash-wasm                 # Argon2id for Node.js (see the table for other languages)
read -rs EPHEMER_PASSPHRASE && export EPHEMER_PASSPHRASE
node ephemer.mjs --passphrase --views 1 < secret.txt
Language · libraryInstallation
Node.jshash-wasmnpm install hash-wasm
Pythonargon2-cffipip install argon2-cffi
C# / .NETKonscious.Security.Cryptography.Argon2dotnet add package Konscious.Security.Cryptography.Argon2As a file-based app (dotnet run Ephemer.cs), the package is restored automatically.
Javaorg.bouncycastle:bcprov-jdk18onjava -cp bcprov-jdk18on.jar Ephemer.java --passphraseAdd the BouncyCastle jar to the classpath, or the Maven/Gradle dependency.

In your code

The reference clients can also be used as libraries: createSecret (JavaScript), create_secret (Python), EphemerClient.CreateSecretAsync (C#) and Ephemer.createSecret (Java). They return the full link, ready to send.

JavaScript
import { createSecret } from "./ephemer.mjs"

const { url, expiresAt, viewsLeft } = await createSecret(
  process.env.DB_PASSWORD,
  { views: 1, expiresIn: "1h" } // optional: passphrase, api
)

console.log(url) // send it to the recipient

Create a secret

POST/api/v1/secrets

Stores an already encrypted secret. JSON body, 201 Created response. Every binary value is encoded as base64url, without padding.

Encrypt before sending

Never put the secret itself in ciphertext: the API rejects any value too short to be real ciphertext, but cannot detect a long plaintext. Use a reference client or follow the protocol below.

Field · TypeDescription
idstring16 random characters from A–Z a–z 0–9 _ -, generated by you. It appears in the link.
ciphertextstringAES-256-GCM output: ciphertext followed by the 16-byte tag. At least 17 bytes (23 characters), and at most 64 KB of plaintext.
ivstring12 random bytes (16 encoded characters).
saltstring16 random bytes (22 encoded characters), used by HKDF and Argon2id.
authTokenstring | nullOnly with a passphrase: 32 bytes derived with HKDF (43 characters). Otherwise null. The server keeps only its SHA-256 hash.
viewsintegerNumber of views allowed, from 1 to 10.
expiresInstringLifetime: 5m, 30m, 1h, 12h, 24h, 3d or 7d.
Request
POST /api/v1/secrets HTTP/1.1
Host: ephemer.pw
Content-Type: application/json

{
  "id": "K_xEr7XyYQ22dxO_",
  "ciphertext": "1VaiERcaM481rjaxfO1yISQbNJPTZrSFFs7H19ohAX6aPBAc…",
  "iv": "EIM77F2o8nqkYAN3",
  "salt": "d95yiUjpxpeGS-1suuqERQ",
  "authToken": null,
  "views": 1,
  "expiresIn": "24h"
}
Response
HTTP/1.1 201 Created
Content-Type: application/json
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
X-RateLimit-Reset: 1764003600

{
  "id": "K_xEr7XyYQ22dxO_",
  "expiresAt": "2026-11-25T12:00:00.000Z",
  "viewsLeft": 1
}

The server cannot build the link: your code assembles it from id and the key, as /s/id#key.

Encryption protocol

To write your own client, in any language. The protocol only uses standard primitives: AES-256-GCM, HKDF-SHA-256 and Argon2id.

Protocol v1
id         = 16 random characters from  A–Z a–z 0–9 _ -
salt       = 16 random bytes
urlKey     = 32 random bytes        → goes in the link fragment, never sent
iv         = 12 random bytes

ikm        = urlKey                                    (no passphrase)
ikm        = Argon2id(passphrase, salt) ‖ urlKey       (with passphrase)
             Argon2id: t = 2, m = 19456 KiB, p = 1, 32-byte output

contentKey = HKDF-SHA-256(ikm, salt, info = "ephemer:v1:content", 32 bytes)
authToken  = HKDF-SHA-256(ikm, salt, info = "ephemer:v1:auth",    32 bytes)
             (only with a passphrase; otherwise authToken = null)

ciphertext = AES-256-GCM(key = contentKey, iv, UTF-8(secret),
                         additionalData = UTF-8(id))   ‖ 16-byte tag

link       = https://ephemer.pw/s/{id}#{base64url(urlKey)}

All binary values are encoded as base64url without padding (RFC 4648 §5).
  • The id is bound to the ciphertext as authenticated data: moved to another id, it does not decrypt. On 409 id_taken, generate a new id and encrypt again.
  • authToken and the content key come from the same source through separate HKDF branches: the token proves the passphrase to the server without revealing anything about the key.
  • When in doubt, the reference clients are authoritative: on every change, a conformance test checks that the website decrypts their secrets.

Secret status

GET/api/v1/secrets/{id}

Tells whether a secret still exists, how many views it has left and when it expires. This call spends no view. Expired, exhausted or unknown: the answer is always 404, indistinguishably.

bash
curl https://ephemer.pw/api/v1/secrets/K_xEr7XyYQ22dxO_
200 OK
{
  "salt": "d95yiUjpxpeGS-1suuqERQ",
  "viewsLeft": 1,
  "expiresAt": "2026-11-25T12:00:00.000Z",
  "hasPassphrase": false
}

Errors

An error returns a JSON object with a stable error field: base your code on that field, not on the HTTP status alone.

Code · HTTPMeaning
invalid_jsonHTTP 400The request body is not valid JSON.
invalid_payloadHTTP 400A field is missing or invalid, for instance a ciphertext too short to be encrypted (secret sent in clear). Details per field are in issues.
id_takenHTTP 409This id already exists (very unlikely). Generate a new id and encrypt again.
not_foundHTTP 404The secret expired, was opened the maximum number of times, or never existed.
rate_limitedHTTP 429Too many requests. Wait the number of seconds given by the Retry-After header.
400
HTTP/1.1 400 Bad Request

{
  "error": "invalid_payload",
  "issues": { "views": ["Too big: expected number to be <=10"] }
}

Limits

  • Creation: 10 requests per minute per IP address.
  • Status: 60 requests per minute per IP address.
  • Size: 64 KB of plaintext (UTF-8) per secret.
  • Views: 1 to 10 per link. The last one destroys the secret.
  • Lifetime: from 5 minutes to 7 days, cannot be extended.
  • Every response shows your quota with X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset.

Best practices

  • Never send the key (the part after the #) to the API or any other server, and never write it to a log.
  • Pass secrets through standard input or an environment variable, not as an argument: they would end up in your shell history.
  • For the most sensitive secrets, add a passphrase and send it through another channel than the link.
  • In a CI/CD pipeline, mask the generated link in the logs: anyone who reads it can spend a view.
  • Do not retry a failed creation in a loop: read the error field and honour Retry-After on a 429.

Resources