documents.split finds logical documents inside one file. PDFs and other
page-based sources become ordered page-range segments. Workbooks become one
segment per worksheet, classified against the classes you provide.
Basic usage
Method signature
Parameters
Returns
AJob. After success, job.result is a SplitResult:
Define classes
Each class needs a stableid, display label, and a description that
distinguishes it from nearby classes:
id is what appears
in result joins; keep it stable if you revise display text.
Subclasses and instance keys
Add subclasses for finer segment labels and an instance key when each segment should carry a document identifier:segment.instance carries the requested key and extracted value when one is
available.
Control unmatched content
unknown_policy determines what happens when content matches none of the
classes:
include when completeness matters. Use force only when every page must
belong to one of a closed set of classes.
Page selection and parse mode
medium or high
only when the default parse is not sufficient; higher modes add latency.
Split rules
Usesplit_rules for a boundary convention the class descriptions do not
express:
overlap_policy="shared_boundary_page" when the page at a detected
boundary belongs to both neighboring documents. The default exclusive
policy keeps every source page in only one segment.
Include content or files
.xlsx artifact.
Response structure
start_page and end_page. Spreadsheet segments use
sheet_name; their page values correspond to the worksheet’s one-based
position. JSON sources may use json_pointer.
classification_confidence and boundary_confidence contain a readable band
and an optional score. unavailable means no score was produced, not zero
confidence.
Reuse a parse
Async split
Complete example
Error handling
unknown_policy="error" when content is
unclassified.
Best practices
Define distinct classes
Give each class a stable ID and a description that separates it from adjacent classes.
Keep unknowns visible
Start with
unknown_policy="include" so unexpected packet content is not silently forced.Add rules for boundaries
Use
split_rules for continuation pages or identifier changes, not to replace class descriptions.Materialize only when needed
Request files when downstream systems need individual documents; use inline content for inspection.