Webhook Protocol
The webhook protocol (spec 2.12.0) that your webhook implements, with every endpoint, capability and trust boundary on one page.
Your webhook is the data plane. It stores credentials, injects them into upstream calls and refreshes OAuth tokens. Token Vault is the control plane: it holds identities, access, policies and activity metadata, and it signs tickets. No credential value passes through Token Vault. Values move between the client (browser, CLI, agent) and your webhook, using a ticket that Token Vault signed. The one exception is the legacy tv-refresh capability, used only for tokens from Token Vault's old built-in OAuth apps and off by default in the reference webhook (see Token refresh).
The canonical machine-readable contract is /llm.txt. Feed it to an LLM with your language and framework to generate a conformant webhook. The reference implementation is examples/webhook in the public tvault repo.
Spec version
The current spec version is 2.12.0 (2026-11-11).
| Version | Added |
|---|---|
| 2.12.0 | Four rules that limit what Token Vault itself can make a webhook do. /v1/storage get on tokens MUST return metadata only. /v1/proxy MUST refuse a private upstream and MAY keep an operator-set origin allowlist (403 upstream_not_allowed). A ticket nonce SHOULD be recorded with an atomic insert in shared storage. The PKCE verifier MUST come from a key only the webhook holds. No new call; Token Vault works with a 2.11.0 webhook as before |
| 2.11.0 | The audit list cursor is opaque and SHOULD name one event (timestamp and key), so that events with the same timestamp are not skipped between pages. Token Vault sends nextCursor back unchanged as after. Nothing a 2.10.0 webhook must do |
| 2.10.0 | /v1/credential MUST NOT return refreshToken for an agent_credential ticket. A user_reveal ticket still gets every field |
| 2.9.0 | /v1/proxy MAY answer with Server-Timing: tv-up;dur=<ms>. The key of an audit event is now unique per event (UTC time to the millisecond plus six hex characters). Nothing a 2.8.0 webhook must do |
| 2.8.0 | Refresh failures are reported: refresh-notify refresh_failed carries error and reconnectRequired; token meta gets refreshError, refreshFailedAt, refreshReconnect. acknowledged now means "no OAuth client for this provider" and is not a refresh. Own-app tokens refresh on the webhook's own schedule and when fetched near expiry. Custom providers |
| 2.7.0 | oauth-callback capability: GET /v1/oauth/start, GET /v1/oauth/callback, the OAuth state ticket |
| 2.6.0 | ticketConstraints capability: store mode, cid, POST /v1/admin/migrate, totpUri is sensitive |
All endpoints are under /v1/. The version your webhook returns from /v1/health is its own implementation version (any semver), not the spec version.
Map of the protocol
Three kinds of caller reach your webhook, with three kinds of authentication:
| Caller | Endpoints | Auth |
|---|---|---|
| Token Vault backend | /v1/exchange, /v1/health, /v1/storage, /v1/proxy, /v1/refresh-notify, /v1/admin/migrate, legacy /v1/refresh | HMAC headers (exchange: one-time code; HEAD /v1/health: none) |
| Browser or agent | /v1/credential, /v1/store, /v1/totp-code | Ticket |
| Browser, from the provider | /v1/oauth/start, /v1/oauth/callback | State ticket plus a browser-bound cookie |
Capabilities
Your webhook advertises what it implements in the capabilities array of /v1/exchange and /v1/health. Token Vault only uses what you advertise. Details: Tickets and capabilities.
| Capability | One line |
|---|---|
storage | POST /v1/storage: metadata CRUD, audit events, vault settings |
credential | GET|POST /v1/credential: return a credential to the caller that holds a ticket |
store | POST /v1/store: accept a credential written by the browser or CLI |
proxy | POST /v1/proxy: inject the credential into an upstream call (credential MCP servers) |
refresh | POST /v1/refresh-notify: the webhook refreshes OAuth tokens itself |
totp | GET|POST /v1/totp-code: compute the current code from a stored secret |
ticketConstraints | Honour ticket mode and cid; serve POST /v1/admin/migrate |
oauth-callback | GET /v1/oauth/start and /v1/oauth/callback: connect a provider with your own OAuth app |
tv-refresh (legacy) | POST /v1/refresh for tokens minted with Token Vault's old OAuth clients. See Token refresh |
POST /v1/exchange and GET|HEAD|POST /v1/health are always required. GET /v1/register-url and GET /bind are optional helpers for operators.
The hot paths
Bind
Token Vault calls /v1/exchange once with a one-time code and receives the shared HMAC secret. See Endpoints.
Store a credential
The client sends the value straight to /v1/store. Token Vault only signs the ticket. See Endpoints.
Fetch a credential
Token Vault checks the key, access and policies, then answers 307 with a ticketed Location pointing at your webhook. The caller follows it. See Endpoints.
MCP tool call
Token Vault checks identity and policy, then forwards the call to /v1/proxy. Your webhook injects the credential and calls the upstream service. See Endpoints.
OAuth connect with your own app
The browser goes to your webhook, then to the provider, then back to your webhook. Token Vault never sees the code or the tokens. See OAuth callback.
Encryption
Encryption at rest is your choice. The spec says a webhook MAY encrypt and recommends it. The reference webhook encrypts with AES-256-GCM using keys it holds itself (on Workers, derived from its own seed), which Token Vault never receives.
Tenancy
One webhook serves exactly one Token Vault user. The HMAC secret from /v1/exchange is the identity of that account. The sub field in tickets is audit metadata, not an authorisation boundary. Several people each need their own webhook deployment.
Reference webhook secrets
| Secret | Purpose |
|---|---|
TV_WEBHOOK_SEED | Cloudflare Workers only. Root seed: the HMAC secret, encryption key and webhook id derive from it with HKDF. Required before a Worker can bind. The Docker and Node runtimes generate random keys into the /data volume instead, so back that volume up |
OAUTH_PROVIDERS_JSON | Optional. Provider client secrets for own-app OAuth and refresh |
TV_ADMIN_SECRET | Optional. Reopens the setup endpoints after the first bind. See Security |
Next
Authentication
HMAC signing of Token Vault requests and replay prevention.
Tickets and capabilities
Ticket format, claims, constraints and capability advertisement.
Endpoints
Request and response schemas for every /v1 endpoint.
OAuth callback
Connect a provider with your own OAuth app.
Error codes
Status codes, retry policy and how Token Vault maps them.
Security
URL validation, egress IP, bind-seal and the kill switch.
Health and tests
Verify Connection and the Webhook Tests in Settings.
Reference webhook
TypeScript, for Cloudflare Workers or Node in Docker (Cloud Run, Lambda, a VM).
Ready to try it?
Sign in with Google or email. Your credentials stay on your own webhook, and the quickstart gets Claude Code making its first MCP tool call in about 15 minutes.
Introspection & Gateway Gating
Validate tvsess_ tokens from your own MCP gateway or webhook with one HTTP call, including the resource (aud) audience check and schedule enforcement.
Request Authentication
How Token Vault signs its requests to your webhook with HMAC-SHA256, how to verify them, and which endpoints use other authentication.