Numbering and series
How invoice numbers are assigned, which documents need their own series, and why a number is never reused.
An invoice number is fiscal data: it is assigned once, at issue, and it identifies the invoice in AEAT's records for good. These rules cover who assigns it, which documents go in separate series, and what a number may look like.
9 rules: 5 from the law, 2 AEAT criteria, 2 BeeL. rules. How to read a rule.
The number is assigned when the invoice is issued
Do not expect or send an invoice number: a draft has none, and BeeL. assigns the next number of the chosen series when the invoice is issued. Read invoice_number from the response of the issue call.
- Why
- Numbering at issue is what keeps the series free of gaps: a draft deleted before issuing never consumed a number.
- Responsibility
- Checked by the API: BeeL. applies it.
- Applies to
- Statuses
DRAFTSCHEDULEDISSUEDOperationsissueCompanyInvoicecreateCompanyInvoice
Storing the draft's id as the invoice number in your system, or computing the next number yourself before issuing.
Issuing the draft and saving the invoice_number the issue call returns.
POST /v1/companies/{company_id}/invoices/{invoice_id}/issueAn issued number is never reused, even when the invoice is voided
Treat every issued number as consumed for good. A voided invoice, or a test issued in production, keeps its number in the series; the invoice that replaces it gets a new one. BeeL. never gives two invoices of a company the same number: a series whose format could print the numbers of another series of the company is rejected with SERIES_FORMAT_OVERLAPS. If AEAT already holds a record with the same number and issue date that is not this invoice, for example one issued with the software you used before, the invoice is not registered: its verifactu.submission_status is REJECTED, and it has to be issued again with a different series or number.
- Why
- The number identifies the invoice in AEAT's records. A second invoice with the same number would be a duplicate that AEAT does not accept.
- Responsibility
- Checked by the API: a request that breaks it is rejected with the error codes listed.
- Applies to
- Statuses
ISSUEDSENTPAIDRECTIFIEDVOIDEDOperationscreateCompanySeriespatchCompanySeriesissueCompanyInvoice - Error codes
SERIES_FORMAT_OVERLAPS409,SERIES_NUMBER_COLLISION400
Legal basisAEAT, Preguntas frecuentes SIF y VERI*FACTU, Registros de facturación: anulación · AEAT, Aclaraciones a dudas de los desarrolladores (v1.3), 6. Prohibición de numeración duplicada de un registro
«Desde el punto de vista sustantivo, si las facturas se han emitido, aunque sean erróneas deben mantenerse, con su correspondiente numeración, y sin perjuicio de que se anulen posteriormente y se sustituyan por nuevas facturas correctas.»«ya NO es posible reutilizar la numeración de ninguna factura expedida, aunque sean facturas expedidas "de prueba".»Creating a series with the fixed format F-{YYYY}-{NUM:4} next to series F, whose format is {CODIGO}-{YYYY}-{NUM:4}: both would print F-2026-0042, and the new series is rejected with SERIES_FORMAT_OVERLAPS.
Voiding F-2026-0042 and issuing the replacement as a new invoice, which takes the next number of the series.
Numbers are correlative within each series
Within a series, invoice numbers follow one another without gaps or jumps. BeeL. takes the next number of the series at issue, gives it back if the issue fails, and applies the series' initial number only to the first period the series numbers in: later periods start at 1. Numbers are only correlative if every invoice of that series is issued through BeeL.
- Why
- A gap or a jump in a series is what an inspection reads as a missing invoice.
- Responsibility
- Checked by the API: BeeL. applies it.
- Applies to
- Types
STANDARDSIMPLIFIEDCORRECTIVE
Legal basisRD 1619/2012 (Reglamento de facturación), art. 6.1.a)
«Número y, en su caso, serie. La numeración de las facturas dentro de cada serie será correlativa.»Issuing some invoices of series A from another system while BeeL. issues the rest of the same series.
Giving each system its own series, or continuing an old sequence in BeeL. by setting the series' initial number before its first invoice.
Separate series may be used when there is a reason for them
You may number invoices in separate series when there is a reason, such as several establishments or operations of a different nature. Create one series per establishment or line of business and pick it when you create the invoice.
- Why
- Mixing establishments in one series makes the sequence hard to follow; the law lets you keep them apart.
- Responsibility
- Responsibility: the issuing business.
- Applies to
- Operations
createCompanySeries
Legal basisRD 1619/2012 (Reglamento de facturación), art. 6.1.a)
«Se podrán expedir facturas mediante series separadas cuando existan razones que lo justifiquen y, entre otros supuestos, cuando el obligado a su expedición cuente con varios establecimientos desde los que efectúe sus operaciones y cuando el obligado a su expedición realice operaciones de distinta naturaleza.»Creating a new series every month to restart the count, with no establishment or kind of operation behind it.
Creating series SHOP and ONLINE for a business that sells in a shop and on the web, and sending each invoice's series_id.
Simplified invoices are numbered in their own series
A business that issues both full and simplified invoices in the same calendar year numbers them in separate series. A BeeL. series numbers only documents of its own type: a simplified invoice in a series of another type, or in an older UNASSIGNED series, is rejected with SERIES_INCOMPATIBLE_DOC_TYPE, when it is created, edited or issued. Without series_id, the company's default series for simplified invoices is used, and it is created on first use if the company has none. A series that has already numbered invoices cannot change its type (SERIES_DOCUMENT_TYPE_LOCKED_HAS_INVOICES), and a new series of type UNASSIGNED is rejected with SERIES_UNASSIGNED_TYPE_NOT_ALLOWED.
- Why
- Full and simplified invoices sharing a series would leave neither sequence correlative.
- Responsibility
- Checked by the API: a request that breaks it is rejected with the error codes listed.
- Applies to
- Types
SIMPLIFIEDSTANDARDOperationscreateCompanyInvoicepatchCompanyInvoiceissueCompanyInvoicecreateCompanySeriespatchCompanySeries - Error codes
SERIES_INCOMPATIBLE_DOC_TYPE422,SERIES_DOCUMENT_TYPE_LOCKED_HAS_INVOICES400,SERIES_UNASSIGNED_TYPE_NOT_ALLOWED422
Legal basisRD 1619/2012 (Reglamento de facturación), art. 7.1.a)
«Cuando el empresario o profesional expida facturas conforme a este artículo y al artículo 6 para la documentación de las operaciones efectuadas en un mismo año natural, será obligatoria la expedición mediante series separadas de unas y otras.»Creating a SIMPLIFIED invoice with the series_id of your standard-invoice series: it is rejected with SERIES_INCOMPATIBLE_DOC_TYPE, and so is issuing or updating an invoice in such a series.
Omitting series_id on a simplified invoice: it is numbered in the company's simplified series, created with code S (or the next free code) the first time it is needed.
Corrective invoices are numbered in their own series
Corrective invoices go in a series specific to correctives, never in the series of the invoice they correct nor in an older UNASSIGNED series. Without a series_id, BeeL. numbers a corrective in the company's default corrective series, which is created on first use (code R, or the next free code whose numbers cannot repeat another series') if the company has none. An explicit series of another type is rejected with SERIES_INCOMPATIBLE_DOC_TYPE; a series that has already numbered invoices cannot change its type (SERIES_DOCUMENT_TYPE_LOCKED_HAS_INVOICES); a new series of type UNASSIGNED is rejected with SERIES_UNASSIGNED_TYPE_NOT_ALLOWED.
- Why
- The law requires correctives to be told apart from ordinary invoices by their series.
- Responsibility
- Checked by the API: a request that breaks it is rejected with the error codes listed.
- Applies to
- Types
CORRECTIVEOperationscreateCompanyCorrectiveInvoicecreateCompanySeriespatchCompanySeries - Error codes
SERIES_INCOMPATIBLE_DOC_TYPE422,SERIES_DOCUMENT_TYPE_LOCKED_HAS_INVOICES400,SERIES_UNASSIGNED_TYPE_NOT_ALLOWED422
Legal basisRD 1619/2012 (Reglamento de facturación), art. 6.1.a)
«No obstante, será obligatoria, en todo caso, la expedición en series específicas de las facturas siguientes: [...] 2.º Las rectificativas.»Passing the series_id of your ordinary series when creating a corrective invoice.
Omitting series_id on the corrective: it goes in the company's corrective series, created the first time it is needed.
POST /v1/companies/{company_id}/invoices/{invoice_id}/corrective{ "rectification_type": "TOTAL", "rectification_code": "R1", "reason": "Invoice issued with the wrong VAT rate" }Explained inSeries and numbering › Correctives and proformas
A series cannot be renumbered once it has issued
Once a series has issued an invoice, its code, format, reset policy, initial number and document type are fixed. Design the series before its first invoice; to number differently, or another type, create a new series.
- Why
- Changing how an issued series is numbered would rewrite numbers already registered with AEAT or break the sequence.
- Responsibility
- Checked by the API: a request that breaks it is rejected with the error codes listed.
- Applies to
- Operations
patchCompanySeries
Changing the format of series A after it has issued invoices, to add the year: it is rejected with SERIES_FORMAT_LOCKED_HAS_INVOICES.
Creating a new series with the new format and making it the default for new invoices.
An invoice number fits AEAT's length and character set
The full invoice number, series prefix included, is at most 60 characters and uses only printable ASCII characters, without double quotes, single quotes, less-than, greater-than or equals signs. BeeL. checks the longest number a series can generate when you create it or change its code or format, counting the counter as at least nine digits (SERIES_FORMAT_NUMBER_TOO_LONG), and checks the actual number again at issue: an invoice whose number AEAT would not accept is not issued, and the number is not consumed (INVOICE_NUMBER_TOO_LONG).
- Why
- AEAT identifies the invoice by this number, in the record and in the QR, and does not accept a number outside these limits.
- Responsibility
- Checked by the API: a request that breaks it is rejected with the error codes listed.
- Applies to
- Operations
createCompanySeriespatchCompanySeriesissueCompanyInvoice - Error codes
SERIES_FORMAT_NUMBER_TOO_LONG422,SERIES_FORMAT_INVALID_CHARACTERS422,INVOICE_NUMBER_TOO_LONG422,INVOICE_NUMBER_INVALID_CHARACTERS422
Legal basisAEAT, Validaciones y errores VERI*FACTU (v1.2.2), 3.1.3.1 Agrupación IDFactura · AEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 6, parámetro numserie
«NumSerieFactura solo puede contener caracteres ASCII del 32 a 126 (caracteres imprimibles), no permitiéndose la existencia de los siguientes caracteres:»«numserie Cadena de Máximo 60 Sí Nº Serie + Nº Factura»A series with a 50-character code and the format {CODIGO}-{YYYY}-{NUM:4}: its longest number reaches 65 characters, and the series is rejected with SERIES_FORMAT_NUMBER_TOO_LONG.
A series format that produces short numbers such as SHOP-2026-0001.
Explained inSeries and numbering › The format
Reverse-charge supplies of metals and electronics go in a special series
Invoices for supplies of silver, platinum, palladium, mobile phones, game consoles, laptops or tablets in which the buyer is liable for the VAT are issued in a special series. Keep a dedicated series for these invoices.
- Why
- The law requires these reverse-charge supplies to be documented in their own series; mixing them with other invoices breaks that requirement.
- Responsibility
- Responsibility: the issuing business.
- Applies to
- Types
STANDARDSupplies of silver, platinum, palladium, mobile phones, game consoles, laptops or tablets where the buyer is liable for VAT.
Legal basisLey 37/1992 del IVA, art. 84.Uno.2.º g) · RD 1619/2012 (Reglamento de facturación), art. 6.1.a) 4.º
«Las entregas de dichos bienes, en los casos en que sean sujetos pasivos del Impuesto sus destinatarios conforme a lo establecido en este número 2.°, deberán documentarse en una factura mediante serie especial.»«4.º Las que se expidan conforme a lo previsto en el artículo 84, apartado uno, número 2.º, letra g), de la Ley 37/1992, de 28 de diciembre, del Impuesto sobre el Valor Añadido.»Invoicing a batch of laptops to a reseller in the same series as the rest of your sales.
Creating a series such as ISP-G and issuing those invoices in it.
Related
Corrective invoices
When an issued invoice has to be rectified, with which reason code, how the correction is shown and within which deadline.
Invoice contents
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.