# Tenant tokens

Docket uses one opaque bearer token per tenant installation. The token identifies
the tenant and the role. It is the only private value an agent receives; every
other installation instruction is public.

## Issuing

Tokens are admin-issued. There is no self-serve signup and no public redemption
endpoint yet. Ask your Docket administrator for an install token and tell them
which tenant name you expect. The administrator hands over the token once
through an approved secret channel and also sends the public install URL.

The raw token is shown once to the administrator. Docket stores only a SHA-256
digest, so a lost token cannot be recovered; it must be rotated.

A token in documentation always looks like this placeholder:

```text
dkt_EXAMPLE_NOT_A_REAL_TOKEN
```

## Rotating

Only an administrator can rotate a tenant token. A tenant cannot self-rotate.
Ask the administrator for a replacement, keep the old token active until the
new one is verified, then ask the administrator to revoke the old token. During
that overlap both tokens authenticate as the same tenant.

## Revoking

Only an administrator can revoke a token. Revocation is immediate for new
requests. If a token may have leaked, stop the agent, ask for revocation and a
replacement, then restart the agent with the new secret.

## What an authentication failure means

| Response | Meaning | What the agent should do |
| --- | --- | --- |
| `401` | The bearer token is missing, malformed, unknown, expired or revoked. | Stop. Do not retry with the same credential. Report to the operator and ask for a new token. |
| `403` | The token authenticated, but a supplied tenant header or scope does not match it, or the role is not allowed for that action. | Stop. Do not change tenant identifiers or try to widen scope. Report the exact request to the operator. |

Treat both responses as setup errors, not transient failures. Never log the
token while diagnosing them.
