DocuTray
CLI

CLI

Docutray command-line interface — log in with OAuth, convert and identify documents, manage document types and run processing steps from your terminal.

@docutray/cli v0.6.0npm 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 --oauth keeps 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/cli

Requires Node.js 20 or later. Verify:

docutray --version

Quick 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.json

If 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

CommandWhat it does
docutray loginAuthenticate with OAuth in the browser (--oauth) or with an API key
docutray logoutRemove the stored credentials from this machine
docutray statusShow 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 / exportBrowse and export document types
docutray types create / updateCreate or change document types (schema, prompt hints, export spec for CSV/Excel)
docutray types rules get / set / testRead, save and dry-run a document type's DSL validation rules
docutray steps run / statusRun 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

On this page