CLI Quickstart
Install the Tork CLI, authenticate, wire up your project, and send your first governed request — all from the terminal.
Install
Run instantly with npx, or install via Homebrew.
npx (no install)
Homebrew
The package is published as @torknetwork/cli on npm. Both methods give you the same tork binary.
tork login
Authenticate with your Tork API key.
The key is entered at a masked prompt so it never appears in your terminal or shell history. You can also pass it directly:
In CI, set the TORK_API_KEY environment variable and every command authenticates without a login step:
Always use https://tork.network as the API base URL — never www.tork.network. The www host redirects to the apex domain and the Authorization header is dropped in the redirect, causing 401 errors.
tork init
Detect your stack, install the SDK, and scaffold config.
tork init inspects your project, detects the framework and language, installs the matching Tork SDK, and writes a tork.config.json you can commit:
tork test
Send a synthetic PII request through the governance API.
The test sends a synthetic PII payload through https://tork.network/api/v1/govern and reports the governance decision, the signed compliance receipt, and round-trip latency. If this passes, your integration is governed end to end.
tork doctor
Diagnose your setup with 8 automated checks
Use the --json flag for machine-readable output. The exit code makes it a natural CI gate: 0 when all checks pass, 1 when any check fails.
tork whoami
Live-verify your key and show the authenticated organization
tork whoami verifies your key against the API on every run — the org line shows (verified just now) on success. If the API can't be reached, it falls back to the last known org and labels it explicitly as cached, so you always know whether you're looking at live or stale data.
tork logs
Tail recent governance decisions for your org
Each line is one governance decision — the action taken, how many PII entities were involved, round-trip latency, and the tail of the receipt id. Backed by the receipts feed, so what you see here is what your auditors see.
tork usage
Show plan usage for the authenticated org
Shows calls used against your plan limit, calls remaining, and when the current billing period started. Add --json for machine-readable output.
tork receipts
List compliance receipts, or fetch one by id
Pass a receipt id to fetch the full record — timestamp, action, PII types, and policy version — for a single governed request:
Keep your key out of your shell history
Inject TORK_API_KEY at runtime from a secrets manager
Never hardcode your API key in scripts and never commit it to a repository. The preferred form is the native --op flag, which resolves the key via the 1Password CLI at login time so it never touches your shell history:
You can also inject the key at runtime from any secrets manager:
The identical pattern works with any secrets manager — HashiCorp Vault, AWS Secrets Manager, Doppler — feeding TORK_API_KEY. In CI, use your platform's secret store (e.g. GitHub Actions secrets) mapped to TORK_API_KEY.
You're Governed!
Your project now sends governed requests and receives signed receipts. Explore the SDK docs to go deeper, or watch activity arrive in your dashboard.
Quick Reference
@torknetwork/clihttps://tork.networkTORK_API_KEY env vartork doctor --jsontork logs --followtork usagetork receiptstork login --op 'op://…'