CLI
Docutray command-line interface — log in with OAuth, convert and identify documents, manage document types and run processing steps from your terminal.
npm install -g @docutray/cli@docutray/cli is the official command-line interface for DocuTray. Convert
documents to structured data, identify document types, manage extraction
schemas and run processing steps from your terminal, shell scripts or AI
coding agents. Output is JSON when piped, so it composes with jq and other
tools.
Why a CLI?
The CLI is the right surface when you:
- Want a CI step that converts a file and asserts on extracted fields.
- Are prototyping and don't want to set up an SDK yet.
- Drive DocuTray from an AI coding agent (Claude Code, Cursor, Codex):
docutray login --oauthkeeps the API key out of the conversation. - Need to version document types in Git (
types export/types create).
For everything else, reach for the Node SDK or Python SDK.
Install
npm install -g @docutray/cliRequires Node.js 20 or later. Verify:
docutray --versionQuick start
# 1. Authenticate: opens the browser, where you choose the organization.
# The API key is stored in ~/.config/docutray/config.json
docutray login --oauth
# 2. Find the code of the document type to extract with
docutray types list
# 3. Convert a document (local file or public URL); the JSON goes to stdout.
# Replace TYPE_CODE with a code from step 2.
docutray convert ./invoice.pdf --type TYPE_CODE > invoice.jsonIf you belong to several organizations, pick one on the DocuTray consent
screen. To switch, run docutray login --oauth again. In CI, set
DOCUTRAY_API_KEY instead of logging in. See
Authentication.
Available commands
| Command | What it does |
|---|---|
docutray login | Authenticate with OAuth in the browser (--oauth) or with an API key |
docutray logout | Remove the stored credentials from this machine |
docutray status | Show the authentication status, masked key and config path |
docutray convert <source> | Convert a document with a document type (--async for long documents) |
docutray convert status <id> | Check a conversion later and read its result and validation |
docutray identify <source> | Identify a document's type, with ranked alternatives |
docutray types list / get / export | Browse and export document types |
docutray types create / update | Create or change document types (schema, prompt hints, export spec for CSV/Excel) |
docutray types rules get / set / test | Read, save and dry-run a document type's DSL validation rules |
docutray steps run / status | Run a processing step on a document and check its execution |
Every command above accepts --json, and --help prints its full flag listing.
Source
The CLI is open source: github.com/docutray/docutray-cli