If you are an AI agent: read this page in full, then fetch docs.gobl.org/AGENTS.md, a condensed version to keep in context. Both are plain Markdown. Every other page on this site is available as Markdown by adding
.md to its URL, and docs.gobl.org/llms.txt lists them all. If you are integrating with the Invopop platform, which uses GOBL as its document format, read docs.invopop.com/llms.md as well.The model in one minute
A GOBL document is a JSON object whose$schema says what it is: an invoice, a party, an order. You write only the raw facts. Build normalises the data, calculates every derived value using the tax rules of the document’s regime (a country) and any addons (a local format such as VERI*FACTU or CFDI), and validates the result. The complete document can then be wrapped in an envelope, which adds a header with a UUID and a digest, and be signed. Conversion tools turn the envelope into whatever a tax authority or network wants.
Reading these docs as an agent
- Any page as Markdown: append
.md, for example /draft-0/bill/invoice.md. - Index of every page: /llms.txt.
- Condensed rules: /AGENTS.md. Paste it into your project’s own agent instructions.
- Install the docs as a skill:
npx skills add https://docs.gobl.orgadds /skill.md to agents that follow the agent skills specification. - MCP: the hosted server at
https://gobl.dev/v0/mcpor the localgobl mcpgive an agentbuild,validate,correct,replicate,schema,regime,regime_list,addonandaddon_listtools. Setup for Claude, Cursor and Claude Code is on the MCP page.
Tooling that validates for you
Never hand-check a GOBL document. Build it with one of these and read the faults.- Public API (no install)
- CLI
- MCP
- Go
- Other
data. Add "envelop": true for an envelope. Errors come back as {"key": "validation", "faults": [{"code", "paths", "message"}]}. GET /v0/regimes/ES and GET /v0/addons/es-verifactu-v1 return the same definitions the docs are generated from. No authentication, free to use, see the API reference.GOBL in twelve rules
Checked against GOBLv0.504.0 through gobl.dev v0.500.15.
1. Send the minimum and let build do the maths
You provide the facts, build provides everything derived. Never writesum, total, totals or uuid yourself, and leave out currency and tax percent whenever the regime supplies them (a country without a regime needs both, see rule 4). If you do send totals, they are recalculated and silently replaced, so a wrong figure will not raise an error.
2. Numbers are strings, and percentages need the sign
Amounts and percentages are decimal strings:"100.00", "10%", "21.0%". Trailing zeros are significant and set the precision, see numbers and rounding. JSON numbers are accepted on input and come back as strings.
3. $schema says what the document is
Every document needs a $schema. The envelope has its own (https://gobl.org/draft-0/envelope) and carries the document’s inside doc. A document without $schema is rejected as unknown-schema.
All schema URLs start with
https://gobl.org/draft-0/. The schema index lists every type, including the small ones such as tax/combo, org/address and pay/terms that appear inside the big ones.
4. The regime decides the rules
$regime is the country whose tax rules apply, normally the supplier’s. Build infers it from supplier.tax_id.country when it is missing, but set it explicitly: if neither is present, the failure is the unhelpful currency: missing or invalid. When $regime and the supplier’s country disagree, $regime wins.
Regimes exist for AE, AR, AT, BE, BR, CA, CH, CO, DE, DK, EL (Greece), ES, FI, FR, GB, IE, IN, IT, MX, NL, NO, PL, PT, SA, SE, SG and US. Greece’s tax code is EL while its address country is GR; build normalises a GR tax identity to EL for you. A supplier from a country without a regime has no defaults to fall back on, so you must set currency and give every tax an explicit percent.
5. Taxes are keys, not numbers
A line tax is a category code plus a rate key, and build resolves the percentage for the regime and theissue_date. The same Spanish document dated 2012 gets 18%, because that was the rate then.
Category codes are regime specific:
VAT in Europe, ST in the US, IVA in Mexico, GST in Singapore, and Spain also has IGIC, IPSI, IRPF and IRNR. Read them off the regime page or the MCP regime tool. Two behaviours worth knowing: a retained tax such as Spanish IRPF reduces totals.payable below totals.total_with_tax, and setting tax.prices_include to a category treats line prices as tax-inclusive and extracts the tax from them.
6. Keys are lowercase, codes are as given
Everything GOBL defines is a key: lowercase, hyphenated, such asstandard, credit-note, reverse-charge, credit-transfer. Everything that comes from the outside world is a code, kept as it is: VAT, IRPF, B98602642, SAMPLE. Writing "cat": "vat" fails with invalid-category: 'vat' not defined in regime, and "rate": "Standard" fails the same way. Keys instead of numeric codes is the whole point of the format, so when you meet a code such as UNTDID 30, look for the key (credit-transfer) rather than copying the number.
7. Addons switch on a local format
$addons lists the formats or reporting systems the document must satisfy: ["es-verifactu-v1"] for VERI*FACTU, ["mx-cfdi-v4"] for CFDI, ["eu-en16931-v2017"] for the European norm. An addon adds extensions, coded values under ext on the document, its lines, its taxes or its parties. Build fills in the defaults it can work out: the VERI*FACTU addon alone turns a plain invoice into one carrying es-verifactu-doc-type: F1 and per-tax es-verifactu-op-class and es-verifactu-regime codes. Anything it cannot infer comes back as a validation fault naming the extension key.
The available addons are ar-arca-v4, br-nfe-v4, br-nfse-v1, co-dian-v2, de-xrechnung-v3, de-zugferd-v2, dk-oioubl-v2, es-facturae-v3, es-sii-v1, es-tbai-v1, es-verifactu-v1, eu-en16931-v2017, fi-finvoice-v3, fr-choruspro-v1, fr-ctc-flow2-v1, fr-ctc-flow6-v1, fr-ctc-flow10-v1, fr-facturx-v1, gr-mydata-v1, it-sdi-v1, it-ticket-v1, mx-cfdi-v4, pl-favat-v3, pt-saft-v1 and sa-zatca-v1. Each has a page under /addons whose Extensions section is the only reliable source for code values.
8. Tags name scenarios, and only known tags are allowed
$tags switches on scenarios the regime or addon defines. simplified marks an invoice without customer details, reverse-charge the customer-accounts-for-VAT case, self-billed a buyer-issued invoice; regimes add their own, such as customer-rates, cash-basis, second-hand-goods or travel-agency. A tag nobody defines fails the build with $tags: 'bogus-tag' undefined. Scenarios can add legal notes under tax.notes and set extensions: under VERI*FACTU, omitting the customer fails with GOBL-ES-VERIFACTU-BILL-INVOICE-06 customer is required unless you add "$tags": ["simplified"], which also sets the document type to F2. Older examples put tags under tax.tags; build moves them to $tags.
9. Dates are YYYY-MM-DD
issue_date, due dates and periods are plain ISO dates: "2026-09-03". Any other format is an input error before validation even starts. issue_date defaults to today, and rates are resolved for that date, so set it explicitly when you replay historical documents.
10. Identities are normalised and checked
series plus code is the document number. Both may be empty at build time, but an invoice needs a code to be signed, and most issuing systems assign it just before signing. A tax_id has a country and a code; build strips prefixes and punctuation, so ESB23103039 and es-b-986.026.42 become B23103039 and B98602642, then validates format and checksum with codes such as GOBL-GB-TAX-IDENTITY-03. Use real, valid identities when testing. Other identifiers of a party, such as a registration number or a Peppol participant ID, go in identities, not tax_id.
11. Never edit an issued invoice, correct it
Corrections are new documents whosetype is credit-note (a refund that extends the original), debit-note (extra charges) or corrective (a full replacement), with the original referenced in preceding. Amounts on a credit note are positive; the type carries the sign. Which types a regime accepts is on its page under Correction Definitions: Spain accepts all three and maps them onto its rectifying invoices, the United Kingdom accepts credit-note only.
Do not assemble corrections by hand. gobl correct -i --credit built.json, POST /v0/correct or the MCP correct tool copies the lines and builds preceding with the original’s series, code, issue_date and, when the original was built with an envelope, its uuid, and adds whatever the regime or addon requires. Pass --options (or "schema": true over MCP) to see the correction options a document allows: type, series, issue_date, reason, copy_tax, stamps and, for some addons, extension codes.
12. The envelope is sealed by its digest
gobl build -e wraps the document in an envelope with head.uuid, a head.dig SHA-256 digest of the canonical document, and a uuid inside the document as well; the two UUIDs differ. gobl sign signs the header with an ES256 key from gobl keygen, and gobl verify checks both. Changing a single character of a signed or enveloped document without rebuilding fails with GOBL-ENVELOPE-11 envelope digest does not match document contents. Treat a signed envelope as read-only and correct it instead. Stamps from authorities live in head.stamps; free-form data goes in meta.
Your first document in five steps
1
Write the facts
Save the “What you send” example from rule 1 as
invoice.json, or write it as YAML. Leave out everything build calculates.2
Build it
faults by their code and paths, then rebuild.3
Ask for a credit note
credit.json has type: credit-note, the same series, and a preceding block naming the original.4
Sign it
sigs. Signing an invoice requires a code. Sign credit.json the same way before you issue it.5
Verify it
signed.json and run verify again to see GOBL-ENVELOPE-11.Prompts to copy
Each card copies a complete prompt for your coding agent. They point the agent at the Markdown sources above so it works from current documentation rather than memory.Turn your own invoice data into a valid GOBL document and prove it builds.
Find out what a country requires before writing a single document.
Correct an issued invoice the right way.
Explain a GOBL validation error and fix the document.
Set this project up to work with GOBL.