Fiscal rules
143 fiscal and VeriFactu rules for invoicing integrations, as pages and as data for your AI assistant, the MCP server or CI.
A set of 143 rules your invoicing integration has to follow, as data your AI agent can check your code against. Each one comes from the law, from AEAT or from BeeL., has a stable id (LIF-001), says who checks it, and lists the errors the API answers when it catches it. The guides explain how to do things; these pages say what must and must not happen.
Use the rules in your tools
In Claude Code, install the BeeL. plugin and ask it for a rule:
/plugin marketplace add beel-es/claude-plugins
/plugin install beel-api@beel
/beel-api:rules COR-002With the BeeL. MCP server (shown for Claude Code; other clients), add it and ask in plain words. Its rules tools answer, and a failed call names the rule behind its error:
claude mcp add --transport http beel https://mcp.beel.es/mcpWhich BeeL. rules apply to voiding an invoice, and which are up to my integration?In any AI assistant (Cursor, Copilot, ChatGPT…), paste this prompt, or keep the critical rules in every session with the AGENTS.md block:
Review my BeeL. integration against https://docs.beel.es/api/rules.json
and list every rule it breaks, with its id and the fix.In your CI, read the catalogue as JSON (its format):
curl -s https://docs.beel.es/api/rules.jsonEach rule is also Markdown at /rules/<ID>.md (for example /rules/LIF-001.md), and all of them are in /rules/llms-full.txt.
How to read a rule
- Severity. Required or Recommended.
- Source. Law and AEAT criterion quote the norm verbatim, with its link. BeeL. rule is how BeeL.'s API works.
- Error codes. What the API answers when it catches the rule. Each one links to its page.
What each responsibility asks of you
| Responsibility | What you do |
|---|---|
Checked by the API (api) | Handle the error codes the rule lists: the API rejects the request or applies the rule for you. |
Checked by AEAT (aeat) | Track the invoice's submission status. See Handling rejections. |
Your integration (integrator) | Meet it in your code, and check it in review and tests. See Software built on the API. |
The issuing business (issuer) | A decision of the business that issues the invoice: your integration can ask for it or show it. See The issuing business. |
All rules
143 of 143 rules
- LIF-001RequiredAn issued invoice is never edited or deleted
- LIF-002RequiredOnly a draft can be issued
- LIF-003RequiredTest in the sandbox, never with real invoices
- LIF-004RecommendedRetry writes with the same Idempotency-Key
- LIF-005RequiredDuplicating an invoice creates a new one, not a copy
- VOI-001RequiredVoid only an invoice that should never have been issued
- VOI-002RequiredVoid an issued invoice through the void operation; delete a draft
- VOI-003RequiredA void adds a cancellation record; the original stays
- VOI-004RequiredA sent or paid invoice is voided only confirming it was issued by mistake
- VOI-005RequiredA corrected invoice, or a total corrective, is not voided
- COR-001RequiredWrong data on an issued invoice is fixed with a corrective
- COR-002RequiredPick the reason code: R1–R4 for standard invoices, R5 for simplified
- COR-003RequiredA corrective shows the difference or the amounts after the correction
- COR-004RequiredThe corrective record says whether it substitutes or adds a difference
- COR-005RequiredA corrective identifies the invoice it rectifies
- COR-006RequiredIssue the corrective as soon as you know, within 4 years
- COR-007RequiredA wrong corrective is fixed against the original, not corrected itself
- COR-008RequiredA bad-debt corrective (R3) needs the legal conditions first
- COR-009RequiredAn insolvency corrective (R2) needs a declaration of insolvency
- COR-010RequiredA provisional price is rectified once the final one is known
- COR-011RequiredDiscounts and rebates granted after the sale go on a corrective
- COR-012RecommendedReturns can be netted only on a later supply to the same customer
- COR-013RequiredA corrective is only for the causes the law lists
- COR-014RequiredA corrective keeps the operation date of the original
- COR-015RequiredDo not raise the VAT charged to a consumer through a corrective
- COR-016RequiredSome unpaid debts never allow an R2 or R3 corrective
- COR-017RequiredA corrective keeps the recipient, except to correct the recipient's data
- COR-018RequiredA corrective can always correct what the original declared
- COR-019RequiredInsolvency and bad-debt correctives need a recipient established in Spain
- COR-020RequiredA bad-debt corrective waits six months and needs a business recipient under 50 €
- COR-021RecommendedAn identical corrective a moment after another is taken as a double submission
- COR-022RequiredAn invoice whose record AEAT rejected is fixed before it is corrected
- COR-023RequiredA corrective never rectifies more than was invoiced
- COR-024RequiredA corrective does not change only the withholding
- NUM-001RequiredThe number is assigned when the invoice is issued
- NUM-002RequiredAn issued number is never reused, even when the invoice is voided
- NUM-003RequiredNumbers are correlative within each series
- NUM-004RecommendedSeparate series may be used when there is a reason for them
- NUM-005RequiredSimplified invoices are numbered in their own series
- NUM-006RequiredCorrective invoices are numbered in their own series
- NUM-007RequiredA series cannot be renumbered once it has issued
- NUM-008RequiredAn invoice number fits AEAT's length and character set
- NUM-009RequiredReverse-charge supplies of metals and electronics go in a special series
- CNT-001RequiredEvery operation of the business is invoiced, exempt ones included
- CNT-002RequiredA business customer always gets an invoice, identifying it when asked
- CNT-003RequiredA full invoice names both parties by their legal name
- CNT-004RequiredEvery invoice shows the issuer's NIF
- CNT-005RequiredA full invoice identifies the recipient by NIF
- CNT-006RequiredA full invoice shows the address of both parties
- CNT-007RequiredEach line describes the operation, its unit price and any discount
- CNT-008RequiredThe tax rate and the tax amount are shown apart from the base
- CNT-009RequiredThe base is broken down by rate and by kind of operation
- CNT-010RequiredAn exempt operation states why it is exempt
- CNT-011RequiredOnly one original of each invoice exists
- CNT-012RequiredA reverse-charge invoice carries the mention «inversión del sujeto pasivo»
- CNT-013RequiredA cash-basis invoice carries the mention «régimen especial del criterio de caja»
- CNT-014RequiredA used-goods, art or antiques invoice carries its regime mention
- CNT-015RequiredA travel-agency invoice carries the mention «régimen especial de las agencias de viajes»
- CNT-016RequiredAn intra-EU supply of a new means of transport describes the vehicle
- CNT-017RecommendedAn invoice may be in any language
- CNT-018RequiredInvoices go by email only with the recipient's consent
- CNT-019RequiredOnly a corrective invoice totals less than zero
- CNT-020RecommendedA Spanish recipient's NIF is in the AEAT census
- CNT-021RequiredA recipient without a Spanish NIF is identified by an alternative id
- CNT-022RequiredInvoices to Spanish public administrations are electronic
- CNT-023RequiredSome operations are always invoiced, whoever the customer
- CNT-024RequiredA duplicate for several recipients shows each one's share
- CNT-025RequiredState the establishment when it decides how the operation is taxed
- SIM-001RequiredA simplified invoice never exceeds 3,000 €
- SIM-002RequiredAbove 400 €, a simplified invoice needs an art. 4.2 activity
- SIM-003RequiredSome operations can never go on a simplified invoice
- SIM-004RequiredA simplified invoice still carries its minimum contents
- SIM-005RequiredThe record of a simplified invoice carries no recipient
- SIM-006RequiredAn identified customer gets a standard invoice (F1)
- SIM-007RequiredExchanging a simplified invoice for a full one
- SIM-008RequiredA simplified invoice carries the same legal mentions as a full one
- SIM-009RequiredA customer who asks to be identified gets an invoice that identifies it
- SIM-010RequiredA simplified invoice with several VAT rates shows the base of each
- TAX-001RequiredApply the VAT rate in force when the operation took place
- TAX-002RequiredReverse-charge operations are invoiced without charging VAT
- TAX-003RequiredReverse-charge lines carry no tax and never go on a simplified invoice
- TAX-004RequiredIntra-EU supplies of goods are exempt only with the buyer's EU VAT number
- TAX-005RequiredExempt and non-subject lines carry no VAT rate
- TAX-006RequiredServices to a business abroad are not subject to Spanish VAT
- TAX-007RequiredSales declared through OSS use regime key 17
- TAX-008RequiredDisbursements go as SUPLIDO lines, without tax
- TAX-009RequiredIRPF withholding is not part of the total AEAT receives
- TAX-010RecommendedSet the IRPF withholding when the customer must withhold
- TAX-012RequiredThe tax and the billing record are expressed in euros
- TAX-013RequiredSend every amount in euros
- TAX-014RequiredOnly the VAT rates AEAT accepts on the operation date
- TAX-015RequiredRegime key 08 means not subject to the line's tax
- TAX-016RequiredRegime keys 03, 06 and 14 are not accepted
- TAX-017RequiredSpecial regime keys carry the classification AEAT requires
- TAX-018RequiredAn issued invoice does not use the intra-EU acquisition exemption
- TAX-019RequiredAn issuer that is not an individual never bears the IRPF rates of individuals
- TAX-022RequiredReduced withholding rates of Ceuta and Melilla derive from their base rate
- SUR-001RequiredThe surcharge rate matches the VAT rate of its line
- SUR-002RequiredSupplies with the surcharge go on separate invoices
- DAT-001RequiredDo not send an issue date
- DAT-002RequiredThe issue date is the day the billing record is generated
- DAT-003RequiredThe operation date is never after the issue date nor over twenty years old
- DAT-004RequiredSend the operation date when it differs from the issue date
- DAT-005RequiredInvoice consumers when the operation takes place
- DAT-006RequiredInvoice businesses before day 16 of the following month
- DAT-007RequiredOne invoice for a month of operations, issued in time
- DAT-008RequiredDeliver the invoice to the customer in time
- DAT-009RequiredVAT is charged by invoice within 1 year of accrual
- DAT-010RequiredInvoice advance payments when you receive them
- DAT-011RequiredAdapted billing systems are mandatory from 1 January 2027 or 1 July 2027
- DAT-012RecommendedPlan for mandatory B2B electronic invoices
- DAT-013RequiredIntra-EU supplies of goods are invoiced by the month after transport starts
- DAT-014RequiredUnder the cash-basis regime, the deadline runs from the operation, not the payment
- QRC-001RequiredEvery invoice carries the tax QR code
- QRC-002RequiredWait for the QR before you distribute the PDF
- QRC-003RequiredThe QR measures between 30 mm and 40 mm
- QRC-004RequiredThe QR follows ISO/IEC 18004 with error correction M
- QRC-005RequiredUse qr_url exactly as returned
- QRC-006RequiredThe VeriFactu legend goes just below the QR
- QRC-007Required«QR tributario:» goes just above the QR
- QRC-008RequiredThe QR goes once, at the start of the first page
- QRC-009RequiredKeep a blank margin around the QR
- QRC-010RequiredA structured e-invoice carries the QR URL as a field
- REC-001RequiredEach issued invoice gets a billing record built from its data
- REC-002RequiredThe record goes to AEAT as soon as the invoice is issued
- REC-003RequiredVERI*FACTU is kept until the end of the year
- REC-004RequiredBeeL. generates the hash and the chain
- REC-005RequiredOne chain per NIF, one company per NIF
- REC-006RecommendedNo certificate is needed to sign records
- REC-007RequiredKeep invoicing when AEAT is unreachable
- REC-008RequiredFollow submission_status and fix what AEAT rejects
- REC-009RequiredCheck the data AEAT accepted with errors
- REC-010RequiredSubsanación is only for errors that need no corrective
- REC-011RequiredThe NIF holder signs the AEAT representation first
- REC-012RequiredTax amounts are base times rate
- REC-013RequiredAn invoice AEAT would reject is not numbered
- CON-001RequiredKeep copies of issued invoices for the limitation period
- CON-002RequiredAEAT keeps the records, not your invoices
- CON-003RequiredExport your invoices before leaving
- CON-004RequiredInvoices kept electronically are reachable on request
- SAN-001RequiredDo not hold non-compliant or altered billing software
- SAN-002RequiredInvoicing breaches are fined in proportion to the operations
- SAN-003RequiredA substantial breach doubles the invoicing fine
By domain
Invoice lifecycle
5 rules. What can happen to an invoice before and after it is issued: editing, issuing, duplicating, testing and retrying.
Voiding
5 rules. When an issued invoice can be voided, how, and what a void leaves behind.
Corrective invoices
24 rules. When an issued invoice has to be rectified, with which reason code, how the correction is shown and within which deadline.
Numbering and series
9 rules. How invoice numbers are assigned, which documents need their own series, and why a number is never reused.
Invoice contents
25 rules. What every invoice has to say: when one is due, who the parties are, how operations and taxes are shown, and the mentions some operations require.
Simplified invoices
10 rules. When a simplified invoice (F2) may replace a full one, what it must carry and what it can never document.
Taxes and exemptions
19 rules. How each line is taxed: VAT rates, reverse charge, exempt and non-subject operations, OSS, disbursements, IRPF and the currency amounts are expressed in.
Equivalence surcharge
2 rules. When a supply to a retailer carries the equivalence surcharge (*recargo de equivalencia*), at which rate, and on which invoice.
Dates and deadlines
14 rules. The dates an invoice carries and the deadlines for issuing it, sending it and charging its VAT.
QR code and PDF
10 rules. The tax QR code on every invoice: when it exists, what it encodes, and how any document that carries it presents it.
VeriFactu records
13 rules. The billing record behind each invoice under VeriFactu: how it is generated, chained and sent to AEAT, and what to do with AEAT's answer.
Conservation
4 rules. How long issued invoices and their records are kept, by whom, and what to export before changing systems.
Sanctions
3 rules. The fines the General Tax Law sets for invoicing breaches and for billing software that does not comply.