Skip to main content

Document Parsing & Field Extraction

Bailian CLI ParseX: parse documents and media, query results, and extract fields with a JSON Schema and source citations.

Use ParseX from the terminal to parse documents or media, and extract structured fields from documents or existing parse results with a JSON Schema.
ParseX uses a workspace-specific API. Provide a workspace with --workspace-id, BAILIAN_WORKSPACE_ID, or workspace_id in the Profile. Availability depends on the workspace and the actual rollout.
Append --help to any command for full parameter details, e.g. bl parsex parse submit --help. Command details on this page are verified against bl 2.8.5.
See Use the CLI for feature-page usage.

Parse documents or media

bl parsex parse submit

Submit a document or media parsing job. Requires API Key authentication. Usage
bl parsex parse submit --file-url <url> [--workspace-id <id>] [flags]
ParameterTypeRequiredDescription
--file-url <url>stringyesAccessible source HTTP(S) URL
--file-name <name>stringnoFile name; alternative to --file-name-extension
--file-name-extension <extension>stringnoFile extension, e.g. pdf
--config-id <id>stringnoSaved ParseX configuration ID
--processing-file <path>stringnoJSON object file for the API processing field
--oss-config-file <path>stringnoJSON file with OSS credentials; submit also requires bucket and endpoint
--output-file-format <markdown>arraynoResult file format (markdown)
--layout-table-format <markdown|html>stringnoTable format inside Markdown results
--workspace-id <id>stringnoWorkspace ID for the API endpoint (or set BAILIAN_WORKSPACE_ID)
Example: Submit a document and output JSON
bl parsex parse submit --file-url "https://example.com/document.pdf" --file-name document.pdf --workspace-id ws-example --output json
Example: Use a processing file and output Markdown
bl parsex parse submit --file-url "https://example.com/document.pdf" --processing-file processing.json --output-file-format markdown --workspace-id ws-example
Example processing.json:
{"doc_processing_config":{"page_index":"1-10","layout_position":true}}
  • Returns data.biz_id without waiting; query it with parse result --follow.
  • The input must be an accessible HTTP(S) URL, including a signed OSS URL. This API does not support local uploads.
  • Inline processing configuration takes precedence over --config-id. For media, use media_processing_config to configure diarization, synopsis, and frame extraction.
  • --dry-run makes no business requests and redacts OSS credentials and URL query strings.

bl parsex parse result

Query parsing status, results, or a result slice. Requires API Key authentication. Usage
bl parsex parse result --biz-id <id> [--follow] [flags]
ParameterTypeRequiredDescription
--biz-id <id>stringyesbiz_id returned by the matching submit command
--followswitchnoPoll until success or failure; Ctrl-C stops only local polling
--interval <seconds>numbernoPolling interval, 1–3600 seconds (default: 2; --follow only)
--poll-timeout <seconds>numbernoTotal polling deadline, 1–86400 seconds (default: 600; --follow only)
--step-start <n>numbernoSlice offset for layouts or media segments (service default: 0)
--step-size <n>numbernoSlice size (service default: 0)
--oss-config-file <path>stringnoJSON file with OSS credentials
--workspace-id <id>stringnoWorkspace ID for the API endpoint (or set BAILIAN_WORKSPACE_ID)
Example: Query a single result
bl parsex parse result --biz-id biz-example --workspace-id ws-example
Example: Poll until the job finishes
bl parsex parse result --biz-id biz-example --follow --poll-timeout 600 --output json
  • A single query preserves the complete API response and exits 0 even when the job failed.
  • --follow emits one terminal response on stdout and progress on stderr; failure exits 1, timeout 5, and Ctrl-C 130.
  • Resume with the same biz_id; stopping local polling does not cancel the server-side job.
  • --follow waits only for the requested slice, not all slices. Advance --step-start explicitly to retrieve more layouts or media segments.
  • ResultNotReady is polled again only with --follow. --timeout controls each HTTP request; --poll-timeout covers the whole polling loop.

Extract structured fields

bl parsex extract submit

Extract fields from a document or existing parse result with a JSON Schema. Requires API Key authentication. Usage
bl parsex extract submit (--file-url <url> | --parsed-file-biz-id <id>) (--schema-file <path> | --processing-file <path> | --config-id <id>) [flags]
ParameterTypeRequiredDescription
--file-url <url>stringnoAccessible source file URL; alternative to --parsed-file-biz-id
--parsed-file-biz-id <id>stringnoCompleted parse job biz_id; alternative to --file-url
--schema-file <path>stringnoJSON Schema object file
--processing-file <path>stringnoJSON object file containing the API processing field
--config-id <id>stringnoSaved ParseX configuration ID
--file-name <name>stringnoFile name; alternative to --file-name-extension
--file-name-extension <extension>stringnoFile extension, e.g. pdf
--user-prompt <text>stringnoExtraction instruction; used with --schema-file
--citation-required <boolean>booleannoInclude source citations (service default: true)
--allow-inference <boolean>booleannoAllow inference (service default: false)
--oss-config-file <path>stringnoJSON file with OSS credentials; submit also requires bucket and endpoint
--workspace-id <id>stringnoWorkspace ID for the API endpoint (or set BAILIAN_WORKSPACE_ID)
Example: Extract fields from a document with a schema
bl parsex extract submit --file-url "https://example.com/contract.pdf" --schema-file schema.json --workspace-id ws-example
Example: Reuse an existing parse result and disable inference
bl parsex extract submit --parsed-file-biz-id parse-example --schema-file schema.json --citation-required true --allow-inference false --workspace-id ws-example
Example schema.json:
{"type":"object","properties":{"title":{"type":"string"}}}
  • Returns data.biz_id without waiting; query it with extract result --follow.
  • The input must be an accessible HTTP(S) URL, including a signed OSS URL. Local uploads are not supported. Inline processing configuration takes precedence over --config-id.
  • Send the schema as a JSON object, not a JSON string.
  • extract does not support audio or video. Reused parse results must still be retained by the service.

bl parsex extract result

Query extraction status, fields, and citations. Requires API Key authentication. Usage
bl parsex extract result --biz-id <id> [--follow] [flags]
ParameterTypeRequiredDescription
--biz-id <id>stringyesbiz_id returned by the matching submit command
--followswitchnoPoll until success or failure; Ctrl-C stops only local polling
--interval <seconds>numbernoPolling interval, 1–3600 seconds (default: 2; --follow only)
--poll-timeout <seconds>numbernoTotal polling deadline, 1–86400 seconds (default: 600; --follow only)
--oss-config-file <path>stringnoJSON file with OSS credentials
--workspace-id <id>stringnoWorkspace ID for the API endpoint (or set BAILIAN_WORKSPACE_ID)
Example: Poll for extraction results
bl parsex extract result --biz-id biz-example --follow --poll-timeout 600 --output json
  • A single query preserves the complete API response and exits 0 even when the job failed.
  • --follow emits one terminal response on stdout and progress on stderr; failure exits 1, timeout 5, and Ctrl-C 130.
  • Resume with the same biz_id; stopping local polling does not cancel the server-side job.