api reference · v1

API reference

Every operation is a plain GET. The token rides in the path, the payload rides in the query — no POST body, no SDK, no auth headers. If a client can fetch a URL, it can save state. A REST mirror exists for clients that can do more.

Base URL: https://<host>/v1 — unauthenticated GET /v1 returns {"ok":true,"service":"universal-save","version":1}. OPTIONS works on every route; HEAD only on read routes (g · l · h · kv reads).

quickstart

Zero to saved in three fetches

01

Mint a token

Sign in, open tokens, pick a scope. The plaintext is shown exactly once — copy it into your agent's config.

02

Write with GET

GET /v1/s/{token}/{key}?v={value} — the request is the write. No body, no headers.

03

Read it back

GET /v1/g/{token}/{key} returns the value with its version and metadata.

agent · fetch-only session
›# mint a token: dashboard → tokens → create (shown once)
›GET /v1/s/us_rw_…/plan?v={"step":1,"status":"researching"}
{"ok":true,"v":1,"key":"plan","ns":"default"}
›GET /v1/g/us_rw_…/plan
{"ok":true,"key":"plan","ns":"default","value":{"step":1,"status":"researching"},"type_hint":"json","version":1,…}

reference

GET-write operations

endpointverbsscopewhat it does
/v1/s/{token}/{key}?v={value}GETPUTPOSTwriteSet key to value. Valid JSON (object, array, number, boolean, null) is stored as that JSON — anything else becomes a string.
/v1/s/{token}/{key}/{value}GETPUTPOSTwriteSame, with the value as the last path segment (URL-encode it). With ?v= present, multi-segment paths form one key: /v1/s/t/a/b?v=x writes key a/b.
/v1/a/{token}/{key}?v={value}GETPOSTwriteAppend the value as an element of the array at key. Creates the array; fails with invalid_value if the key holds a non-array.
/v1/g/{token}/{key}GETHEADreadRead a key — value plus type_hint, version, size, timestamps, ttl_expires_at, agent. HEAD returns the same headers with an empty body.
/v1/d/{token}/{key}GETDELETEwriteDelete a key. Returns whether a live row was removed.
/v1/l/{token}?prefix={p}&ns={n}GETHEADreadList keys in a namespace (newest first, max 500), optionally filtered by key prefix.
/v1/h/{token}/{key}GETHEADreadVersion history for a key — newest first, capped at the last 50 versions. Survives TTL expiry and deletion.
# set — --data-urlencode handles the JSON
curl -G "https://<host>/v1/s/us_rw_…/plan" --data-urlencode 'v={"step":1}'

# set via path segment
curl "https://<host>/v1/s/us_w_…/status/done"

# append to a list
curl -G "https://<host>/v1/a/us_w_…/log" --data-urlencode 'v=step 1 done'

# read / list / history / delete
curl "https://<host>/v1/g/us_r_…/plan"
curl "https://<host>/v1/l/us_r_…?prefix=agent/&ns=research"
curl "https://<host>/v1/h/us_r_…/plan"
curl "https://<host>/v1/d/us_rw_…/plan"

On non-GET methods the path ops also accept the value as the request body. Keys may contain / — multi-segment paths are one key when ?v= is present.

reference

REST mirror

Same internals for clients that can send headers and bodies: token goes in Authorization: Bearer, values go in the request body — up to 512KB.

endpointverbswhat it does
/v1/kv/{key}PUTPOSTSet key to the request body (JSON). ?v= is accepted too. Values up to 512KB.
/v1/kv/{key}/appendPOSTAppend the request body as an element of the array at key.
/v1/kv/{key}GETHEADRead a key — same shape as the path op.
/v1/kv/{key}DELETEDelete a key.
/v1/kv?prefix={p}&ns={n}GETHEADList keys in a namespace.
/v1/kv/{key}/historyGETHEADVersion history for a key.
# REST auth uses the Authorization header instead of the URL path
curl -X PUT "https://<host>/v1/kv/plan" \
  -H "Authorization: Bearer us_rw_…" \
  -d '{"step":1}'

curl "https://<host>/v1/kv/plan?ns=research" -H "Authorization: Bearer us_r_…"
curl "https://<host>/v1/kv?prefix=agent/&ns=research" -H "Authorization: Bearer us_r_…"
curl "https://<host>/v1/kv/plan/history" -H "Authorization: Bearer us_r_…"
curl -X POST "https://<host>/v1/kv/log/append" -H "Authorization: Bearer us_rw_…" -d 'step 2 done'
curl -X DELETE "https://<host>/v1/kv/plan" -H "Authorization: Bearer us_rw_…"

before you connect

Agent compatibility

Your agent needs a tool that can make HTTP requests. A chat’s web-page reader may enforce crawler restrictions or lack the ability to call an API. Sharing a documentation link alone does not add that capability.

If a chat reports that it cannot fetch the page, paste the instructions below. It still needs fetch, curl, or an HTTP integration to save anything. Treat an access error as a blocked test.

Python urllib clients on the workers.dev address must send a descriptive User-Agent, such as UniversalSave/1.0.

no account needed

Ephemeral mode

encrypted at rest

GET /v1/new mints a self-service us_e_… token — no sign-up, no human. An agent can bootstrap itself mid-task:

# mint — no account, one GET
curl "https://<host>/v1/new"
# → {"ok":true,"token":"us_e_…","data_ttl_seconds":900,"encrypted":true,…}

# use it exactly like a normal token
curl "https://<host>/v1/s/us_e_…/scratch?v=partial%20result"
curl "https://<host>/v1/g/us_e_…/scratch"
# every write auto-expires 15 min later; values are AES-256-GCM encrypted at rest

Encrypted at rest. The token is the encryption key — values are AES-256-GCM encrypted server-side with a key derived from it (only the token's hash is stored). Reading the database shows ciphertext, never plaintext.

Self-destructing. Every write is force-expired 900s later — &ttl= can shorten but never extend it. Rewriting a key renews the window.

Bounded. 100 writes + 500 reads per token per day, 30/min burst, 8KB values, 10 mints per IP per hour. The token itself dies after 24h.

Need it to last? Create an account — dashboard tokens have no forced expiry and your data is browsable in the UI.

reference

Query parameters

paramapplies tomeaning
vs · a · kvThe value. ≤12KB on GET writes (≤8KB for ephemeral us_e_… tokens). Valid JSON is stored typed; anything else becomes a string. JSON nested deeper than 1000 levels stores as a string.
nsall opsNamespace, ≤64 chars [A-Za-z0-9._~-] and no '..'. Defaults to the token's configured namespace, else "default".
keyg · d · h · s · aKey as a query param instead of path segments (path wins when both are present).
tokenpath opsToken as a query param instead of the {token} path segment — /v1/g?token=…&key=…
ttlwritesSeconds until the key expires. Expired keys behave as missing (except history, which still shows past versions) and are purged on read.
idwritesIdempotency key, ≤128 chars, scoped per op+ns+key. A repeat of the same write within 24h replays the stored response — no new version. Reusing an id on a different key is an independent write.
agentall opsTag the writer, ≤64 chars (validated on every request). Recorded on the save, its history, and the write log.
fmt=texts · a · g · d · l · htext/plain response: writes → ok v=N, gets → the raw value, list → key vN per line, history → vN {json} per line, errors → error code: message.
prefixl · kv listOnly return keys starting with the prefix.
part · of · uploadwritesChunked write: part N of M in upload ID (≤128 chars; part/of are integers ≥1, part≤of). Each part ≤12KB via path ops or ≤512KB via REST, assembled ≤512KB (≤8KB for ephemeral), ≤64 parts, parts live 10 min. Non-final parts return 202.

concepts

How the pieces fit

Tokens & scopes

Tokens look like us_r_…, us_w_…, us_rw_… — read, write, or read-write, with 24 random characters after the prefix. They're stored as SHA-256 hashes, shown once at creation, and revocable in the dashboard. A write token can't read; a read token can't write.

Namespaces

Keys are unique per (account, namespace, key). Pass &ns=research to isolate agents or projects — a token can also be minted with a default namespace. ≤64 chars, [A-Za-z0-9._~-].

Versioning & history

Every write bumps the version and appends to history. GET /v1/h/… returns the newest 50 versions with the agent that wrote each — enough to diff or restore a value by re-writing it.

TTL

&ttl=3600 expires the key in that many seconds. Expired keys behave as missing everywhere except /v1/h (history survives expiry) and are purged on read — good for scratch state and locks.

Idempotency & dedupe

&id=my-key stores the response for 24h and replays it on repeats (X-Idempotent-Replay: true) — safe retries for flaky agents. Separately, an identical write (same token, ns, key, op, value) inside 60s is deduped (X-Dedupe: true) — no new version.

Chunked writes

Values too big for one URL? Send parts: ?part=1&of=3&upload=u1 — any order, each ≤12KB. Non-final parts return 202 with the parts received; the last part assembles and commits the full value (≤512KB).

Size & key limits

12KB per value via GET (the Workers URL cap is ~16KB), 512KB via REST PUT or an assembled upload. Keys ≤256 chars, [A-Za-z0-9._~/-], no ... Agent tags ≤64 chars.

Rate limits

300 writes/day and 1,000 reads/day per token (UTC day), a shared 60-requests/minute burst bucket, a 1,200 writes/day ceiling across all of a user's tokens, and a 240/min per-IP ceiling that runs before auth. Over the limit → 429 with Retry-After. Every request counts, even failed ones. Dashboard accounts can hold ≤25 tokens.

URLs leak — treat them as credentials

A GET-write URL is a bearer credential plus a payload. It lands in server logs, CDN and proxy logs, browser history, monitoring tools — anywhere URLs get recorded. Never save secrets. No API keys, no credentials, no personal data you can't afford to see in a log file.

Rotate tokens on a schedule, and revoke immediately on suspicion — one click in the dashboard. Prefer us_w_… write-only tokens for agents and us_r_… read-only tokens for dashboards and readers, so a leaked link can't be used both ways. Every response carries Cache-Control: no-store, Referrer-Policy: no-referrer, and X-Robots-Tag: noindex — but nothing beats not putting sensitive data in a URL.

reference

Response shapes

write — s · a · d

{"ok":true,"v":1,"key":"plan","ns":"default"}

read — g

{
  "ok": true, "key": "plan", "ns": "default",
  "value": {"step": 1, "status": "researching"},
  "type_hint": "json", "version": 1, "size": 32,
  "created_at": 1758220800, "updated_at": 1758220800,
  "ttl_expires_at": null, "agent": "researcher"
}

list — l

{"ok":true,"ns":"default","keys":[{"key":"plan","version":1,"type_hint":"json","size":32,"updated_at":1758220800,"ttl_expires_at":null,"agent":"researcher"}]}

history — h

{"ok":true,"key":"plan","ns":"default","versions":[{"version":2,"value":{"step":2},"type_hint":"json","agent":"researcher","created_at":1758224400},{"version":1,"value":{"step":1},"type_hint":"json","agent":null,"created_at":1758220800}]}

delete — d

{"ok":true,"deleted":true,"key":"plan","ns":"default"}

chunk accepted — 202

{"ok":true,"accepted":true,"have":[1,2]}   // 202 — waiting on part 3

error — any op

{"ok":false,"error":"not_found","message":"key not found"}   // 404

?fmt=text

# ?fmt=text — text/plain bodies
write   ok v=1
get     researching            (strings unquoted; JSON stays compact JSON)
delete  ok
error   error not_found: key not found

Idempotent replays add X-Idempotent-Replay: true; deduped writes add X-Dedupe: true. Every response carries no-store, no-referrer, noindex, and open CORS headers.

reference

Error codes

statuscodewhen
400bad_requestMalformed percent-encoding or unparseable request (edge may reject with a bare 400 first).
400invalid_keyKey missing, over 256 chars, contains '..', or outside [A-Za-z0-9._~/-].
400invalid_namespaceThe ns parameter fails namespace validation.
400invalid_valueMissing value, bad ttl, bad chunk params, or append onto a non-array key.
401unauthorizedToken missing, invalid, or revoked.
403forbiddenToken scope lacks permission — e.g. a us_r_… token writing.
404not_foundUnknown operation or a key that doesn't exist.
413value_too_largeValue over 12KB via GET (8KB ephemeral), or over 512KB via REST / assembled chunks.
429rate_limitedDaily quota or burst limit hit. Retry-After (and the body's retry_after) says how many seconds to wait.
405method_not_allowedVerb not in the op's matrix — e.g. HEAD on a write op, or PATCH anywhere. The Allow header lists legal verbs.
500internalSomething broke server-side.