DocuTray
CLICommands

Split

Reference for the `docutray split` command in the DocuTray CLI — usage, flags, arguments, and examples.

Split a file with several documents into typed segments, and check a split's status. Split does not extract data: use --extract to crop and convert each segment.

docutray split SOURCE

Split a file that holds several documents (a scanned bundle, an expense report with its receipts, a photo of several receipts) into segments: one per document, with its page range, its document type among --types (or "otro" for pages that match none) and, in beta, the regions where it sits on each page. Split does not extract data: add --extract to crop every segment on this machine and convert it with its document type, or --output-dir to save the crops. Accepts a PDF up to 100 pages or a single-page image, as a local path or a public URL. A timeout does not cancel the split: read it later with "docutray split status <split_id>" instead of splitting the file again, which is billed again.

USAGE
  $ docutray split SOURCE -t <value> [--extract] [--json] [--metadata <value>] [--output-dir <value>]
    [--timeout <value>] [--wait]

ARGUMENTS
  SOURCE  File path or URL of the file to split

FLAGS
  -t, --types=<value>       (required) Comma-separated candidate document type codes, 1 to 20 (see: docutray types
                            list). Do not include "otro": it is implicit
      --extract             Crop every segment that is not "otro" on this machine and convert it with its document type
                            (up to 4 at a time); each segment gets a "conversion" with its data
      --json                Output as JSON (default when piped)
      --metadata=<value>    JSON object attached to the split and to each conversion of --extract, up to 64 KB (e.g.
                            '{"key":"value"}'). With a local file, or a URL with --extract or --output-dir (the file is
                            uploaded), values must be strings, numbers, booleans or null. The key "_split" is reserved
      --output-dir=<value>  Save the crop of every segment that is not "otro" in this directory, as
                            segment-<index>-<code> with the extension of the crop (.pdf, .png, or the original image's)
      --timeout=<value>     [default: 1800] Polling timeout in seconds, for the split and for each conversion of
                            --extract. A timeout does not cancel the split
      --[no-]wait           Wait for the split to finish (use --no-wait to return the split_id right away)

DESCRIPTION
  Split a file that holds several documents (a scanned bundle, an expense report with its receipts, a photo of several
  receipts) into segments: one per document, with its page range, its document type among --types (or "otro" for pages
  that match none) and, in beta, the regions where it sits on each page. Split does not extract data: add --extract to
  crop every segment on this machine and convert it with its document type, or --output-dir to save the crops. Accepts a
  PDF up to 100 pages or a single-page image, as a local path or a public URL. A timeout does not cancel the split: read
  it later with "docutray split status <split_id>" instead of splitting the file again, which is billed again.

EXAMPLES
  Split a local PDF among two candidate types

    $ docutray split bundle.pdf --types factura,boleta

  Split, then crop and convert every segment that is not "otro"

    $ docutray split bundle.pdf -t factura,boleta --extract

  Save each segment as its own file (PDF, PNG or the original image) without converting

    $ docutray split photo.jpg -t boleta --output-dir crops

  Start the split and return its split_id right away

    $ docutray split https://example.com/bundle.pdf -t factura --no-wait

  Attach metadata, echoed in the status, the SPLIT_* webhooks and each conversion of --extract

    $ docutray split bundle.pdf -t factura --metadata '{"batch":"2026-12-01"}'

DOCUMENTATION
  Learn more: https://docs.docutray.com/cli/split

See code: src/commands/split.ts

docutray split status SPLIT-ID

Query the status of a split by its split ID. Use this to check on a split started with --no-wait or after a timeout, or to read its segments later. Returns the status and, when it succeeded, the segments with their page ranges, document types and regions.

USAGE
  $ docutray split:status SPLIT-ID [--json]

ARGUMENTS
  SPLIT-ID  Split ID returned by "split" (split_id)

FLAGS
  --json  Output as JSON (default when piped)

DESCRIPTION
  Query the status of a split by its split ID. Use this to check on a split started with --no-wait or after a timeout,
  or to read its segments later. Returns the status and, when it succeeded, the segments with their page ranges,
  document types and regions.

EXAMPLES
  Check the status of a split

    $ docutray split status cm5vm9hx30001m5cgh0p9v8qa

  Show only the segments

    $ docutray split status cm5vm9hx30001m5cgh0p9v8qa | jq .segments

DOCUMENTATION
  Learn more: https://docs.docutray.com/cli/split/status

See code: src/commands/split/status.ts

On this page