Skip to content

Contracts

A contract is a set of validation rules (logic blocks) that run against extracted document data. Contracts define what “correct” looks like — checking totals, verifying dates, ensuring required fields are populated, and more.

  1. Navigate to Configure > Contracts and click New Contract.
  2. Enter a name and optional description.
  3. Click Save to create the contract, then add logic blocks.

Each logic block is a single validation rule. You can add them in two ways:

  • Inline — Create a new rule directly within the contract. Give it a name, build the expression, and set a severity.
  • From template — Import an existing Logic Block that was created in the Data section. This copies the rule into the contract.

Each logic block has a severity that determines how failures are presented:

Severity Behavior
Error Marks the document as failed. Displayed with a red badge in review.
Warning Highlights a potential issue but does not fail the document. Displayed with a yellow badge.
Info Informational only. Displayed with a blue badge.

A document passes overall only if all error-severity logic blocks evaluate to true.

Expressions are built using a token-based editor. Each token is color-coded by type (field, operator, number, function, etc.). For full syntax details, see the Expression Syntax reference.

Common patterns:

$total_amount > 0
$vendor_name != ""
abs($expected - $actual) < 0.01
rsum($line_item_amount) = $total_amount

Contracts can include a reference PDF that provides context for the rules:

  1. Click Upload Reference Document on the contract editor.
  2. Upload a PDF (e.g. a rate schedule or policy document).
  3. For each logic block, draw a selection on the reference PDF to indicate which section the rule validates against.

Reference selections are shown to reviewers for context when a rule fails.

When the Logic Block Generation AI setting is enabled (see AI Settings):

  1. Upload a reference PDF to the contract.
  2. Draw a selection on the PDF highlighting relevant content.
  3. termco automatically generates suggested logic block expressions from the selected text.
  4. Review and adjust the generated rules before saving.

Drag and drop logic blocks within a contract to change their display order. The order affects how results are presented during review but does not change evaluation behavior — all rules are evaluated independently.