Skip to content

Teach the template from a loan document

POST
/v1/extraction-templates/corrections
curl --request POST \
--url http://localhost:8080/v1/extraction-templates/corrections \
--header 'Content-Type: application/json' \
--data '{ "documentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "pageNo": 1, "box": { "x": 1, "y": 1, "w": 1, "h": 1 }, "field": "example" }'

Takes documentId, pageNo, box and field: reads the box on that loan document, turns it into the region rule for that field of the document’s type, replaces any earlier rule for the field, saves the overlay, and returns the rule with the value it reads on this document. The loan itself is unchanged until it is reprocessed. 400 for an unclassified document or an empty box. Administrators only.

Media typeapplication/json

Body of POST /v1/extraction-templates/corrections: a box drawn on a loan document’s page, naming the field it holds.

object
documentId
string format: uuid
pageNo
integer | string format: int32
/^-?(?:0|[1-9]\d*)$/
box
One of:
null
field
string
Examplegenerated
{
"documentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"pageNo": 1,
"box": {
"x": 1,
"y": 1,
"w": 1,
"h": 1
},
"field": "example"
}

OK

Media typeapplication/json

A correction applied: the document type it taught, the rule saved for it, the value that rule reads on this document, and the overlay as saved.

object
docType
required
string
rule
required

One declarative extraction rule; the serialised form of the engine’s rule types. string TemplateRuleSpec.Type is one of TemplateRuleTypes; string? TemplateRuleSpec.Pattern/string? TemplateRuleSpec.ValuePattern are.NET regexes and a sentence pattern must capture the value as (?<v>…). A region rule; the studio’s point-and-name mapping; carries the int? TemplateRuleSpec.Page and BoundingBox? TemplateRuleSpec.Box that was drawn (page fractions, origin top-left) and the RegionAnchor? TemplateRuleSpec.Anchor label the engine follows when the page shifts.

object
field
required
string
type
required
string
label
null | string
pattern
null | string
valuePattern
null | string
requireBold
boolean
default: true
page
null | integer | string format: int32
/^-?(?:0|[1-9]\d*)$/
box
One of:
null
anchor
One of:
null
value
required
One of:
null
overlay
required
Example
{
"rule": {
"requireBold": true
}
}