Skip to main content

Export to XML

An XML export profile produces the same structured document as a JSON export, serialized as XML instead. It carries identical content, the extracted fields with their confidence and review state, per-field bounding boxes, the per-page block, and the transaction's metadata, and it honours the same options. Choose it when a downstream system consumes XML rather than JSON.

To produce it, add an Export activity to your workflow with an XML profile, then retrieve the output (see Accessing OCR & Field Data for the API calls).

Options

An XML profile offers every option a JSON profile does, plus one XML-only setting:

  • Root Element (default document): the name of the XML document's root element.
  • Field Filter (default all fields): export all fields, only an included set, or everything except an excluded set. Paths use dot notation for nested fields (vendor.name, line_items.description). See Filtering fields.
  • Include Field Details (default on): keep confidence, reasoning, confirmation state, and bounding boxes alongside each value. Turn off to keep just the value.
  • Include Page Full Text (default off): each page's OCR text.
  • Include Page OCR Data (default off): word-level OCR layout.
  • Pretty Print (default on): indented, readable XML. Turn off for a compact file with minimal whitespace.
  • Exclude Paths (advanced): strip specific branches from the finished file by path. See Reducing file size.

The per-page block and the transaction metadata are always included and have no toggle. The coordinate contract is identical to the JSON export: every bounding box is in rasterized page-image pixel space with a top-left origin.

How the structure maps to XML

The XML mirrors the JSON structure element for element. A few serialization rules make the mapping predictable:

  • Object keys become elements. Each key in the JSON becomes a child element of the same name.
  • Lists become repeated singular elements. A list is wrapped in an element named for the key, with one child per item named in the singular, so documents holds repeated document elements, pages holds page elements, bounding_boxes holds bounding_box elements.
  • Booleans serialize as the text true / false.
  • Null values appear as an empty element carrying nil="true", so an absent value is distinguishable from an empty string.
<?xml version="1.0" encoding="UTF-8"?>
<document>
<transaction_id></transaction_id>
<tenant_id></tenant_id>
<project_id></project_id>
<transaction>
<exported_at></exported_at>
<status></status>
<created_at></created_at>
<source_file_names>
<file>invoice.pdf</file>
</source_file_names>
<metadata>
<customer_ref>ACME-42</customer_ref>
<cost_center>EU-1</cost_center>
</metadata>
</transaction>
<documents>
<document>
<document_id></document_id>
<document_type>invoice</document_type>
<classification_confidence>0.97</classification_confidence>
<fields>
<invoice_number>
<value>INV-1001</value>
<confidence>0.99</confidence>
<reasoning>Found under INVOICE NO. label</reasoning>
<is_confirmed>true</is_confirmed>
<bounding_boxes>
<bounding_box>
<coordinates>
<coordinate>10</coordinate>
<coordinate>10</coordinate>
<coordinate>100</coordinate>
<coordinate>30</coordinate>
</coordinates>
<page_index>1</page_index>
</bounding_box>
</bounding_boxes>
</invoice_number>
</fields>
<pages>
<page>
<page_number>1</page_number>
<transaction_page_number>1</transaction_page_number>
<source_filename>invoice.pdf</source_filename>
<source_file_page_number>1</source_file_page_number>
<image_transform>
<rasterized_width>2480</rasterized_width>
<rasterized_height>3508</rasterized_height>
<render_scale>4.166</render_scale>
<coordinate_system>top-left-origin</coordinate_system>
<rotation>0</rotation>
</image_transform>
</page>
</pages>
</document>
</documents>
</document>

For the meaning of every field, groups and repeating groups, the page image_transform frame, and the optional page OCR block, see Export to JSON; the content is identical.

Field names as element names

Field elements are named by their field id (for example invoice_number). Field ids are ordinary identifiers, so they map directly to element names; on the rare occasion a character is not valid in an XML name it is replaced with _ and the original id is preserved on a key attribute.

Next steps

  • Export to JSON: the same content in JSON, with the full field reference and coordinate contract.
  • Accessing OCR & Field Data: how to retrieve these results over the API.
  • Pair Export with a Notification step to tell an external system where to download the results.