How to split a document bundle
Split divides a bundle of pages into separate documents. Use it when one file holds several documents, such as a scanned stack of invoices and receipts.
Quick start
Split takes the same document input, plus a method describing where one document ends and the next begins. The result lists the child documents, each with its original page numbers and a document_ref you can reuse in other requests.
Send the options as a JSON string in request. Split and Classify read their options from a request form field next to the file. In Python the SDK takes it as a dict (request={...}); with cURL, pass the JSON text. In Python, file takes a list and job_id is passed by name, get_status(job_id=...). In JavaScript, file takes an array, job_id is positional, getStatus(job_id), and request and response fields use the wire names (pages_per_segment, review_required), as for Digitise and Extract.
Split methods
Set config.method to one of:
Other options:
classify_segments:true(the default) labels each child document with one of yourcategories;falseonly splits. Withtrue,categoriesis required. Withfalse, sendingcategoriesis rejected.categories: up to 20 entries, each with atypeand adescription. Names are yours to choose and must be unique.remainder: forfixed_pages,keep(the default) keeps a shorter last group anderrorrejects the request when the pages do not divide evenly.segment_ranges: 1-based, inclusive ranges, such as[{"start": 1, "end": 5}, {"start": 6, "end": 10}]. They must cover the selected pages exactly once, in order.pages: add"pages": [{"start": 1, "end": 2}]to therequestto split only those pages.
Split at markers
With triggers, a new document starts at each page that matches a marker in split_on:
type:blank_page,text,qr_code,barcode, orphoto. Aphotomarker needs adescriptionof the image.match: fortext,qr_code, andbarcode, exactly one ofequals,prefix, orregex. These go insidematch, not on the marker itself.- Optional:
where(anywhereortop_of_page),trigger_page(first_page,separator_exclude, orseparator_keep),split_when(every_matchorvalue_changes, for codes only), andformatsfor barcodes.
A blank separator page is left out of the segments (listed under coverage.excluded_pages). Pages before the first marker form a segment flagged LEADING_PAGES_WITHOUT_TRIGGER, and a file with no marker comes back as one segment flagged the same way. To label the segments, add categories and leave classify_segments on; with classify_segments: false, categories is rejected.
Split results
- Each segment is a child document.
pagesrefers to its original page numbers, anddocument_reflets you reuse it in another request. - With
classify_segments: true,typeis the matching category andclassification_statusismatched, orunknownwithunknown_reason: "no_matching_type"when none fits. status: "completed"means processing finished, not that every segment passed review. Checkreview_requiredon each segment before accepting the result automatically.
Request behaviours
Split and Classify share these request behaviours:
- Inputs: PDF, PNG, JPEG, or TIFF. Repeat the
filefield for up to 10 documents with the same config; you get a parent job and adocumentslist of individual jobs, each with its ownstatus_urlandresults_url. The parent’s results include each document’s result underdocuments. You can also upload first withPOST /doc-ai/v1/job/uploadand send the id asupload_ids. URL input is not available. - Retries: add an
Idempotency-Keyheader to retry the same submission without creating another job. A changed request under the same key returns409. - Waiting: send
"execution": "auto"inrequestto wait briefly for a single document. A finished answer returns with HTTP200; otherwise you get the job to poll. - Capabilities:
GET /doc-ai/v1/capabilitieslists the operations, input formats, split methods, and limits enabled on your deployment.