VaultKit CLI (vkit)
Command-line interface for VaultKit β secure, policy-driven data access control plane
The VaultKit CLI (vkit) is the primary interface for interacting with the VaultKit control plane. It enables users to request governed data access, track approvals, manage datasources, and deploy policy bundlesβall while maintaining complete audit trails.
π Table of Contents
- What is VaultKit CLI?
- Installation
- Quick Start
- Authentication
- Core Workflows
- Command Reference
- Configuration
- Advanced Usage
- Driving vkit from a coding agent
- Troubleshooting
- Contributing
π― What is VaultKit CLI?
The VaultKit CLI provides command-line access to VaultKit for:
- Users - Data analysts, engineers, and administrators
- AI Agents - LLMs and autonomous systems requiring governed data access
- Tools & Services - CI/CD pipelines, data pipelines, and automated workflows
- Applications - Programmatic integration via scripting
| Capability | Description |
|---|---|
| Authentication | Login, session management, identity verification |
| Data Requests | Submit AQL queries with automatic policy evaluation |
| Approval Workflows | Approve or deny access requests requiring authorization |
| Grant Management | Fetch data using approved, time-limited grants |
| Datasource Admin | Register and manage database connections (admin only) |
| Schema Discovery | Scan datasources and detect schema drift |
| Policy Deployment | Build, validate, and deploy policy bundles |
Mental Model
VaultKit uses a request β policy β grant β fetch workflow:
ββββββββββββ ββββββββββββ βββββββββ βββββββββ βββββββββββββ
β Request β -> β Policy β -> β Grant β -> β Fetch β -> β Audit Log β
β (AQL) β β Eval β β (JWT) β β Data β β (Record) β
ββββββββββββ ββββββββββββ βββββββββ βββββββββ βββββββββββββ
Key Principles:
- Users request data, not queries
- Policies decide what happens (allow, mask, deny, require approval)
- Grants authorize execution with TTLs
- FUNL executes queries safely
- Everything is audited
π¦ Installation
Prerequisites
- Ruby 3.1 or higher
- VaultKit Control Plane running and accessible
Option 1: Install from RubyGems (Recommended)
gem install vaultkitcliVerify Installation
vkit --version
# => VaultKit CLI v0.1.0
vkit --helpβ‘ Quick Start
1. Set Environment Variables
export VKIT_API_URL=http://localhost:3000For production:
export VKIT_API_URL=https://vaultkit.company.com2. Authenticate
vkit login --endpoint http://localhost:3000 --email analyst@company.comYou'll receive a prompt for your password or be redirected to SSO.
3. Submit Your First Request
vkit request --aql '{
"source_table": "customers",
"columns": ["id", "email", "total_spend"],
"limit": 10
}'4. Fetch Results
If granted immediately:
vkit fetch --grant gr_abc123xyzIf approval required:
# Check status
vkit requests list --state pending
# After approval
vkit fetch --grant gr_abc123xyzπ Authentication
vkit login
Authenticate with the VaultKit control plane.
vkit login --endpoint http://localhost:3000 --email analyst@acme.comOptions:
-
--endpointβ VaultKit API endpoint (can also useVKIT_API_URL) -
--emailβ Email address for authentication
SSO Integration:
If your organization uses SSO, you'll be redirected to your identity provider:
vkit login --endpoint https://vaultkit.company.com --email you@company.com
# Output:
# Opening browser for SSO authentication...
# β Authentication successful
# Session expires: 2024-01-15 18:00:00 UTC
vkit login --setup (a coding agent setting VaultKit up)
A coding agent can set VaultKit up without your own login: it asks for a
setup session, you approve it in the console, and it gets a token that can
only do setup (connect datasources, scan schemas, deploy policy bundles) and
lasts 30 minutes. It works like gh auth login.
In a terminal it's one command. It prints a code and the console's approval link, opens the link in your browser, and waits:
vkit login --setup --endpoint http://localhost:3300
# π An admin approves this setup session in the VaultKit console:
# 1. Open http://localhost:5300/setup/approve
# 2. Check the code matches: BCDF-1234
# 3. Approve it (by 14:10, when the request expires)
# β³ Waiting for an admin to approve it...
# β
Setup session approved by you@acme.com for acme; it works until 14:32.Open the link signed in as an admin, check the code matches what the terminal
shows, and approve. Only approve a session you just started yourself: anyone
can start one and send you the link. The approval page shows the requester's
address and what made the request (vkit/<version> (<os>; ruby <version>)).
With --format json it's two commands, so the agent can show you the code
before it waits:
-
vkit login --setup --format jsonreturnsneeds_input(exit 3) withuser_code,verification_urlandverification_url_completeinresult, and the fix "Ask the person to open the URL, check the code matches, and approve". Running it again returns the same code until the request expires (10 minutes). -
vkit login --setup --wait --format jsonpolls until you approve (ok), deny (setup_session_denied), or the request expires (setup_session_expired). Add--timeout <seconds>to stop sooner; still waiting isneeds_inputagain, so rerun it.
--no-browser skips opening the link. The token is saved where vkit login
saves yours (it replaces your saved login, and says so), marked as a setup
session with its expiry; it's never printed. vkit whoami shows the expiry.
When a command needs more than setup, or the session ended, you get:
| Code | What happened |
|---|---|
setup_scope_forbidden |
A setup token can't do this (or can't change an organization that's already set up). An admin must: sign in with vkit login. |
setup_session_expired |
The 30 minutes are up. Run vkit login --setup again. |
setup_session_revoked |
It was revoked in the console or by vkit logout. |
setup_approver_not_admin |
The admin who approved it is no longer an admin. |
vkit logout ends a setup session on the control plane
(DELETE /api/setup_sessions/current) and then clears it here. If the control
plane can't be reached, it's still cleared here, and vkit says the token stays
valid until it expires (an admin can revoke it on the console's Agents page).
Rerunning setup is safe: a datasource that exists with the same settings, a
bundle that's already uploaded, and a scan that changes nothing come back as
already_existed, already_deployed or unchanged, not as errors. A
datasource id that exists with other settings is datasource_exists; a bundle
version already uploaded with other contents is bundle_version_exists.
vkit whoami
Display the currently authenticated user and session information.
vkit whoamiOutput:
π€ analyst@acme.com (role: analyst, org: acme)
JSON Format:
vkit whoami --format jsonOutput:
{
"email": "analyst@acme.com",
"role": "analyst",
"org": "acme"
}vkit doctor
Check that VaultKit is set up and working from here, and say how to fix what
isn't. Run it from your policy project so it can compare the active bundle with
your commits (or pass --dir <project>).
vkit doctor
vkit doctor --format jsonIt checks, in order:
| Check | Passes when |
|---|---|
cli_version |
Always; warns when RubyGems has a newer vkit. Offline, the newer-version check is left out. |
control_plane |
The control plane answers its health check at the configured URL. |
login |
You're signed in (or in a setup session); says when the session expires, and warns in its last 10 minutes. |
datasources |
At least one datasource exists, and VaultKit connected to each. Uses vkit scan <datasource> in diff_only mode: it reads the schema, never data, and changes nothing in the registry. Admins only. |
datasource_role |
Always a warning for now, "not verified": VaultKit can't yet check that a datasource connects as a dedicated read-only role (vaultkit#125). |
schema |
Each reachable datasource is in the registry, unchanged since its last applied scan, and every column has a classification. |
policy_bundle |
A bundle is active, and it's this repository's HEAD, or an earlier commit with the same policies, registry and .vkit/packs.yaml. Nothing is compiled or written, and uncommitted changes don't count (they're mentioned). |
approval_routing |
Every approval group has members. A group with none is info, not a warning (" has no members, so org admins approve its requests"); groups with members aren't flagged. Fails only if GET /approval_groups errors. |
agent_token |
VAULTKIT_BASE_URL, VAULTKIT_ORG and VAULTKIT_TOKEN are set, and the token is a working agent token for that organization. Fails if VKIT_TOKEN is an agent token, since every vkit command would then run as the agent. |
mcp_server |
Optional, when vaultkit-mcp is installed: it starts with those variables and lists vaultkit_discover, vaultkit_query and vaultkit_check_approval. |
A check that needs one that failed is skipped, with the reason. Tokens are never printed, nor any part of one.
A check whose endpoint or fields an older control plane doesn't have is never
passed: it's info, "Can't check : the control plane is too old to
report it.", with the fix "Upgrade the control plane." That applies to
approval_routing (no active_member_count and admin_fallback per group,
before vaultkit#127, or no GET /approval_groups), policy_bundle (no
GET /approval_groups or GET /setup, builds before 2026-10-27) and
agent_token (a whoami that doesn't say what the token is).
--format json returns result.checks, a list of { name, status, detail, fix }
(status is pass, warn, fail or info), and result.skipped. info is
neither a pass nor a failure. vkit doctor exits
0 only when no check failed; otherwise the envelope's status is error, with
code doctor_checks_failed, and the checks are still in result.
vkit logout
Clear stored credentials and end session.
vkit logoutWhere the login is saved
vkit login saves the endpoint and token in the macOS Keychain, or in the Secret
Service keyring (GNOME Keyring, KWallet) on Linux when secret-tool is installed.
Elsewhere, including Windows, or when saving to the keychain fails (for example, over
SSH with no unlocked keyring), it saves them to ~/.vkit/credentials.json, readable
only by you, and says so. Login tokens expire after an hour.
Credentials from the environment
vkit normally uses the login saved by vkit login, in your OS keychain or
~/.vkit/credentials.json. Scripts, CI jobs and demos can supply credentials for
a single command or shell instead, without replacing your saved login:
export VKIT_ENDPOINT=http://localhost:3300
export VKIT_TOKEN=<a VaultKit user token>
vkit request < query.json-
Both variables are needed. When both are set, they replace the saved login
for every command except
vkit loginandvkit logout, which always work on the saved login. -
One alone is an error.
vkitstops and names the missing variable, rather than mixing the environment with your saved login. - A notice goes to stderr once per command while the override is active. The token is never printed.
-
Unset both (
unset VKIT_ENDPOINT VKIT_TOKEN) to go back to your saved login.
To act as someone else for one command, override the token on that command only. For example, a reviewer approving a request from the same shell:
VKIT_TOKEN="$APPROVER_TOKEN" vkit approval:list
VKIT_TOKEN="$APPROVER_TOKEN" vkit approval:approve 42vkit login --endpoint still reads VKIT_ENDPOINT as its default endpoint when
VKIT_TOKEN isn't set.
TLS certificates
vkit checks the control plane's TLS certificate against your system's trusted
certificates on every HTTPS call, including vkit login. If your control plane
uses a self-signed or private-CA certificate, trust it by pointing
SSL_CERT_FILE at a PEM bundle that includes it:
export SSL_CERT_FILE=/path/to/ca-bundle.pemπ Core Workflows
Workflow 1: Immediate Access (Auto-Approved)
# 1. Submit request
vkit request --aql '{
"source_table": "public_reports",
"columns": ["report_id", "title", "published_date"],
"limit": 10
}'
# Output:
# β
ACCESS GRANTED
# Grant Ref: g_public_reports_3f9a
# Request ID: 8d1c0a2e-β¦ (look it up under Activity in the console)
# Expires: 2024-01-15 18:00:00 UTC
# Masked Fields: none
#
# To execute and retrieve the data, run:
# vkit fetch --grant g_public_reports_3f9a
# 2. Fetch data
vkit fetch --grant g_public_reports_3f9a --format tableWorkflow 2: Approval Required
# 1. Submit request
vkit request --aql '{
"source_table": "financial_transactions",
"columns": ["transaction_id", "amount", "customer_id"],
"filters": [{"field": "amount", "operator": "gt", "value": 10000}]
}'
# Output:
# β³ QUEUED for approval
# Request ID: 3b7e19c4-β¦ (look it up under Activity in the console)
# Approver roles: finance_manager
# Reason: Financial data requires manager approval
#
# Once it's approved, run the same request again to get the data.
# 2. Check status
vkit requests list --state pending
# 3. After approval, run the same request again; it returns the rowsWorkflow 3: Denied Access
vkit request --aql '{
"source_table": "payment_cards",
"columns": ["card_number", "cvv"],
"limit": 10
}'
# Output:
# β DENIED
# Reason: Direct payment card data access forbidden
# Request ID: 7f29e0aa-β¦ (look it up under Activity in the console)π Command Reference
Authentication Commands
vkit login
Authenticate with VaultKit.
vkit login --endpoint <URL> --email <EMAIL>Options:
-
--endpoint, -eβ VaultKit API endpoint (default:$VKIT_API_URL) -
--emailβ User email address -
--passwordβ Password (prompted if not provided)
Examples:
# Interactive login
vkit login --endpoint http://localhost:3000 --email analyst@company.com
# Non-interactive (CI/CD)
vkit login --endpoint https://vaultkit.company.com --email bot@company.com --password $BOT_PASSWORDvkit whoami
Display current user information.
vkit whoami [--format json|table]Examples:
vkit whoami
vkit whoami --format jsonvkit logout
End session and clear credentials.
vkit logoutData Request Commands
vkit request
Submit a governed data request using AQL.
vkit request --aql <AQL_JSON> [OPTIONS]Options:
-
--aqlβ AQL JSON payload (inline or via STDIN) -
--envβ Environment (default:production) -
--requester_regionβ Your geographic region (e.g.,US,EU) -
--dataset_regionβ Dataset's geographic region -
--requester_clearanceβ Clearance level:low,high,admin -
--formatβ Output format:json,table(default:table)
Inline AQL:
vkit request \
--aql '{"source_table":"customers","columns":["email","total_spend"],"limit":100}' \
--requester_region EU \
--dataset_region EU \
--requester_clearance highAQL via STDIN:
cat query.json | vkit request
# Or
echo '{"source_table":"orders","columns":["order_id","total"]}' | vkit requestAQL from File:
vkit request --aql "$(cat queries/customer_analysis.json)"Possible Outcomes:
| Outcome | Description | Next Step |
|---|---|---|
| β Granted | Immediate access | vkit fetch --grant <GRANT_ID> |
| β³ Queued | Requires approval | Wait for approval, check with vkit requests list
|
| β Denied | Policy disallows | Review policy restrictions |
vkit requests list
View your request history.
vkit requests list [--state STATE] [--format FORMAT]Options:
-
--stateβ Filter by state:all,pending,approved,denied(default:all) -
--formatβ Output format:json,table(default:table) -
--limitβ Number of results (default: 50)
Examples:
# All requests
vkit requests list
# Only pending requests
vkit requests list --state pending
# Approved requests in JSON
vkit requests list --state approved --format json
# Last 100 requests
vkit requests list --limit 100vkit requests show
Show details for a specific request.
vkit requests show <REQUEST_ID>Example:
vkit requests show req_20240115_xyz789Approval Commands
vkit approval:list
List approval requests you are authorized to act on.
vkit approval:list [--state STATE] [--format FORMAT]Options:
-
--stateβ Filter by state:all,pending,approved,denied(default:pending) -
--formatβ Output format:json,table(default:table)
Examples:
# Pending approvals
vkit approval:list
# All approvals you've handled
vkit approval:list --state all
# JSON output for scripting
vkit approval:list --format jsonvkit approval:approve
Approve a pending request.
vkit approval:approve <REQUEST_ID> [--ttl SECONDS] [--notes "..."]Options:
-
--ttlβ Grant lifetime in seconds. Defaults to the policy's TTL, which is also the maximum: a longer value is capped. -
--notesβ Approval notes (optional)
When a request needs several approver roles, each role signs off separately. Until the last one has, approve prints the roles still waiting instead of a grant.
Examples:
# Basic approval
vkit approval:approve 42
# With a shorter TTL and notes
vkit approval:approve 42 \
--ttl 1800 \
--notes "Approved for Q4 analysis. Limited to aggregate data only."vkit approval:deny
Deny a pending request.
vkit approval:deny <REQUEST_ID> --reason "..."Options:
-
--reasonβ Required explanation for denial
Examples:
vkit approval:deny 42 --reason "Insufficient business justification"
vkit approval:deny 42 --reason "Request violates data minimization policy"Data Fetch Commands
vkit fetch
Fetch data using a previously issued grant.
vkit fetch --grant <GRANT_REF> [--format FORMAT]Options:
-
--grant, -gβ Grant reference or ID (required) -
--formatβ Output format:json,table,csv(default:table) -
--output, -oβ Write to file instead of STDOUT
Examples:
# Fetch and display as table
vkit fetch --grant gr_abc123xyz
# Fetch as JSON
vkit fetch --grant gr_abc123xyz --format json
# Fetch and save to CSV
vkit fetch --grant gr_abc123xyz --format csv --output results.csv
# Pipe to jq for processing
vkit fetch --grant gr_abc123xyz --format json | jq '.result.rows[] | select(.revenue > 1000)'Datasource Management (Admin Only)
vkit datasource add
Register a new datasource.
vkit datasource add --id <ID> --engine <ENGINE> [OPTIONS]Options:
-
--idβ Unique datasource identifier (required) -
--engineβ Database engine:postgres,mysql,snowflake,bigquery(required) -
--usernameβ Database username -
--password-promptβ Type the password into the terminal (read from/dev/tty, echo off) -
--password-env VAR_NAMEβ Read the password from an environment variable -
--passwordβ Deprecated: the password ends up in shell history. Still works, with a warning -
--configβ JSON configuration (host, port, database, etc.)
Adding an --id that already exists changes nothing and succeeds (already_existed: true under
--format json). The control plane can't change a stored credential, so a password given then is not used.
-
--credential-backendβ Secret backend:vaultkit,vault,aws-secrets
Examples:
PostgreSQL (Built-in credential storage):
vkit datasource add \
--id production_pg \
--engine postgres \
--username vaultkit_ro \
--password-prompt \
--config '{
"host": "db.production.internal",
"port": 5432,
"database": "analytics",
"ssl_mode": "require",
"connect_timeout": 10
}'MySQL:
vkit datasource add \
--id production_mysql \
--engine mysql \
--username app_reader \
--password-env MYSQL_PASSWORD \
--config '{
"host": "mysql.production.internal",
"port": 3306,
"database": "ecommerce",
"ssl_mode": "REQUIRED"
}'vkit datasource list
List all registered datasources.
vkit datasource list [--format FORMAT]Examples:
vkit datasource list
vkit datasource list --format jsonvkit datasource get
Get details for a specific datasource.
vkit datasource get <DATASOURCE_ID>Example:
vkit datasource get production_pgvkit datasource test
Test connectivity to a datasource.
vkit datasource test <DATASOURCE_ID>Example:
vkit datasource test production_pg
# Output:
# Testing connection to production_pg...
# β Connection successful
# Engine: PostgreSQL 15.3
# Latency: 45msvkit datasource remove
Remove a datasource (admin only).
vkit datasource remove <DATASOURCE_ID> [--force]Options:
-
--forceβ Skip confirmation prompt
Example:
vkit datasource remove old_staging_db --forceSchema Discovery Commands
vkit scan
Scan a datasource and detect schema drift.
vkit scan <DATASOURCE_ID> [--mode MODE]Options:
-
--modeβ Scan mode:diff,apply(default:diff) -
--formatβ Output format:json,table(default:table)
Modes:
| Mode | Description |
|---|---|
diff |
Show changes without applying (safe, read-only) |
apply |
Update baseline registry with discovered schema |
Examples:
Discover Changes:
vkit scan production_pg
# Output:
# Scanning datasource: production_pg
#
# Schema Drift Detected:
#
# + Dataset: customers
# + Field: phone_number (varchar) [PII] β οΈ NEW - requires policy
# ~ Field: email (text β varchar) [PII] β Already masked
#
# + Dataset: user_sessions
# + Field: ip_address (inet) [PII] β οΈ NEW - requires policy
# + Field: user_agent (text) [INTERNAL] β οΈ NEW - requires policy
#
# Summary: 2 new datasets, 3 new fields, 1 modified fieldClassifier Suggestions:
A rescan keeps the labels people reviewed (from a deployed bundle or a manual edit). When the classifier disagrees with one of them, the scan lists it as a suggestion under its dataset, marked ?. Suggestions are not changes: they don't count toward the changed total, and applying the scan leaves them alone.
vkit scan production_pg
# Output:
# settings β
# ? key_value low/internal β high/credential (suggested)
#
# No changes detected
#
# ? = classifier suggestion, not applied. To accept one, edit
# datasets/registry.yaml and redeploy the bundle.To accept a suggestion, change the field's sensitivity and tags in datasets/registry.yaml, then build and deploy the bundle. Control planes that predate suggestions don't send them, and the output is unchanged.
Unreviewed Columns:
Columns the classifier couldn't place keep the unknown sensitivity until someone reviews them. The starter pack (2.1.0 and later) masks them for agents, so the scan lists them under their dataset, marked !, and counts them:
vkit scan production_pg
# Output:
# customers β
# ! unreviewed: notes, meta
#
# No changes detected
#
# β οΈ 2 columns are unreviewed and masked until you review them
# (for agents, under the starter pack). To review, set each one's sensitivity
# in datasets/registry.yaml, then run: vkit policy bundle && vkit policy deployOlder control planes don't send unreviewed columns, and the output is unchanged.
Apply Changes:
vkit scan production_pg --mode apply
# Output:
# β Baseline registry updated
# Next steps:
# 1. Review new fields: customers.phone_number, user_sessions.ip_address
# 2. Update policies in Git: config/policies/
# 3. Build new bundle: vkit policy bundle
# 4. Deploy bundle: vkit policy deployScan All Datasources:
for ds in $(vkit datasource list --format json | jq -r '.result.datasources[].name'); do
echo "Scanning $ds..."
vkit scan $ds
donePolicy Management Commands
vkit init
Creates a policy project: config/policies/, datasets/ and .vkit/, with the starter pack (or the packs in --with). If the folder isn't inside a git repository, it runs git init and says so; --no-git skips that. It never commits.
The generated .gitignore ignores dist/ and everything in .vkit/ except .vkit/packs.yaml, the record of installed packs. Commit packs.yaml: vkit policy bundle checks the packs against it, and a clone without it can't.
vkit init --dir policies --with starter,ai_safety
cd policies && git add -A && git commit -m "Add VaultKit policies"vkit policy bundle
Compiles the policies and registry into a deployable bundle, after checking every policy can match and every installed pack is complete.
vkit policy bundle [--policies_dir config/policies] [--registry_dir datasets] \
[--out dist/policy_bundle.json] [--org ORG] [--version LABEL] [--allow-dirty]Options:
-
--policies_dirβ Policies directory (default:config/policies) -
--registry_dirβ Registry directory (default:datasets) -
--outβ Output bundle file (default:dist/policy_bundle.json) -
--orgβ Must match the organization you're signed in to -
--versionβ Name the bundle, such asv1.2. By default the bundle is named by its git commit. Either way,source.commit_shais the commit from git, and is left out outside a git repository. -
--allow-dirtyβ Bundle uncommitted changes anyway. It prints a warning, and the bundle recordssource.dirty: true.
Versions come from git. A bundle's version is the commit its policies are in, so a deployed bundle can be traced to exactly those files. So vkit policy bundle refuses, writing nothing, when:
| Code | When | Fix |
|---|---|---|
bundle_not_committed |
Anything under the policies or registry directory, or .vkit/packs.yaml, differs from the last commit: modified, staged, new, deleted, or ignored by .gitignore
|
git add -A -- config/policies datasets .vkit/packs.yaml && git commit, or --allow-dirty
|
bundle_not_versioned |
There's no git repository (or no commit yet) and no --version
|
git init, add and commit, or pass --version
|
β These files aren't committed, so the bundle's version wouldn't match its policies:
config/policies/30_payments_require_approval.yaml
Code: bundle_not_committed
Fix:
git add -A -- config/policies datasets .vkit/packs.yaml
git commit -m "Update VaultKit policies"
or bundle anyway, recorded as dirty: vkit policy bundle --allow-dirty
Projects created by older versions of vkit init ignore all of .vkit/, so .vkit/packs.yaml shows as ignored. Add it with git add -f .vkit/packs.yaml, and in .gitignore replace .vkit/ with .vkit/* and !.vkit/packs.yaml.
Example:
git add -A && git commit -m "Mask emails for analysts"
vkit policy bundle && vkit policy deployvkit policy validate
Validate a policy bundle without deploying.
vkit policy validate --bundle <BUNDLE_FILE>Example:
vkit policy validate --bundle dist/policy_bundle.json
# Output:
# Validating policy bundle...
# β Schema validation passed
# β Policy syntax valid
# β No circular dependencies
# β All datasources referenced
# Bundle is valid and ready to deployvkit policy deploy
Deploy a policy bundle to the control plane.
vkit policy deploy --bundle <BUNDLE_FILE> [OPTIONS]Options:
-
--bundleβ Path to bundle file (required) -
--orgβ Organization identifier (optional, defaults to logged-in user's org) -
--activateβ Immediately activate bundle -
--formatβhuman(default) orjson. Both include a warning for each approval group nobody is in, whose requests org admins approve until someone is added. -
--dry-runβ Validate deployment without activating
Examples:
# Deploy and activate (using logged-in user's org)
vkit policy deploy \
--bundle dist/policy_bundle.json \
--activate
# Deploy with explicit org
vkit policy deploy \
--bundle dist/policy_bundle.json \
--org acme \
--activate
# Dry run (test deployment)
vkit policy deploy \
--bundle dist/policy_bundle.json \
--dry-runvkit policy list
List active policy bundles.
vkit policy listvkit policy show
Show details of a specific policy.
vkit policy show <POLICY_ID>Agent Token Commands (Admin Only)
Agents (an MCP server, a scheduled job, a coding assistant) authenticate with
an agent token instead of a login. An agent is every token with the same
--name; the console's Agents page groups them that way.
vkit agents tokens create
vkit agents tokens create --name NAME [OPTIONS]Options:
-
--nameβ The agent's name (e.g.incident-bot); tokens with the same name are one agent -
--labelβ What this token is for, shown next to it in the console (e.g."PagerDuty runner") -
--forβ Email of the person the agent acts for. Their Activity shows the agent's requests, so a member can follow what an agent does on their behalf. Must be an active member of your organization. Without it the agent acts for no one, and only admins see its requests. -
--expires-inβ Lifetime:1h,24h,30d(default: no expiry) -
--role,--clearance,--region,--tenantβ What policies see for this token
The token is printed once; store it straight away. The console never shows it.
vkit agents tokens create --name incident-bot --label "PagerDuty runner" \
--for sam@acme.test --expires-in 30d--for names who the agent acts for. It's separate from who created the
token (you), which the console shows as "Created by".
vkit agents tokens list
vkit agents tokens list [--agent NAME] [--format table|json]vkit agents tokens revoke
vkit agents tokens revoke --token PREFIX_OR_ID --reason "Leaked in CI logs"--reason is required and recorded in the audit log. The token stops working
at once: its live grants are revoked, and a request already in flight with it
gets no rows.
--for needs a control plane with the console's Agents page; an older one
ignores it, and the token acts for no one. That control plane also refuses a
revoke without a reason, so older CLI versions can't revoke against it.
Audit Log
There's no vkit audit command. Every request, decision and revoke is in the
audit log; read it in the console:
-
Activity lists every request: who asked, what was decided and why, and
what ran. Filter by decision, agent, person, dataset or time, and open one
by the request ID that
vkit requestprints. - Export CSV on the Activity page downloads the filtered view.
- A refused request, for example one made with a revoked agent token, prints its code and request ID too:
# API 401: Agent token vkit_agent_f5f5d9 was revoked at 2026-11-04T19:55:11Z: Leaked in CI logs
# Code: token_revoked
# Request ID: 7973fcba-β¦ (look it up under Activity in the console)π¬ Advanced Usage
Scripting with vkit
Batch Request Processing:
#!/bin/bash
# process_requests.sh
REQUESTS=(
'{"source_table":"customers","columns":["id","email"],"limit":100}'
'{"source_table":"orders","columns":["order_id","total"],"limit":100}'
'{"source_table":"products","columns":["product_id","name"],"limit":100}'
)
for aql in "${REQUESTS[@]}"; do
echo "Processing: $aql"
vkit request --aql "$aql" --format json | jq -r '.result.grant_ref // empty' >> grants.txt
done
echo "Generated grants:"
cat grants.txtAutomated Approvals (for testing):
#!/bin/bash
# auto_approve_pending.sh
PENDING=$(vkit approval:list --state pending --format json)
echo "$PENDING" | jq -r '.result.approvals[].id' | while read -r request_id; do
echo "Approving request: $request_id"
vkit approval:approve "$request_id" --ttl 3600 --notes "Auto-approved for testing"
doneIntegration with CI/CD
GitHub Actions Example:
name: Deploy VaultKit Policies
on:
push:
branches: [main]
paths:
- 'config/policies/**'
- 'config/registry.yaml'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install vkit CLI
run: gem install vaultkitcli
- name: Authenticate
run: |
vkit login \
--endpoint ${{ secrets.VKIT_API_URL }} \
--email ${{ secrets.VKIT_BOT_EMAIL }} \
--password ${{ secrets.VKIT_BOT_PASSWORD }}
- name: Build Policy Bundle
run: |
vkit policy bundle \
--policies_dir config/policies \
--registry_dir config \
--out policy_bundle.json \
--org ${{ secrets.ORG_ID }}
- name: Validate Bundle
run: vkit policy validate --bundle policy_bundle.json
- name: Deploy Bundle
run: |
vkit policy deploy \
--bundle policy_bundle.json \
--org ${{ secrets.ORG_ID }} \
--activateUsing jq for Advanced Filtering
Extract specific fields:
vkit requests list --format json | jq '.result.requests[] | select(.state == "approved") | {id, dataset, requester}'Count requests by state:
vkit requests list --format json | jq '.result.requests | group_by(.state) | map({state: .[0].state, count: length})'Find high-value transactions:
vkit fetch --grant gr_abc123 --format json | jq '.result.rows[] | select(.amount > 10000)'π Troubleshooting
Common Issues
Authentication Failed
Problem:
Error: Authentication failed (401 Unauthorized)
Solutions:
# 1. Check endpoint
echo $VKIT_API_URL
# 2. Re-authenticate
vkit logout
vkit login --endpoint http://localhost:3000 --email you@company.com
# 3. Verify credentials
vkit whoamiConnection Refused
Problem:
Error: Connection refused - connect(2) for "localhost" port 3000
Solutions:
# 1. Check if control plane is running
curl http://localhost:3000/health
# 2. Verify Docker containers
cd infra
docker compose ps
# 3. Start services
docker compose upGrant Expired
Problem:
API 403: Grant expired
Solutions:
# 1. Request new grant
vkit request --aql '{"source_table":"customers",...}'
# 2. Request longer TTL (if approval required)
vkit request --aql '{...}' --ttl 7200Policy Denial
Problem:
β Request denied
Reason: Cross-region PII access forbidden
Policy: gdpr_protection
Solutions:
- Review policy restrictions
- Request approval if available
- Modify query to exclude restricted fields
- Contact admin to update policies
Debug Mode
Enable verbose logging:
# Set debug environment variable
export VKIT_DEBUG=true
# Run command
vkit request --aql '{...}'
# Output includes:
# - HTTP request/response details
# - Policy evaluation trace
# - Timing informationHealth Check
Verify CLI and control plane connectivity:
# Check CLI version
vkit --version
# Check control plane health
curl $VKIT_API_URL/health
# Test authentication
vkit whoamiπ€ Contributing
We welcome contributions to the VaultKit CLI!
Development Setup
# Clone repository
git clone https://github.com/yourorg/vaultkit-cli.git
cd vaultkit-cli
# Install dependencies
bundle install
# Run tests
bundle exec rspec
# Run CLI locally
bundle exec bin/vkit --helpRunning Tests
# Unit tests
bundle exec rspec spec/unit
# Integration tests (requires running control plane)
bundle exec rspec spec/integration
# All tests
bundle exec rspecCode Style
# Run RuboCop
bundle exec rubocop
# Auto-fix issues
bundle exec rubocop -aπ Additional Resources
- Main Repository: github.com/vaultkit-inc/vaultkitcli
- Documentation: docs.vaultkit.io
- AQL Specification: docs.vaultkit.io/aql
- Policy Reference: docs.vaultkit.io/policies
- API Documentation: docs.vaultkit.io/api
π License
VaultKit CLI is licensed under the Apache License 2.0. See LICENSE for details.
Built with β€οΈ by the VaultKit team