CLI Reference

Complete reference for kz commands, HTTP API, and environment variables

kz server start

Start the PDP server (HTTP or MCP mode).

kz server start --bundle <path> [--listen <addr>] [--mcp] [--proxy]
FlagDescriptionDefault
-b, --bundle <PATH>Path to the bundle YAML fileRequired
-l, --listen <ADDR>Listen address0.0.0.0:8080
--mcpRun as MCP server over stdio instead of HTTPfalse
--proxyEnable the credential-swapping proxyfalse

kz server check

Validate a bundle file without starting a server.

kz server check --bundle <path>
FlagDescriptionDefault
-b, --bundle <PATH>Path to the bundle YAML fileRequired

Validates:

  • YAML syntax and schema
  • CEL rule compilation
  • All resource resolvers reference existing backends

kz run

Run a command with secrets resolved and injected.

kz run [OPTIONS] -- <COMMAND>...
FlagDescriptionDefault
--only <KEYS>Resolve only the listed secret keysAll secrets
--clean-envStart with a clean environment (only injected secrets)false
--keep-env <KEYS>When using --clean-env, also keep these host env varsNone
--blindMask secrets with tokens; run MITM proxy to swap at the network boundaryfalse
--no-force-proxyIn blind mode, don't force-set proxy env varsfalse

kz init

Create a starter .keyzero.toml in the current directory.

kz init

kz add

Interactively add a secret mapping to .keyzero.toml.

kz add

kz put

Write secret values to a provider.

kz put --missing
FlagDescription
--missingOnly prompt for secrets that don't have a value yet

kz export

Print export KEY='VALUE' lines for shell eval.

kz export

kz status

Show resolution status for each secret in the config.

kz status

kz validate

Check the config file for errors.

kz validate

kz hook

Print a shell hook for auto-loading secrets when entering a project directory.

kz hook --shell <zsh|bash|fish>

HTTP API

GET /healthz

Health check endpoint. No authentication required.

Response (200):

{
  "status": "ok",
  "bundle_loaded": true,
  "bundle_version": "1"
}

POST /v1/resolve

Resolve secrets for a resource through the full pipeline.

Headers:

HeaderValue
AuthorizationBearer <jwt>
Content-Typeapplication/json

Request body (single):

{
  "ref": "secret/data/prod/pg/conn"
}

Request body (batch):

{
  "refs": ["secret/data/prod/pg/conn", "secret/data/ai/key"],
  "context": {
    "action": "startup"
  }
}

Success response -- direct mode (200):

{
  "results": {
    "secret/data/prod/pg/conn": {
      "allowed": true,
      "policy": "allow-prod",
      "mode": "direct",
      "value": "postgres://..."
    }
  }
}

Success response -- short_lived mode (200):

{
  "results": {
    "secret/data/ai/key": {
      "allowed": true,
      "policy": "allow-ai",
      "mode": "short_lived",
      "token": "eyJ...",
      "proxy": "https://...",
      "ttl": 300
    }
  }
}

Denied response (200):

{
  "results": {
    "secret/data/prod/pg/conn": {
      "allowed": false,
      "policy": "default-deny",
      "reason": "..."
    }
  }
}

Error responses:

StatusErrorDescription
401invalid_tokenMissing, malformed, or invalid JWT
400invalid_refPath traversal or malformed ref
404unknown_refRef not found in bundle
500internal_errorBackend or internal failure

Environment Variables

kz server start

VariableUsed ByDescription
RUST_LOGAllLog level filter (e.g., kz=debug)
KEYZERO_SIGNING_KEY_PATHserver startPath to RSA private key PEM for signing short-lived JWTs
KEYZERO_PUBLIC_KEY_PATHserver start --proxyPath to RSA public key PEM for verifying short-lived JWTs
KEYZERO_PROXY_URLserver startProxy URL returned in short-lived mode responses
VAULT_TOKENVault backendHashiCorp Vault authentication token
GOOGLE_ACCESS_TOKENGCP backendGoogle Cloud access token

kz

VariableUsed ByDescription
KEYZERO_ENVkz runActive environment section (e.g., production, staging)
VAULT_TOKENVault providerHashiCorp Vault authentication token
GOOGLE_ACCESS_TOKENGCP providerGoogle Cloud access token

Set by kz on subprocess

VariableDescription
HTTP_PROXY, http_proxyLocal MITM proxy address (blind mode)
HTTPS_PROXY, https_proxyLocal MITM proxy address (blind mode)
SSL_CERT_FILEEphemeral CA certificate path
NODE_EXTRA_CA_CERTSEphemeral CA certificate path (Node.js)
REQUESTS_CA_BUNDLEEphemeral CA certificate path (Python)