Scopes
All API key scopes (two retired), which are human-grant-only, which scope each endpoint needs, and the key and agent management API.
Every tvkey_... API key and scoped tvagent_... agent carries a list of scopes. A call without the scope it needs fails with 403 SCOPE_DENIED and names it in missingScope. Error codes and CLI exit codes are on Errors and exit codes. For the concepts, see API keys.
Scopes
| Scope | Group | Allows |
|---|---|---|
credentials:read | Credentials | Fetch credentials the principal has been granted |
mcp:use | Credentials | Use the MCP endpoints with granted credentials (/api/agents/mcp and /api/mcp/{service}/{server}). The MCP server endpoint never needs credentials:read |
tokens:list | Manage credentials | List credential names and metadata (no values) |
tokens:create | Manage credentials | Add credentials. Cannot read them back |
tokens:create-read | Manage credentials | Add credentials and get a read grant on each new one at creation time. Reading also needs credentials:read. Not retroactive. Implies tokens:create |
tokens:update | Manage credentials | Update metadata and rotate stored values on any credential. Also removes MCP servers (only a person can add one or change its URL or headers) and edits credential labels. Human-grant-only |
tokens:delete | Manage credentials | Delete any credential. Human-grant-only |
agents:read | Agents and access | List agents and their access |
agents:create | Agents and access | Create agents with a subset of this key's scopes |
agents:manage | Agents and access | Edit, suspend and resume any agent, end its sessions, label it. Human-grant-only |
agents:delete | Agents and access | Delete any agent, singly or in bulk. Human-grant-only |
grants:write | Agents and access | Give agents and keys access to credentials, only ones this key can itself read (so it also needs credentials:read). Human-grant-only |
proxies:read | Legacy | Retired. List old MCP connections. A credential's MCP servers use tokens:list and tokens:update instead |
proxies:write | Legacy | Retired. Suspend, resume or delete old MCP connections, and re-point one that is not converted. Human-grant-only |
policies:read | Policies | List policies, attachments and labels |
policies:write | Policies | Create, update, attach and delete policies. Human-grant-only |
keys:manage | Keys | Create, list, edit, suspend and resume API keys. Also labels keys. Human-grant-only |
keys:revoke | Keys | Revoke (delete) any API key. Human-grant-only |
Retired scopes. proxies:read and proxies:write were retired with the old MCP connections (details). A key or agent that already holds one keeps it, for deleting or suspending an old connection. Nobody can add one to a key or agent, a person included: 400 SCOPE_RETIRED, with retiredScopes listing them. The web app hides them unless the key or agent holds them. Creating an old MCP connection is 410 PROXY_CREATE_REMOVED whatever the scope.
Human-grant-only scopes can only be put on a key or agent by a signed-in human. A key or agent that tries to pass one on gets 403 SCOPE_NOT_DELEGABLE, even if it holds the scope. The check covers newly added scopes only. Narrowing a key that already has them is fine. Other scopes can be passed down as a subset of the holder's own.
Every scope covers the whole account, whoever holds it. Classic agents hold credentials:read and mcp:use implicitly, bounded by their grants. Humans hold every scope.
Every key and agent is independent: its effective scopes are its own, and its access depends only on its own status, expiry, grants and policies. Revoking or narrowing one never affects another, including ones it created. A creator cannot give a child scopes, grants or an expiry beyond its own, but that check happens only at creation.
Inspect what a principal has:
tvault whoami
curl https://api.tokenvault.uk/api/agents/whoami -H "Authorization: Bearer $TVAULT_KEY"Scope per endpoint
| Endpoint | Scope |
|---|---|
GET /api/agents/credentials | credentials:read |
POST /api/agents/mcp, /api/mcp/{service}/{server} | mcp:use |
GET /api/tokens/{service}/mcp-servers | tokens:list |
PUT /api/tokens/{service}/mcp-servers, POST .../mcp-servers/{name}/schema | tokens:update. Adding an MCP server, or changing a URL or headers, is human-only (403 HUMAN_ONLY); a key or agent can remove one. Fetching a tool list also needs credentials:read and a live value grant for a key or agent |
POST /api/tokens/sign-in | tokens:create |
POST /api/tokens/{service}/refresh | tokens:update |
GET, POST /api/proxy/convert | Human only |
GET /api/labels | policies:read |
PUT /api/labels/credential/{id} | tokens:update, plus policies:write to remove a label that has policies |
PUT /api/labels/agent/{id} | agents:manage (same removal rule) |
PUT /api/labels/api_key/{id} | keys:manage (same removal rule) |
POST, PATCH, DELETE /api/agents/{id}/grants..., POST .../revoke-all | grants:write |
POST, PATCH, DELETE /api/keys/{id}/grants..., POST .../revoke-all | grants:write |
POST /api/agents/connect | agents:create and grants:write (agents:read to reuse an existing agent) |
GET /api/grants, GET /api/tokens/{service}/grants | Human only |
/api/oauth-apps/... | Human only |
Grant and label details: Grants API, Labels API.
Key and agent management API
| Method and path | Purpose |
|---|---|
POST /api/keys | Create a key: {name, scopes, expiresAt}. Returns key once. Humans need a sign-in within 5 minutes (401 REAUTH_REQUIRED) |
GET /api/keys | List keys |
GET /api/keys/{id} | One key, with its grants |
PATCH /api/keys/{id} | {name?, status?, scopes?}. Affects only this key. A scopes edit needs an unlocked vault |
DELETE /api/keys/{id} | Revoke this key only (needs keys:revoke). Keys and agents it created keep working |
POST /api/keys/{id}/rotate | New key value. A key may rotate itself; rotating another principal's key is human-only. A lost race is 409 ROTATION_CONFLICT |
POST /api/keys/{id}/grants and friends | See the Grants API. Key grants are value-only |
POST /api/agents | Create an agent: add kind: "classic" | "scoped" and scopes |
POST /api/agents/{id}/rotate-key | New agent key. Same rule as key rotation |
DELETE /api/agents/{id} | Delete an agent. Needs agents:delete (bulk delete too) |
POST /api/vault/credential-ticket and the TOTP code endpoint are human-only. Keys and agents read credentials through GET /api/agents/credentials.
A locked vault returns 423 VAULT_LOCKED for every key. Revoking and other reduce-only actions stay allowed while locked for a signed-in human.
Create a key
curl -s -X POST https://api.tokenvault.uk/api/keys \
-H "Authorization: Bearer $FIREBASE_ID_TOKEN" -H "Content-Type: application/json" \
-d '{"name":"ci","scopes":["credentials:read"],"expiresAt":"2027-01-31T23:59:59Z"}'# The CLI equivalent. The secret prints once, on stdout.
KEY=$(tvault keys create --name ci --scopes credentials:read --expires 90d)
printf %s "$KEY" | tvault login --key-stdin --as ciReady 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.
tvault CLI
Complete command reference for the tvault CLI, covering install, contexts and login, every command with its flags and aliases, output conventions and exit codes.
Rate limits
Every rate limit Token Vault enforces, covering per-entity floors, the account-wide ceiling, per-IP limits, the penalty box and how to back off.