tly_… API key. It implements authorization-server metadata
(RFC 8414), dynamic client
registration (RFC 7591),
protected-resource metadata (RFC 9728),
and token revocation (RFC 7009).
Most users never touch these endpoints directly — their host (e.g. Hermes)
drives the flow. See MCP server → Authentication
for the user-facing setup. This page documents the protocol for anyone wiring a
new host or debugging.
Discovery
Scopes
| Scope | Grants |
|---|---|
wallet:read | Read agent identity, wallets, spending limits, and payment history. |
wallet:transfer | Send USDC via pay_direct / payments.create, within the on-chain caps. |
x402:pay | Pay x402-paywalled HTTP services. |
POST /v1/payments) requires wallet:transfer;
read endpoints work with any granted scope.
Flow
Register (once)
Public PKCE clients self-register. Redirect URIs must be
https or loopback
http (127.0.0.1 / localhost) per RFC 8252.
No client secret is issued — PKCE is the proof-of-possession.Authorize
Send the user to the authorization endpoint with a PKCE challenge. They sign in
to Tally and pick the workspace, mode, and agent to authorize.On approval Tally redirects to
redirect_uri?code=tly_oac_…&state=…. On denial
it returns ?error=access_denied.Exchange the code for tokens
/v1/*:/v1/me is the source for a host’s whoami — everything it returns is
non-secret (no token), so it’s safe to display or log. It answers “which
workspace / agent / wallet am I connected as, with what scopes, and when does
this connection expire?”.Refresh
Access tokens last one hour. Exchange the refresh token for a new pair before it
expires — refresh tokens rotate on every use, and reusing an already-rotated
refresh token revokes the whole session (token-theft defense).
Token reference
| Prefix | Token | Lifetime | Notes |
|---|---|---|---|
tly_oat_ | Access token | 1 hour | Bearer credential for /v1/*. |
tly_ort_ | Refresh token | 30 days | Single-use; rotates on refresh. |
tly_oac_ | Authorization code | 60 seconds | Single-use; PKCE-bound. |
tly_client_ | Client id | — | Public; identifies the client. |
Security notes
- PKCE is mandatory (
S256only;plainis rejected). There are no confidential clients and no client secrets. - Redirect URIs must be
httpsor loopbackhttp(127.0.0.1/localhost).httpsURIs are exact-matched against the registration; loopback URIs match on host + path and accept any port (RFC 8252 §7.3), so CLI clients can bind an ephemeral port at request time. - Authorization codes are single-use and expire in 60 seconds.
- Refresh-token rotation with reuse detection: a replayed refresh token revokes the whole grant family.
- Account-scoped: a token only ever sees the workspace + mode the user chose on the consent screen. Spending stays bounded by each agent’s on-chain permission caps regardless of scopes.
- The token endpoints are rate-limited and never cache responses.