Token VaultDocs
ReferenceWebhook Protocol

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.

A ticketed credential fetch (the 307 Location target)
GET /v1/credential?ticket=eyJzdWIiOiJ1c2VyLTEi...<payload elided>.9f2c...<sig elided>&service=github HTTP/1.1
Host: webhook.example.com

Verify 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"
}
FieldTypeNotes
substringVault owner's user id. Audit metadata only, never an authorisation check
svcstringService name
purstringPurpose, see below
aidstring, optionalAgent id. Absent for API-key callers
pidstring, optionalProxy 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, expintUnix seconds. TTL is 60 s (10 min for the OAuth state ticket)
noncestring32 hex characters
modecreate or overwrite, optionalStore tickets, ticketConstraints webhooks only
cidstring, optionalCreation id, ticketConstraints webhooks only

Purposes

purUsed atIssued when
agent_credential/v1/credential, /v1/totp-codeAn agent or key fetches a value (the 307 redirect)
user_reveal/v1/credential, /v1/totp-codeThe signed-in owner reveals a value
store/v1/storeThe client writes a value
proxy/v1/proxyAn MCP tool call is forwarded
totp_code/v1/totp-codeThe owner reveals a TOTP code (only if you advertise totp)
oauth_connect/v1/oauth/start, /v1/oauth/callbackThe 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.

FieldOnMeaning
mode: "create"store ticketRefuse 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 ticketReplace the existing token
mode absentstore ticketStore as before
any other modestore ticket400 invalid_request
cidstore ticketStore it as meta.creationId, replacing any earlier value. A store ticket without cid stores no creationId
cidcredential, totp_code, proxy ticketRefuse 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.

409 from /v1/store (mode create)
{ "error": "already_exists", "message": "A token already exists for this service" }
409 from /v1/credential, /v1/totp-code, /v1/proxy
{ "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.

Reference webhook
{
  "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.

CapabilityEndpointsRequiresWhat Token Vault does when absent
storagePOST /v1/storagenoneCannot list credentials or write activity
credentialGET|POST /v1/credentialstorageNo value reads for agents or the owner
storePOST /v1/storestorageCannot add or change a credential
proxyPOST /v1/proxystorageCredential MCP servers do not work
refreshPOST /v1/refresh-notifystorageNo webhook-side OAuth refresh
totpGET|POST /v1/totp-codestorageTOTP reveal fails
ticketConstraintsPOST /v1/admin/migrate, ticket mode and cidstorage, store, credentialNever sends mode or cid
oauth-callbackGET /v1/oauth/start, GET /v1/oauth/callbackstorage, storeThe app does not offer Connect with your own OAuth app
tv-refresh (legacy)POST /v1/refreshstorageNothing 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.

On this page