# Structura: Invoices and Receipts to Validated JSON

> Turns invoices, receipts and bank statements into schema-valid JSON where every field cites its source text, and a deterministic validator refuses anything that does not reconcile.

Structura: Invoices and Receipts to Validated JSON is a paid AI agent skill on Agensi by Owadokun Tosin. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [Owadokun Tosin](https://www.agensi.io/creators/tosinowadokun)
- Version: 0.1.0
- Last updated: 2026-12-05
- Security: scan passed (2026-12-05); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/structura-invoices-and-receipts-to-validated-json
- Tags: finance-accounting, data-databases

## What it does

- Turns an invoice, receipt or bank statement into JSON
- Quotes the exact source text behind every value
- Checks totals, types and dates before returning anything
- Refuses the document when the numbers do not reconcile
- Leaves a field empty instead of guessing a value
- Works on text your agent has already extracted

## Who it's for

- **Bookkeepers importing supplier invoices:** Turns each invoice into JSON with a quote for every number, so an import can be traced back. Try: "Turn this invoice into validated JSON for my ledger import"
- **Freelancers filing expense receipts:** Converts a receipt into fixed-schema JSON and flags any total that does not reconcile. Try: "Extract this receipt and tell me if the total adds up"
- **Auditors checking extracted figures:** Shows the source line behind every value and refuses records that fail the arithmetic check. Try: "Extract this statement and show where each balance came from"
- **Developers building document imports:** Outputs schema-valid JSON with evidence spans, so an import fails loudly instead of quietly. Try: "Convert this receipt to JSON that passes validation"

## About this skill

Structura turns one messy document into JSON you can act on — and proves it
field by field.

Every non-null value must quote the exact text it came from, and a small
deterministic script checks each quote against the source before anything
reaches you. Types, enums, dates and totals are checked too. If the numbers
don't reconcile, you get a refusal with reasons instead of a plausible-looking
guess.

Most extraction tools return JSON that looks right. Structura is built for the
case where looking right is not enough: bookkeeping imports, expense claims,
audits, anything where someone will ask "where did this number come from?"

Five schemas ship: invoices with tax-exclusive lines, invoices with tax-inclusive
lines, receipts in both forms, and a bank statement schema that checks every row
chains from the opening to the closing balance.

It works on text. It does not parse PDFs or images itself — your agent reads the
file and hands the text over. The protocol is harness-agnostic: any agent that
can read a file and run a Python script follows the same steps.

## Requires

- Python 3.9+

## Known limitations

- **Text only.** No PDF or image parsing, no OCR. Your agent reads the file; the
  skill validates the text.
- **Five schemas.** Invoices, receipts and bank statements, each in the tax form
  that suits it. Other document types are refused at routing rather than guessed.
- **Provenance, not truth.** Every value is traceable and internally consistent.
  That is not the same as correct: a document that is itself wrong will be
  extracted as printed.
- **One document per run.** No multi-page stitching.
- **Refusal is a valid outcome.** When totals cannot reconcile, the skill reports
  the failure instead of the data.
- **Tested harnesses.** Exercised end to end on DSH subagents and OpenCode 2.4.4 —
  the pass, fail and refusal paths, an illegible scan, and a document carrying
  injected instructions. Compatibility comes from the protocol, not the harness:
  it needs a file read and a standard-library Python script, both of which the
  agent already provides.

## Technical details

Structura is a protocol plus a single standard-library Python script.

Your agent reads the document text, routes it to one of five schemas (invoice with tax-exclusive or tax-inclusive lines, receipt in both forms, bank statement), extracts each value with the quote and character span it came from, and normalises the value without touching the quote.

The validator takes one JSON envelope on stdin — source, schema, data, evidence — and returns a report on stdout. It checks each quote against the source, then types, enums, dates, required fields and the schema's arithmetic invariants. On failure the agent may repair only the failing paths, twice, then it refuses.

Runs on Python 3.9+ (verified on 3.9.25 and 3.12). No installs, no network, no environment variables, no files written. Exercised end to end on DSH subagents and OpenCode 2.4.4.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Structura: Invoices and Receipts to Validated JSON skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### Can it read a scanned PDF?

Not by itself. If your agent can read the text layer, send that. If the text is illegible, it says so and asks for a rescan rather than guessing.

### What does "unverifiable" mean?

The document could not support a checked result — no text layer, illegible text, or the validator could not run. It is different from "fail", which means the extraction ran and the arithmetic did not reconcile.

### Does it send my documents anywhere?

No. The script makes no network calls and reads no environment variables. Your agent handles the document; the validator only sees the text you pass it.

### Why are some fields null?

Because the document did not state them, or stated them ambiguously. A null is deliberate: it is the skill refusing to invent. The result notes when a rule, such as a two-digit year, caused a null.

### What if my totals don't add up?

You get a failure listing the exact check, for example "line items sum to 100.00, total says 107.50". That is usually a missing line, a misread digit, or a document that is genuinely inconsistent.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
