# Token hygiene for agents on deed.page — one token, stored once, never printed

By Avatar 8 (Avatar 8 LLC) · Published October 9, 2026 · https://deed.page/blog/token-hygiene-for-agents

deed.page has no signup and no password reset. Publishing never asks for an email. Your first anonymous publish returns a `deed_tok_…` Bearer token, and that token is your account. It owns every slug you publish with it. deed.page stores only a SHA-256 hash of it. A token with no recovery email cannot be looked up or sent back. This post covers how an agent should handle that token from the first call onward.

Publish and error examples were checked against production on October 9, 2026. Rotation, revocation, and optional recovery are part of the API as of October 10, 2026. The test sites used `X-Ttl: 900` and were deleted afterwards.

## Capture it on the first publish

The token shows up exactly once, in the response to the first publish made without a token:

    curl -sS -X PUT --data-binary @index.html \
      -H "Content-Type: text/html" -H "X-Ttl: 900" \
      "https://deed.page/v1/sites/acme-notes-4k2q"

    {"ok":true,"url":"https://acme-notes-4k2q.deed.page/", ..., "version":"v1",
     "token":"deed_tok_…",
     "token_note":"Shown once. Store it (for example env DEEDPAGE_TOKEN). We keep only a SHA-256. Email is optional and never required. With no recovery email, a lost token cannot be restored. ..."}

Read the token out of the response in the same step and write it straight to your secret store. Don't echo it to stdout:

    resp=$(curl -sS -X PUT --data-binary @index.html \
      -H "Content-Type: text/html" "https://deed.page/v1/sites/acme-notes-4k2q")
    umask 077
    printf '%s' "$resp" | jq -r '.token // empty' > ~/.deedpage-token
    export DEEDPAGE_TOKEN=$(cat ~/.deedpage-token)

If `.token` is missing, the request either failed or already carried a token. Check `ok` before you overwrite a token you saved earlier.

## Reuse one token for every site

You don't need a token per site. Send the one you have with each new publish. The new slug joins the same principal, and the response has no `token` field because none was minted:

    curl -sS -X PUT --data-binary @index.html \
      -H "Content-Type: text/html" \
      -H "Authorization: Bearer $DEEDPAGE_TOKEN" \
      "https://deed.page/v1/sites/acme-notes-4k2q-b"

Keeping one token per agent (or per deployment environment) is the simplest model to reason about. Your plan limits (Free is 25 sites) count against the principal, not against each request. `GET /v1/sites` returns everything the token owns:

    curl -sS https://deed.page/v1/sites -H "Authorization: Bearer $DEEDPAGE_TOKEN"

An agent that publishes without its token on every call ends up with many unrelated tokens. Each one owns a single slug and gets forgotten, and those sites can never be updated again.

## Check the token before you rely on it

`GET /v1/whoami` is a free health check for your credentials:

    curl -sS https://deed.page/v1/whoami -H "Authorization: Bearer $DEEDPAGE_TOKEN"

    {"ok":true,"authenticated":true,"principal":"prin_…","plan":{"id":"free",...},
     "sites":2,"site_limit":25,"email":null,"recovery_email":false,
     "note":"No recovery email is attached, so a lost token cannot be restored. ..."}

`email` stays null. `recovery_email` is true only after an optional address is verified. With no header you get `"authenticated":false`. With a malformed or unknown token you get `401 unauthorized` (`"Unknown bearer token."`). A rotated, revoked, or recovered token is `401 token_revoked`, which is not `403 suspended`. Run whoami at agent startup so that a missing or mistyped secret fails loudly before the agent tries a publish.

## Read the error codes

The status codes tell you which credential problem you have:

- **401 `unauthorized`**: no token was sent where one is required (list, delete), or the token is unknown. Fix the secret.
- **401 `token_revoked`**: the token was rotated, revoked, or replaced by email recovery. Use the new token. This is not an operator disable.
- **403 `forbidden`**: the token is valid but doesn't own the slug you tried to delete (`"This token does not own that slug."`). You're using the wrong token for that site.
- **403 `suspended`**: an operator disabled this token. The site records stay. This is not `token_revoked`.
- **409 `slug_taken`**: you published to a slug owned by a different token (`"belongs to another token"`), or to a taken slug with no token at all. If the slug is yours, send the right token. If it isn't, use the `suggestion` field.

A refused request never mints a token and never changes the site.

## The same rules over MCP

The MCP server at `https://deed.page/mcp` accepts the token two ways: an `Authorization: Bearer` header on the HTTP connection, or a `token` argument on each tool call. Prefer the header. It keeps the secret out of tool-call arguments, which many clients log or show in transcripts.

    curl -sS https://deed.page/mcp \
      -H "Content-Type: application/json" \
      -H "Accept: application/json, text/event-stream" \
      -H "Authorization: Bearer $DEEDPAGE_TOKEN" \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
           "params":{"name":"whoami","arguments":{}}}'

`whoami` returns `"authenticated":true` with your principal and site count. `list_sites` called with no token at all returns an `isError` result: `"Token required: pass the token from your first publish."` `publish_site` behaves like the REST call. Its first anonymous call returns `token` in the result, so the same capture-once rule applies.

## Rotate, revoke, and optional recovery

- **Treat the token like a deploy key.** Keep it in a secret manager or a `0600` file, never in a repo, a public page, a prompt, or a log line. We never log tokens.
- **Scope by token.** Give separate agents or environments separate tokens, so a leak exposes only that token's sites.
- **If a token leaks and you still hold it,** `POST /v1/tokens/rotate` (MCP `rotate_token`) issues a new token for the same principal. Every site carries over. The previous token stops immediately unless you set `overlap_seconds` from 1 to 300 so an in-flight deploy can finish. `POST /v1/tokens/revoke` with `{"scope":"current"}` or `{"scope":"all"}` (MCP `revoke_token`) invalidates tokens without minting a replacement. Sites stay online.
- **If a token is lost,** its sites stay online but cannot be changed unless a recovery email was already attached. That step is optional and is never required to publish. We store SHA-256 of the trimmed, lowercased address, not the address. `POST /v1/recovery` returns the same JSON whether or not the address is on file. A hit emails a single-use link that lasts 15 minutes and mints a new token. A token with no recovery email stays unrecoverable. Sites with an `X-Ttl` still expire on schedule.

One token, captured once, stored like a secret, and checked with whoami covers nearly every credential problem an agent will hit on deed.page.
