Skip to content
Talk to our solutions team

Rule API reference

This reference covers what a rule can call, and nothing else. If a name is not on these pages, rule text cannot reach it.

That boundary is the point of the section. The engine is a library, and most of its surface exists for the program that embeds it — constructing an engine, loading rule sets, reading a result object. None of that is available inside a when or a then. You write GRL; this is the GRL-visible API.

NameWhat it isReference
your factsEvery top-level key of the input, bound under its own nameWriting rules
inGuard-free reads of those facts, with defaultsin — reading facts
outThe output collector. What it holds is the resultout — writing results
findingsSeverity-graded validation resultsFindings
auditAppend-only decision trailBuilt-in functions
bboxThe document surface, when the run carries a documentbbox — documents
toConversion between the types a rule handlesto — conversion
stringsText: case, regex, phrase counting, line locationstrings — text
map, arrayCollections, since the language cannot index onemap and array
num, math, timeArithmetic, ranges and datesnum, math, time
vocabNamed phrase lists and lookup tablesvocab
logLog lines — Debug, Info, Warn, ErrorBuilt-in functions
deliveryOutput shaping — ExplodeColumnIncluded plugins

Every one of the 337 callable methods across these is documented, with its parameters and a rule that uses it.

Two verbs are bound with no namespace:

CallEffect
Retract("RuleName")Removes a rule from the pool for the rest of this execution. Optional — a rule is retracted automatically after it fires
Complete()Ends the execution immediately, keeping everything written so far

A document arrives as bbox, and everything a rule does with it starts at bbox.Doc():

bbox.Doc().Top(20).Has("INVOICE")
bbox.Doc().Right("Loan Amount").Currency()
TypeReached byReference
Docbbox.Doc(), and every scope call on itDocument
ValueA directional read, a cell, a coercionValues
Table, Rowbbox.Doc().Table(), .TableWith(text)Tables and forms
Rowsbbox.Doc().Rows(start, end)Tables and forms
Formbbox.Doc().Form(name)Tables and forms

Matching through this surface is fuzzy and case-insensitive by default. You do not configure it; you opt out with Exact() or MatchCase() when a near-miss would be wrong. See the Document API guide for why.

Every entry names what a rule gets back, because that is what decides whether the call is usable at all:

ReturnsWhat a rule can do with it
bool, number, stringUse it directly, in a when or as an argument
DocKeep chaining scopes and verbs
ValueCoerce it, or ask whether it was found
Table / Row / Rows / FormKeep calling that type’s methods
A list or mapOnly .Len(). GRL cannot index or iterate one — pass Records() straight to out.Set
Two valuesNothing. The grammar rejects a call that returns a value and an error

That last row catches people. A method returning a value and an error is not callable at all; the failure is calling function <Fn> which … returns multiple values.

Not documentedWhyWhere it is
Engine construction, rule-set loading, result objectsNot reachable from rule textThe library’s own source
Word boxes, lines, reading order, table detectionAnalysis that happens before your rule runsThe document model
hOCR ingest and the .bbox formatInput preparation, not a rule callOCR input
Fuzzy scoring internalsA property of the surface, not a knobThe Document API