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
| HTTP | error | Meaning | Token Vault retries? |
|---|---|---|---|
| 400 | invalid_request | Malformed request or missing field. Also a bad store mode, or a malformed totpUri | no |
| 400 | not_totp | /v1/totp-code: the token has no usable totpSecret | no |
| 401 | auth_failed | HMAC signature invalid | no |
| 401 | ticket_invalid | Ticket signature failed, or the purpose is not accepted here | no |
| 401 | ticket_expired | Ticket exp is in the past | no |
| 403 | setup_required | Webhook not configured yet. Complete /v1/exchange first | no |
| 403 | forbidden | The reference webhook is sealed and the setup endpoint request lacks a valid x-tv-admin-secret | no |
| 404 | token_not_found | Nothing stored for the service | no |
| 409 | already_exists | Store ticket mode: create and the service exists (ticketConstraints) | no |
| 409 | stale_creation | Ticket cid does not match the stored meta.creationId (ticketConstraints) | no |
| 410 | code_expired | Exchange code expired (5 minute TTL) or not found | no |
| 410 | code_used | Exchange code already used | no |
| 403 | upstream_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 |
| 429 | rate_limited | Your webhook is rate limiting. Send Retry-After in seconds | no |
| 500 | internal_error | Unexpected error (encryption failure, storage I/O) | yes, where the call retries (below) |
| 500 | totp_failed | Secret is not valid base32, or code generation failed | no (browser call) |
| 502 | provider_error | The OAuth provider returned an error during refresh | yes, where the call retries |
| 502 | upstream_error | The upstream service failed during /v1/proxy | no |
| 504 | provider_timeout | The OAuth provider timed out during refresh | yes, where the call retries |
| 504 | upstream_timeout | The upstream service timed out during /v1/proxy | no |
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 condition | Token Vault tells the caller |
|---|---|
| Unreachable, timeout, 5xx after retries | 502 WEBHOOK_UNAVAILABLE |
| No webhook bound | 502 WEBHOOK_NOT_CONFIGURED |
401 auth_failed from your webhook | 502 WEBHOOK_AUTH_FAILED |
| Your webhook answers with a redirect | 502 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/proxy | Passed to the caller unchanged |
| Circuit breaker open | 503 WEBHOOK_CIRCUIT_OPEN with Retry-After |
429 from your webhook | 429 with the clamped Retry-After |
409 stale_creation on a proxy call | 403 GRANT_REQUIRED |
| Refresh failed at the webhook | 424 REFRESH_FAILED_AT_WEBHOOK |
See Errors for the full caller-facing list.
Retry and timeout policy
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
429is never retried. Token Vault clamps yourRetry-Afterto 1 to 900 seconds and passes the backoff to the caller. /v1/storageoperations 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.
OAuth Callback (Own OAuth App)
The oauth-callback capability, GET /v1/oauth/start and GET /v1/oauth/callback, with the state ticket, derived PKCE, the browser-binding cookie and the result codes.
Webhook Security
URL validation, the tokenvault.uk egress IP for allowlists, bind-seal, OAuth secret rules, the kill switch and a hardening checklist for your webhook.