Token VaultDocs
ReferenceWebhook Protocol

Error Codes

The error responses your webhook returns, how Token Vault maps them for callers, and its retry, timeout and circuit-breaker policy.

Return a JSON body with every error:

{ "error": "auth_failed", "message": "HMAC signature invalid" }

Webhook responses

HTTPerrorMeaningToken Vault retries?
400invalid_requestMalformed request or missing field. Also a bad store mode, or a malformed totpUrino
400not_totp/v1/totp-code: the token has no usable totpSecretno
401auth_failedHMAC signature invalidno
401ticket_invalidTicket signature failed, or the purpose is not accepted hereno
401ticket_expiredTicket exp is in the pastno
403setup_requiredWebhook not configured yet. Complete /v1/exchange firstno
403forbiddenThe reference webhook is sealed and the setup endpoint request lacks a valid x-tv-admin-secretno
404token_not_foundNothing stored for the serviceno
409already_existsStore ticket mode: create and the service exists (ticketConstraints)no
409stale_creationTicket cid does not match the stored meta.creationId (ticketConstraints)no
410code_expiredExchange code expired (5 minute TTL) or not foundno
410code_usedExchange code already usedno
403upstream_not_allowed/v1/proxy: your webhook's own rules refuse this upstream (a private address, or an origin not on the operator's allowlist)no
429rate_limitedYour webhook is rate limiting. Send Retry-After in secondsno
500internal_errorUnexpected error (encryption failure, storage I/O)yes, where the call retries (below)
500totp_failedSecret is not valid base32, or code generation failedno (browser call)
502provider_errorThe OAuth provider returned an error during refreshyes, where the call retries
502upstream_errorThe upstream service failed during /v1/proxyno
504provider_timeoutThe OAuth provider timed out during refreshyes, where the call retries
504upstream_timeoutThe upstream service timed out during /v1/proxyno

On /v1/proxy, return the upstream status, headers and body unchanged. Use upstream_error and upstream_timeout only when the webhook itself could not complete the call.

The OAuth callback does not use these responses. It always answers 302 with a result code. See OAuth callback.

How Token Vault reports them

Webhook conditionToken Vault tells the caller
Unreachable, timeout, 5xx after retries502 WEBHOOK_UNAVAILABLE
No webhook bound502 WEBHOOK_NOT_CONFIGURED
401 auth_failed from your webhook502 WEBHOOK_AUTH_FAILED
Your webhook answers with a redirect502 WEBHOOK_REDIRECT_BLOCKED (never followed)
/v1/proxy returns the MCP server's own 3xx (with X-Upstream-Status)502 UPSTREAM_REDIRECT_BLOCKED. It does not count against your webhook
403 upstream_not_allowed from /v1/proxyPassed to the caller unchanged
Circuit breaker open503 WEBHOOK_CIRCUIT_OPEN with Retry-After
429 from your webhook429 with the clamped Retry-After
409 stale_creation on a proxy call403 GRANT_REQUIRED
Refresh failed at the webhook424 REFRESH_FAILED_AT_WEBHOOK

See Errors for the full caller-facing list.

Retry and timeout policy

Token Vault to webhook
Timeout     10 s connect and read (/v1/storage read: 3 s; /v1/proxy: 30 s)
Retries     2 retries, 3 attempts in all (health, storage and refresh calls)
Backoff     1 s, then 3 s
Retry on    5xx and network timeouts only
No retry    4xx (400, 401, 403, 404, 409, 410, 429)
Single try  /v1/proxy, /v1/exchange and /v1/admin/migrate
  • A 429 is never retried. Token Vault clamps your Retry-After to 1 to 900 seconds and passes the backoff to the caller.
  • /v1/storage operations are idempotent, so the short read timeout and the retry are safe.
  • Token Vault never follows a redirect from your webhook at call time. Following it would replay a signed request to a host you did not bind.

Circuit breaker

After 5 consecutive failures (timeout, 5xx or 429) to the same webhook host, Token Vault opens a circuit for 30 seconds to 10 minutes, doubling on repeated opens. While it is open, Token Vault fails fast with 503 WEBHOOK_CIRCUIT_OPEN and does not dial your webhook. On /v1/proxy only connection-level failures (timeout, unreachable) count, because other statuses may be upstream responses passed through.

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