@trueraft/cli
v0.2.1
Published
Command-line tool for the Trueraft document verification API.
Maintainers
Readme
@trueraft/cli
Command-line tool for the Trueraft verification + reverse-KYC API. Built on top of @trueraft/sdk — same retries, same error semantics, plus colour output and a CI-friendly exit-code contract.
Install
# One-off:
npx @trueraft/cli msme 27AAPFU0939F1ZV
# Or install globally:
npm install -g @trueraft/cli
trueraft msme 27AAPFU0939F1ZVRequires Node ≥ 18.
Authentication
Set your API key once, then forget about it:
export TRUERAFT_API_KEY=trk_test_…Or pass --key trk_… on every invocation. The public-lookup commands (msme, litigation, rera, health) work without a key.
Profiles (multi-tenant)
If you work with multiple Trueraft accounts (staging vs prod, multiple client orgs), use a profile config at ~/.trueraft/config.json:
{
"default": "prod",
"profiles": {
"prod": { "apiKey": "trk_live_…" },
"staging": { "apiKey": "trk_test_…", "baseB2B": "https://staging.trueraft.com/functions/v1" }
}
}Then:
trueraft verify pan ABCDE1234F --profile stagingResolution order: explicit flag → profile → environment variable → built-in default.
Commands
verify <type> <number>
Single-document verification.
trueraft verify pan ABCDE1234F
trueraft verify dl MH1220110012345 --dob 1990-01-01
trueraft verify gst 27ABCDE1234F1Z5
trueraft verify rc MH12AB1234
trueraft verify aadhaar 123412341234
trueraft verify bank 123456789012 --ifsc HDFC0001234
trueraft verify fasttag MH12AB1234
trueraft verify chassis MA3ERLF1S00123456Optional flags: --ref <id> (caller reference), --idempotency-key <key> (replay-safe).
driver-score <rc> <dl>
Combined RC + DL → 0-100 Driver Trust Score.
trueraft driver-score MH12AB1234 MH1220110012345vehicle-score <rc>
RC-only → 0-100 Vehicle Trust Score.
trueraft vehicle-score MH12AB1234badge <gstin|pan|upi>
Lookup a Trueraft Verified badge.
trueraft badge --gstin 27AAPFU0939F1ZV
trueraft badge --pan ABCDE1234F
trueraft badge --upi acme@hdfcbank
# Positional value — CLI sniffs the format:
trueraft badge acme@hdfcbankfraud-feed
Paginated stream of caution / risky entities. Enterprise tier only — returns a clear error if your account flag isn't set.
# Single page
trueraft fraud-feed --since 2026-05-01T00:00:00Z --limit 500
# Stream the entire feed as NDJSON (one row per line, jq-friendly)
trueraft fraud-feed --all --format ndjson > feed.ndjsonFlags: --since <iso> (resume cursor), --limit <n> (max 1000), --format json|ndjson, --all (auto-paginate).
pay-verify <upi|pan|phone>
UPI / phone / PAN trust score.
trueraft pay-verify --upi acme@hdfcbank
trueraft pay-verify --phone +919876543210
trueraft pay-verify --pan ABCDE1234F
# Positional (CLI sniffs):
trueraft pay-verify acme@hdfcbank
trueraft pay-verify +919876543210msme <gstin>
MSME vendor-fitness score (0-100).
trueraft msme 27AAPFU0939F1ZVlitigation <name> [--pan PAN]
Court records lookup.
trueraft litigation "Rajesh Kumar Sharma"
trueraft litigation "Rajesh Kumar Sharma" --pan ABCDE1234Frera <reg-no> --state <state> [--type project|agent]
RERA registration check.
trueraft rera P51800012345 --state Maharashtra
trueraft rera A51900099999 --state Maharashtra --type agenthealth
Provider health summary.
trueraft healthverify-webhook
Offline HMAC-SHA256 webhook signature verifier — does not hit the network. Useful for CI smoke tests and replaying captured webhook deliveries.
trueraft verify-webhook --body event.json \
--signature "sha256=abcd…" --secret "$TRUERAFT_WEBHOOK_SECRET"
# From stdin:
curl -s … | trueraft verify-webhook --body - --signature "sha256=…" --secret …Exits 0 on a valid signature, 3 on mismatch.
Global flags
| Flag | Notes |
|---|---|
| --key trk_… | API key. Overrides TRUERAFT_API_KEY env. |
| --profile <name> | Read credentials from ~/.trueraft/config.json. |
| --raw | One-line JSON (good for \| jq). Default is pretty 2-space JSON when piped or pretty verdicts on TTY. |
| --json | Alias for --raw (back-compat with 0.1.x). |
| --base-b2b URL | Override Edge Functions URL. |
| --base-site URL | Override website URL. |
| --help, -h | Show usage. trueraft help <command> for per-command help. |
NO_COLOR=1 disables ANSI colour. Non-TTY output is also colour-stripped automatically.
Exit codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | User error — bad flag, missing argument, invalid type |
| 3 | API error — 4xx from upstream (bad input, auth, not found) |
| 4 | Transport error — 5xx, network failure, timeout |
| 1 | Unexpected (shouldn't happen — please file a bug) |
Use these in shell scripts to branch:
trueraft verify pan ABCDE1234F
case $? in
0) echo "verified" ;;
3) echo "bad PAN" ;;
4) echo "Trueraft is down — retry later" ;;
esacScripting
# Drop the score with jq
trueraft msme 27AAPFU0939F1ZV --raw | jq .trust_score
# Bulk verify from a CSV
while IFS=, read -r type number; do
trueraft verify "$type" "$number" --raw
done < docs.csv | jq -s .
# Stream fraud feed into a Postgres COPY
trueraft fraud-feed --all --format ndjson | \
psql -c "COPY fraud_signals FROM STDIN"Pair with the SDK
For programmatic / long-running / high-throughput use, reach for @trueraft/sdk directly — the CLI is a thin wrapper over it.
import { Trueraft } from "@trueraft/sdk";
const tr = new Trueraft({ apiKey: process.env.TRUERAFT_API_KEY! });License
MIT
