You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wraps every public Client method behind a Typer-based `veryfi` console
script (and `python -m veryfi`) so AI agents and shell users can drive
the SDK from a terminal. The CLI is purely additive: the Client API,
constructor signature, and all existing tests are unchanged.
Highlights:
- One Typer sub-app per resource (documents, bank-statements, checks,
business-cards, w2s, w8s, w9s, any-docs, classify) plus nested
line-items, tags, and PDF/W-2 split sub-apps.
- Env-var-first auth (VERYFI_CLIENT_ID, VERYFI_USERNAME, VERYFI_API_KEY,
plus optional VERYFI_CLIENT_SECRET / VERYFI_BASE_URL / VERYFI_API_VERSION
/ VERYFI_TIMEOUT) with equivalent flags as overrides.
- JSON output on stdout, structured JSON errors on stderr, exit codes
mapped from the HTTP status (clipped to 1-255) so agents can branch
without parsing tracebacks.
- `veryfi schema` emits a machine-readable manifest of every command
and parameter for tool registration.
- Repeatable `--field KEY=VALUE` and `--json-body` for endpoints that
take **kwargs; stdin support via `--file -`.
- New tests/test_cli.py covers help discovery, env-var auth, happy paths
per resource, error-to-exit-code mapping, schema shape, and output
formats. Total suite: 62 tests passing (35 existing + 27 new), black
clean.
Also makes the User-Agent header dynamic via importlib.metadata so it
stays in sync with the pbr-derived version without manual edits.
@@ -366,6 +367,118 @@ except VeryfiClientError as e:
366
367
367
368
---
368
369
370
+
## Command-line interface
371
+
372
+
Installing `veryfi` also installs a `veryfi` console script (and the equivalent `python -m veryfi`). The CLI is a thin wrapper around the Python `Client` and exposes every supported resource as a sub-command — designed for shell users and AI agents that drive the SDK from a terminal.
373
+
374
+
Verify the install:
375
+
376
+
```bash
377
+
veryfi --help
378
+
# or, equivalently:
379
+
python -m veryfi --help
380
+
```
381
+
382
+
### Authentication
383
+
384
+
Credentials are read from environment variables (preferred for agents) or equivalent flags:
You can also pipe binary file data via stdin by passing `--file -`:
434
+
435
+
```bash
436
+
curl -s https://cdn.example.com/r.jpg | veryfi documents process --file -
437
+
```
438
+
439
+
### Output and exit codes
440
+
441
+
Every command emits a JSON response on stdout. Use `--output raw` for single-line JSON (handy for piping into `jq`) or `--output pretty` for sorted keys. Errors are emitted as JSON on **stderr** and the process exits with a non-zero status:
442
+
443
+
| Exit code | Meaning |
444
+
|-----------|---------|
445
+
|`0`| Success |
446
+
|`2`| Missing credentials or invalid CLI arguments |
447
+
|`1`-`255`| Veryfi API error — exit code is the HTTP status (clipped to 255) |
448
+
|`70`| Unexpected error (treat as a bug) |
449
+
450
+
The exact HTTP status is always included in the stderr payload, e.g.:
451
+
452
+
```json
453
+
{
454
+
"error": "Document not found",
455
+
"status": 404,
456
+
"exception": "ResourceNotFound"
457
+
}
458
+
```
459
+
460
+
### Passing arbitrary fields
461
+
462
+
For endpoints that accept `**kwargs` (e.g. `update_document`, `add_line_item`, `update_check`), use repeatable `--field KEY=VALUE` flags or `--json-body '<json>'`. `--field` values are JSON-decoded when possible (so `total=11.23` becomes a number, `enabled=true` becomes a boolean, `data='{"a":1}'` becomes an object) and fall back to plain strings.
463
+
464
+
### Discovery
465
+
466
+
Every command at every level supports `--help`, which lists subcommands or options with their descriptions:
467
+
468
+
```bash
469
+
veryfi --help # top-level: lists all resource groups
veryfi documents process --help # leaf: lists every flag with its description
472
+
```
473
+
474
+
For AI agents and tooling that prefer a machine-readable contract, `veryfi schema` emits a JSON manifest of every command, its description, and every parameter (name, type, required, repeatable). Agents can ingest this once to register Veryfi as a tool surface without parsing `--help` text:
0 commit comments