Template id: extraction-qa-invoice
| Key | Type | Check | Judge tier |
|---|---|---|---|
valid_extraction_shape | must_have | json_schema@1 | None |
invoice_number_format | must_have | regex_match@1 | None |
total_is_positive | must_have | numeric_threshold@1 | None |
matches_source_document | scored | llm_judge@1 | 2 |
{
"name": "extraction-qa-invoice",
"criteria": [
{
"key": "valid_extraction_shape",
"type": "must_have",
"primitive": "json_schema@1",
"config": {
"schema": {
"type": "object",
"required": [
"invoice_number",
"issue_date",
"total",
"currency",
"line_items"
],
"properties": {
"invoice_number": {
"type": "string"
},
"issue_date": {
"type": "string",
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
},
"total": {
"type": "number"
},
"currency": {
"enum": [
"USD",
"EUR",
"GBP"
]
},
"line_items": {
"type": "array",
"minItems": 1
}
}
}
}
},
{
"key": "invoice_number_format",
"type": "must_have",
"primitive": "regex_match@1",
"config": {
"pattern": "INV-[0-9]{4,8}"
}
},
{
"key": "total_is_positive",
"type": "must_have",
"primitive": "numeric_threshold@1",
"config": {
"path": "$.total",
"operator": "gt",
"threshold": 0
}
},
{
"key": "matches_source_document",
"type": "scored",
"primitive": "llm_judge@1",
"judge_tier": 2,
"weight": 3,
"config": {
"required_trust_tier": "reference-backed",
"instruction": "Every extracted field value must appear in (or be directly computable from) the source invoice text in the references. Score the fraction of fields that match the source."
}
}
]
}Send this JSON as the body of POST /v1/rubrics. The API also serves starters from GET /v1/rubrics/templates.
**Judges:** structured data extracted from an invoice — schema-valid, well-formed identifiers, positive totals (all deterministic), and field-level fidelity to the source document (judged against references). **Use when:** an LLM/OCR pipeline extracts financial documents and silent transcription errors cost real money (AP automation, expense ingestion, billing reconciliation).
Save the Rubric JSON shown above as rubric.json.
curl -s -X POST $API/v1/rubrics -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d @rubric.json
# typed roles: the extraction JSON is the output; the source invoice text travels as context
curl -s -X POST $API/v1/verify -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"rubric_id":"<id>","submission":{"output":"{\"invoice_number\":\"INV-48213\",...}","context":[{"label":"doc-1","value":"INVOICE INV-48213 dated 2026-05-14. Total due USD 1,250.50."}]},"options":{"wait_ms":45000}}'MCP: `verify_submit` with the extraction JSON as `output` and the source document text as `context` so `matches_source_document` has ground truth. The legacy `submission.inline` shape still works unchanged.