CLI Reference

The Rekor CLI (@rekor/cli) is the primary interface for human operators and AI agents using tools like Claude Code or Cursor. Install it, authenticate, and start managing data from your terminal.

Installation and Setup

npm install -g @rekor/cli
rekor login

After login, the CLI stores your API token in your OS secure credential store. Non-secret settings live in ~/.config/rekor/config.json. When no credential store is available, the token falls back to that same file (mode 0600). You can override credentials with environment variables:

Environment VariablePurpose
REKOR_TOKENOverride the stored API token
REKOR_API_URLOverride the API base URL

Global Flags

These flags work with every command:

FlagDescription
--database <id>Target database ID (required for most commands)
--output <format>Output format: table (default) or json

Use --output json when piping output to other tools or when agents parse results programmatically. Table format is human-readable with formatted columns.

Common Workflows

Setup: database + preview + collection

rekor databases create my-app --name "My App"
rekor databases create-preview my-app --name "initial-setup"
rekor collections upsert tasks --database my-app--initial-setup \
  --name "Tasks" \
  --schema '{"type":"object","required":["title"],"properties":{"title":{"type":"string"},"done":{"type":"boolean"}}}'
rekor databases promote my-app --from my-app--initial-setup

Write and query documents

rekor documents upsert tasks --database my-app \
  --data '{"title":"Ship v1","done":false}'

rekor sql "SELECT * FROM documents WHERE database_id = {database_id:String} AND collection = 'tasks' AND data.done = false AND deleted = false" \
  --database my-app --output json

Create a scoped API key for an agent

rekor tokens create --name "agent-readonly" \
  --grants '[{"scope":{"databases":["my-app"],"environments":["production"]},"permissions":["read:documents","read:collections"]}]'

Commands

CommandDescription
rekor attachmentsManage document attachments
rekor batchExecute atomic batch operations (up to 1,000 operations)
rekor collectionsManage collections
rekor databasesManage databases
rekor debugPlatform-admin debug commands (requires platform:admin grant)
rekor documentsManage documents
rekor endpointsManage MCP Factory endpoints
rekor hooksManage inbound webhook endpoints
rekor loginAuthenticate with Rekor
rekor logoutRemove stored authentication credentials
rekor providersImport/export tool definitions between LLM providers and Record collections
rekor query-relationshipsQuery related documents
rekor relationshipsManage relationships between documents
rekor report-bugSubmit a report to the Rekor triage queue (deduplicated)
rekor sqlExecute a read-only SQL query against database data
rekor statusShow auth, connectivity, and CLI version diagnostics
rekor tokensManage API tokens
rekor triggersManage outbound triggers
rekor updateUpdate the Rekor CLI to the latest published version
rekor whoamiShow the authenticated identity
CLI Reference — Rekor