Use the CLI

Updated at:

Submit ParseX document parsing and field extraction tasks from the terminal with the Bailian CLI.

The Bailian CLI (bailian-cli) wraps ParseX parsing and field extraction into commands you can drive from the terminal or an Agent.

NoteParseX is currently available on the China site only, and the CLI uses the Beijing workspace domain by default; availability depends on your workspace and service activation. The CLI uses the workspace-specific API and an ordinary API key, and does not support uploading local files.

Prerequisites

  • Install Bailian CLI and configure an API key.
  • Obtain a workspace ID that can use ParseX and specify it with --workspace-id, BAILIAN_WORKSPACE_ID, or the workspace_id configuration item.
  • Store input files at accessible HTTP(S) URLs, including signed OSS URLs.

Commands

CapabilityCommandNotesCommon options
Document or media parsingbl parsex parse submitSubmits a parsing task and immediately returns data.biz_id--file-url source file URL, --config-id saved configuration, --processing-file processing configuration
Query parsing resultsbl parsex parse resultQueries status, results, or shards; --follow polls until a terminal state--biz-id task ID, --follow, --poll-timeout
Field extractionbl parsex extract submitExtracts fields with a JSON Schema and returns source citations--file-url or --parsed-file-biz-id, --schema-file
Query extraction resultsbl parsex extract resultQueries extraction status, fields, and citations--biz-id task ID, --follow

For full parameters, see the ParseX command reference.

Example

bl parsex parse submit --workspace-id <workspace-id> --file-url "https://example.com/document.pdf" --file-name document.pdf --output-file-format markdown --output json
bl parsex parse result --workspace-id <workspace-id> --biz-id <parse-biz-id> --follow --output json
bl parsex extract submit --workspace-id <workspace-id> --parsed-file-biz-id <parse-biz-id> --schema-file schema.json --output json
bl parsex extract result --workspace-id <workspace-id> --biz-id <extract-biz-id> --follow --output json
  • Submit commands do not wait for completion; use the matching result --follow to get results.
  • A single query still exits 0 when the task failed; with --follow, a failed task exits 1, a timeout exits 5, and Ctrl-C exits 130.
  • Inline processing configuration takes precedence over --config-id. Send the extraction schema as an object, not a JSON string.
  • Extraction does not support audio or video. Reused parsing results must still be retained by the service and reusable.

Append --help to any command for full parameter details.