Tickets and Capabilities
The signed ticket format, its claims and constraints, and how your webhook advertises capabilities at /v1/exchange and /v1/health.
A ticket is a short-lived, signed permission slip. Token Vault signs it with the HMAC secret it shares with your webhook, after it has checked identity, access and policies. The caller presents it to your webhook, and your webhook verifies it on its own. Tickets carry no key material and no credential.
Format
{base64url(json_payload)}.{hex_hmac_signature}The signature is HMAC-SHA256(hmac_secret, payload_b64_string), hex encoded. It covers the base64url string, not the decoded JSON.
GET /v1/credential?ticket=eyJzdWIiOiJ1c2VyLTEi...<payload elided>.9f2c...<sig elided>&service=github HTTP/1.1
Host: webhook.example.comVerify a ticket
Split on .: the first part is the base64url payload, the second the hex signature.
Check HMAC-SHA256(hmac_secret, payload_b64_string) equals the signature, with a constant-time comparison.
Base64url-decode the payload (add back = padding) and parse the JSON.
Check exp is in the future.
Check pur is a purpose this endpoint accepts and svc matches the requested service.
Optional: remember nonce for at least the ticket's lifetime to refuse replays. There is no value to compare it against; it only records that you saw it.
Tickets live 60 seconds, so the worst a replay does is repeat one authorised operation inside that window.
Payload
{
"sub": "user-id",
"svc": "github",
"pur": "agent_credential",
"aid": "agent-id",
"iat": 1708300000,
"exp": 1708300060,
"nonce": "9f2c4e7a1b3d5f60718293a4b5c6d7e8"
}| Field | Type | Notes |
|---|---|---|
sub | string | Vault owner's user id. Audit metadata only, never an authorisation check |
svc | string | Service name |
pur | string | Purpose, see below |
aid | string, optional | Agent id. Absent for API-key callers |
pid | string, optional | Proxy requests only. For a legacy proxy, its id. For a credential's MCP server, an entity id such as service:server. Audit trail only, never checked |
iat, exp | int | Unix seconds. TTL is 60 s (10 min for the OAuth state ticket) |
nonce | string | 32 hex characters |
mode | create or overwrite, optional | Store tickets, ticketConstraints webhooks only |
cid | string, optional | Creation id, ticketConstraints webhooks only |
Purposes
pur | Used at | Issued when |
|---|---|---|
agent_credential | /v1/credential, /v1/totp-code | An agent or key fetches a value (the 307 redirect) |
user_reveal | /v1/credential, /v1/totp-code | The signed-in owner reveals a value |
store | /v1/store | The client writes a value |
proxy | /v1/proxy | An MCP tool call is forwarded |
totp_code | /v1/totp-code | The owner reveals a TOTP code (only if you advertise totp) |
oauth_connect | /v1/oauth/start, /v1/oauth/callback | The owner connects a provider with their own app (only if you advertise oauth-callback) |
/v1/totp-code accepts totp_code, agent_credential and user_reveal, and must refuse store and proxy. There is no browser_credential purpose.
Ticket constraints
Advertise ticketConstraints to receive two optional fields. A webhook without it never receives them.
| Field | On | Meaning |
|---|---|---|
mode: "create" | store ticket | Refuse with 409 already_exists if the service already exists. Token Vault sends it when the caller is claiming a new name, a human included |
mode: "overwrite" | store ticket | Replace the existing token |
mode absent | store ticket | Store as before |
any other mode | store ticket | 400 invalid_request |
cid | store ticket | Store it as meta.creationId, replacing any earlier value. A store ticket without cid stores no creationId |
cid | credential, totp_code, proxy ticket | Refuse with 409 stale_creation unless the stored meta.creationId equals cid. Check before decrypting or calling upstream. A stored token with no creationId also refuses |
Token Vault sends cid on read tickets only when the access comes from a create-read grant or from an MCP server bound from one. Manual and label-based access never carry it, so it keeps working across overwrites. On a proxy call, stale_creation reaches the caller as 403 GRANT_REQUIRED.
{ "error": "already_exists", "message": "A token already exists for this service" }{ "error": "stale_creation", "message": "Token was replaced since this ticket was issued" }Capabilities
Your webhook lists the capabilities it implements, as strings, in the capabilities array of the /v1/exchange response and the /v1/health response. Token Vault stores the list when it binds and refreshes it on each health check.
{
"capabilities": [
"store", "credential", "proxy", "refresh", "tv-refresh",
"storage", "totp", "ticketConstraints", "oauth-callback"
]
}tv-refresh is the legacy capability for tokens from Token Vault's old built-in OAuth apps. The reference webhook advertises it only when TV_REFRESH_ENABLED=true is set. See Token refresh.
/v1/exchange and /v1/health are always required and have no capability string.
| Capability | Endpoints | Requires | What Token Vault does when absent |
|---|---|---|---|
storage | POST /v1/storage | none | Cannot list credentials or write activity |
credential | GET|POST /v1/credential | storage | No value reads for agents or the owner |
store | POST /v1/store | storage | Cannot add or change a credential |
proxy | POST /v1/proxy | storage | Credential MCP servers do not work |
refresh | POST /v1/refresh-notify | storage | No webhook-side OAuth refresh |
totp | GET|POST /v1/totp-code | storage | TOTP reveal fails |
ticketConstraints | POST /v1/admin/migrate, ticket mode and cid | storage, store, credential | Never sends mode or cid |
oauth-callback | GET /v1/oauth/start, GET /v1/oauth/callback | storage, store | The app does not offer Connect with your own OAuth app |
tv-refresh (legacy) | POST /v1/refresh | storage | Nothing for tokens stored by ticket. Only legacy tokens use it |
A minimal webhook implements exchange, health, storage, credential and store. It cannot reveal TOTP codes.
Update banner
The web app compares your bound webhook with the capabilities of the latest reference release (store, credential, proxy, refresh, storage, totp, ticketConstraints, oauth-callback). If one is missing, the dashboard shows an update banner. See Update your webhook.
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.
Request Authentication
How Token Vault signs its requests to your webhook with HMAC-SHA256, how to verify them, and which endpoints use other authentication.
Webhook Endpoint Reference
Request and response schemas for every /v1 endpoint of the webhook protocol, with sequence diagrams for bind, store, credential fetch and proxy.