API
Encrypt, decrypt and host messages from scripts with a few JSON endpoints. The base URL is https://timelock.dev. There is no
authentication, and any website can call it (CORS allows all origins).
The API sees your message. These endpoints encrypt and decrypt on our server, so your message passes through it in memory. We never log or store it, but you have to trust us on that. For anything sensitive, use the website, which encrypts in your browser, or encrypt offline. All three make the same kind of file, so you can mix them.
POST/api/encrypt
Encrypts a message so it can be decrypted only at or after a drand quicknet round. Give exactly one of duration, unlockAt or round.
curl -s https://timelock.dev/api/encrypt \
-H 'Content-Type: application/json' \
-d '{"plaintext": "hello, future", "duration": "5m"}'
Request body
| Field | Type | Description |
|---|---|---|
plaintext | string, required | The message. Up to 64 KiB after decoding. |
encoding | "utf8" | "base64" | How plaintext is encoded. Default "utf8". Use base64 for binary data. |
duration | number | string | Seconds from now (300) or a duration string: "90s", "15m", "2h30m", "3 days 6 hours". Units: s, m, h, d, w, y (365 days). |
unlockAt | number | string | Unix seconds, or ISO 8601 with a time zone: "2030-01-01T00:00:00Z", "2030-01-01T09:00:00+09:00". Must be in the future. |
round | integer | An exact quicknet round. Past rounds are allowed, and the result can be decrypted right away. |
includeInstructions | boolean | Default false. Adds the plain line Unlock at https://timelock.dev above the encrypted block. See notes. |
includeUnlockTime | boolean | Default false. Adds a plain line with the unlock time above the encrypted block. |
timeZone | string | IANA zone for that line, like "America/New_York". Default "UTC". The UTC time is always included too. |
Times round up to the next round. There is one every 3 seconds, so unlockAt in the response can be up to 3 seconds later than you asked for. The maximum is 100 years ahead.
Response 200
{
"ciphertext": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHRsb2Nr…\n-----END AGE ENCRYPTED FILE-----\n",
"round": 33275913,
"unlockAt": "2026-10-22T01:05:03.000Z",
"unlockAtUnix": 1792631103,
"chainHash": "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971",
"network": "quicknet"
}
More examples
# add plain notes above the block (see "Notes above the block")
curl -s https://timelock.dev/api/encrypt \
-d '{"plaintext": "I called it.", "duration": "30d", "includeInstructions": true, "includeUnlockTime": true, "timeZone": "America/New_York"}'
# unlock at a specific moment
curl -s https://timelock.dev/api/encrypt \
-d '{"plaintext": "Happy new year!", "unlockAt": "2030-01-01T00:00:00Z"}'
# binary data, ciphertext saved to a file (needs jq)
curl -s https://timelock.dev/api/encrypt \
-d "{\"plaintext\": \"$(base64 -w0 photo.jpg)\", \"encoding\": \"base64\", \"duration\": \"30d\"}" \
| jq -r .ciphertext > photo.jpg.age
Notes above the block
With includeInstructions and includeUnlockTime, ciphertext starts with plain lines, then a blank line, then the block:
Unlock at https://timelock.dev
Unlocks: Wed, Oct 21, 2026 9:05 PM EDT (2026-10-22 01:05:03 UTC)
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHRsb2Nr…
-----END AGE ENCRYPTED FILE-----
The notes are not encrypted or signed, and anyone can change them. The unlock time that counts is the round inside the block. This site and
both decrypt endpoints ignore the notes. Other tools need just the BEGIN…END block. We tested dee, Go
tle and age, Rust tlock_age and tlock-js: all of them reject any text before or after
the block. To strip the notes:
sed -n '/^-----BEGIN AGE/,/^-----END AGE/p' message.txt | dee crypt --decrypt
POST/api/decrypt
Decrypts a message after its round is published. It accepts armored quicknet files made by this site, the API, dee, tlock or tlock-js.
curl -s https://timelock.dev/api/decrypt \
-H 'Content-Type: application/json' \
-d "$(jq -Rs '{ciphertext: .}' message.age)"
Request body
| Field | Type | Description |
|---|---|---|
ciphertext | string, required | Armored age text, -----BEGIN AGE ENCRYPTED FILE----- … -----END AGE ENCRYPTED FILE-----. Text before or after the block, like notes, is ignored. Exactly one block is allowed. |
encoding | "base64" | Optional. Return base64 even when the message is valid UTF-8 text. |
Response 200
{
"plaintext": "hello, future",
"encoding": "utf8",
"round": 33275913,
"unlockAt": "2026-10-22T01:05:03.000Z",
"unlockAtUnix": 1792631103
}
If the message isn't valid UTF-8 text, it comes back as base64 with "encoding": "base64".
Too early: 425
{
"error": {
"code": "too_early",
"message": "Too early: this message unlocks at drand round 33275913 (2026-10-22T01:05:03.000Z).",
"round": 33275913,
"unlockAt": "2026-10-22T01:05:03.000Z",
"unlockAtUnix": 1792631103
}
}
POST/api/messages
Hosts an encrypted block and returns a share link. The page at that link shows a countdown, then decrypts in the reader's browser. Send
the ciphertext from /api/encrypt or any tlock tool. We store the encrypted block only: notes around it are
dropped, and this endpoint never sees your message. The block must still be locked.
The id is derived from the encrypted block, so the same block always has the same link. Sending a block that is already
hosted stores nothing new: you get its existing link back with status 200 instead of 201.
curl -s https://timelock.dev/api/messages \
-H 'Content-Type: application/json' \
-d '{"ciphertext": "-----BEGIN AGE ENCRYPTED FILE-----\n…\n-----END AGE ENCRYPTED FILE-----\n"}'
{
"id": "5d41c7a09e3b8f2610c4a7de93b05f18",
"url": "https://timelock.dev/m/5d41c7a09e3b8f2610c4a7de93b05f18",
"round": 33275913,
"unlockAt": "2026-10-22T01:05:03.000Z",
"unlockAtUnix": 1792631103,
"createdAt": "2026-10-22T01:00:01.204Z",
"sha256": "9f2b…",
"openedAt": null
}
There is no endpoint that lists or searches messages, and the id can't be guessed without the encrypted block, so keep the url.
Hosted messages can't be edited or deleted through the API. sha256 is the hash of the stored block.
The id is the first 32 hex digits of SHA-256("timelock.dev message id v1\n" + block), where block is the
armored block in its standard form: the BEGIN line, base64 in 64-character lines, the END line, each ending in \n. That
is how the block is stored, so notes and extra whitespace in what you send don't change the id. It is not part of the
block's plain sha256. Messages hosted before ids were derived keep their UUID ids and links.
GET/api/messages/:id
Returns the same fields plus the stored ciphertext. A derived id also finds a message that was hosted under a UUID; the response carries the message's own id and url. It works before and after the unlock time. openedAt is the first time the page reported a decryption, or null.
curl -s https://timelock.dev/api/messages/5d41c7a09e3b8f2610c4a7de93b05f18
GET/api/events
The anonymous event log, newest first: one row per encryption or decryption. Rows contain no messages, encrypted text, message ids or IP addresses.
Recent activity shows the encryptions (type=encrypt).
curl -s 'https://timelock.dev/api/events?limit=2'
| Query | Description |
|---|---|
limit | 1 to 100, default 20. |
before | Return events with a lower id than this. To get the next page, pass the previous nextBefore. |
type | encrypt or decrypt, to return only that kind. Both by default. |
{
"events": [
{
"id": 42,
"type": "decrypt",
"source": "api",
"createdAt": "2026-10-22T01:06:10.512Z",
"round": 33275913,
"unlockAt": "2026-10-22T01:05:03.000Z"
},
{
"id": 41,
"type": "encrypt",
"source": "web",
"createdAt": "2026-10-22T01:00:01.204Z",
"round": 33275913,
"unlockAt": "2026-10-22T01:05:03.000Z"
}
],
"nextBefore": 41
}
source is "web" or "api". The website reports its own events after your browser finishes, so we can't verify them. The server records API events itself. nextBefore is null on the last page. Responses may be cached for 5 seconds. POST /api/events is only for the website and accepts same-origin requests only.
GET/api/stats
Counts for the last 30 days, as shown on the homepage. A decryption is counted each time a browser or API call decrypts a message, so one message can be counted many times. averageLockSeconds is the average time between encrypting and the unlock time, over encryptions in that window. It is null when there are none.
curl -s https://timelock.dev/api/stats
{
"days": 30,
"encrypted": 55,
"decrypted": 30,
"averageLockSeconds": 11520
}
Original endpoints
The endpoints from the original Rust worker still work, so old scripts keep running. You send raw bytes and get raw bytes back, with no JSON. Uploads can be up to 5 MiB.
POST/encrypt/:round
Send the message as raw bytes. You get back the armored age file (Content-Type: application/octet-stream). To find the round for a time, use /api/encrypt or dee.
curl -s -X POST --data-binary @original.png https://timelock.dev/encrypt/33275913 > encrypted.age
POST/decrypt
Send an armored or binary age file. Notes around an armored block are ignored. You get back the message as raw bytes.
curl -s -X POST --data-binary @encrypted.age https://timelock.dev/decrypt > decrypted.png
Errors on these endpoints are plain text, with the HTTP status codes listed below. For example, you get 425 when it's too early.
Errors
JSON endpoints return {"error": {"code": "…", "message": "…"}}, plus extra fields where noted.
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_json | Body isn't a JSON object. |
| 400 | invalid_request | A field is missing or invalid; `message` says which. |
| 403 | forbidden | Cross-origin call to an endpoint reserved for the website. |
| 404 | not_found | No hosted message with this id. |
| 405 | method_not_allowed | Wrong HTTP method. |
| 413 | payload_too_large | Body or plaintext over the limit; includes `limitBytes`. |
| 422 | invalid_ciphertext | Not a tlock age ciphertext, or it's corrupted. |
| 422 | unsupported_chain | Ciphertext was made for a drand chain other than quicknet. |
| 425 | too_early | Unlock round not reached yet; includes `round`, `unlockAt`, `unlockAtUnix`. |
| 429 | rate_limited | Too many share links created. Wait a minute, or until the next UTC day. |
| 500 | internal_error | Unexpected server error. |
| 502 | drand_unavailable | No drand relay answered. Retry with backoff. |
| 503 | feed_unavailable | The activity database isn't set up. |
Limits
- JSON API: messages up to 64 KiB after decoding, and request bodies up to 192 KiB.
- Original endpoints: up to 5 MiB per request. For bigger files, encrypt offline with
dee, which has no size limit. - Hosted messages: encrypted blocks up to 32 KiB, 10 new links per minute per IP address, and 1,000 per day across everyone.
- Unlock time: up to 100 years ahead, at 3-second granularity.
- Network: drand quicknet only, chain hash
52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971. - Cloudflare may slow down abusive traffic. If you get
502, wait and retry.