QR code and PDF
The tax QR code on every invoice: when it exists, what it encodes, and how any document that carries it presents it.
Every invoice issued with a billing system carries a QR code that lets its recipient check it with AEAT. The API returns the QR data with the invoice; these rules apply to any document that carries it.
10 rules: 6 from the law, 3 AEAT criteria, 1 BeeL. rule. How to read a rule.
Every invoice carries the tax QR code
An invoice issued with a billing system carries the tax QR code, whether it is a full or a simplified invoice, on any document of the invoice. The invoice's verifactu block returns the QR data: qr_url and qr_base64.
- Why
- The QR is how the recipient checks the invoice with AEAT. A document without it is not the invoice the regulation describes.
- Responsibility
- Responsibility: your integration.
- Applies to
- Invoices of a company under VeriFactu, full or simplified.
Legal basisRD 1619/2012 (Reglamento de facturación), art. 6.5.a) · RD 1619/2012 (Reglamento de facturación), art. 7.5
«La representación gráfica del contenido parcial de la factura mediante un código “QR”.»«deberá incluirse, además, lo contenido en el apartado 5 del artículo 6 de este Reglamento.»Sending the customer a document of your own with the invoice data and no QR.
Printing the invoice's QR (qr_base64, or qr_url encoded) on every document of the invoice you hand over.
Wait for the QR before you distribute the PDF
Do not render or send a document of an invoice under VeriFactu before its QR data exists. Wait for the invoice.pdf.generated webhook, or read the invoice until verifactu.qr_url is present. The API applies the same rule to its own PDF: it is painted once, with the QR, and never modified afterwards — voiding or correcting the invoice does not change it. Asking for the PDF of an invoice whose record ended without QR data answers INVOICE_NOT_REGISTERED_NO_PDF; an email requested before the PDF exists is accepted with 202 and sent when the PDF is stored, or recorded as failed if the record ends without QR data.
- Why
- A document rendered without the QR data cannot carry the QR the invoice needs.
- Responsibility
- Responsibility: your integration. The API also answers the error codes listed.
- Applies to
- Operations
issueCompanyInvoicegetCompanyInvoicePdfsendCompanyInvoiceInvoices of a company under VeriFactu. - Error codes
INVOICE_NOT_REGISTERED_NO_PDF400
Rendering your own PDF before the invoice carries qr_url.
Waiting for the invoice.pdf.generated webhook, or reading the invoice again until verifactu.qr_url is present.
The QR measures between 30 mm and 40 mm
The QR code printed on an invoice measures at least 30 mm × 30 mm and at most 40 mm × 40 mm.
- Why
- A smaller QR may not scan, and the Orden fixes the range: neither smaller nor larger.
- Responsibility
- Responsibility: your integration.
- Applies to
- Any document that carries the QR, including one you render.
Legal basisOrden HAC/1177/2024, art. 21.1 · AEAT, Preguntas frecuentes SIF y VERI*FACTU, Remisión de información por el receptor / QR
«El código «QR» deberá tener un tamaño entre 30x30 y 40x40 milímetros y seguir las especificaciones de la norma ISO/IEC 18004.»«no puede ser menor de 30x30 mm no puede ser mayor de 40x40 mm.»Scaling the qr_base64 image down to fit a narrow header.
Placing the image at a fixed physical size inside the range, whatever the page layout.
The QR follows ISO/IEC 18004 with error correction M
A QR code generated for an invoice follows ISO/IEC 18004 and uses error-correction level M. Set it when you encode qr_url with your own library.
- Why
- Other levels change the density of the code, and the Orden fixes this one.
- Responsibility
- Responsibility: your integration.
- Applies to
- A QR you generate yourself from
qr_url.
Legal basisOrden HAC/1177/2024, art. 21.1
«Para la generación del código «QR» se empleará el nivel M (medio) de corrección de errores.»Encoding qr_url with a library that defaults to error-correction level L.
Encoding it with level M, or printing qr_base64 unchanged.
Use qr_url exactly as returned
Do not build or change the URL the QR encodes: use qr_url as BeeL. returns it. It carries only the four parameters AEAT requires, the issuer NIF, the number, the issue date and the amount AEAT registered.
- Why
- The URL has to match the registered record. A URL built from your own invoice total, or with extra parameters, points AEAT at an invoice that does not exist.
- Responsibility
- Checked by the API: BeeL. applies it.
- Applies to
- Invoices of a company under VeriFactu.
Legal basisOrden HAC/1177/2024, art. 21.2 · AEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 6
«b) Información de la factura que formará parte de la «URL»: 1.º NIF del obligado a expedir la factura. 2.º Número de serie y número de la factura expedida. 3.º Fecha de expedición de la factura. 4.º Importe total de la factura.»«IMPORTANTE: este parámetro nunca podrá incorporarse en la «URL» que va en el código «QR» de la factura»Rebuilding the URL from your own data, with the invoice total including IRPF, or adding formato=json.
Encoding the qr_url string from the invoice, unchanged.
{ "verifactu": { "qr_url": "https://www2.agenciatributaria.gob.es/wlpl/TIKE-CONT/ValidarQR?nif=B27534239&numserie=S-2026-0001&fecha=19-09-2026&importe=121.00" } }The VeriFactu legend goes just below the QR
Just below the QR, print «Factura verificable en la sede electrónica de la AEAT» or «VERI*FACTU», preferably centred on it. The Orden asks for a type and size clearly visible and similar to the rest of the invoice data; AEAT's specification, for one equal to or larger than it. Print it only on invoices whose record goes to AEAT.
- Why
- The legend tells the recipient the invoice was sent to AEAT and can be checked there; on an invoice that was not, it would say something false.
- Responsibility
- Responsibility: your integration.
- Applies to
- Any document that carries the QR of an invoice registered under VeriFactu.
Legal basisRD 1619/2012 (Reglamento de facturación), art. 6.5.b) · Orden HAC/1177/2024, art. 20.1.b) · AEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3 · AEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3
«Estas facturas, sean electrónicas o no, incorporarán además la frase “Factura verificable en la sede electrónica de la AEAT” o “VERI*FACTU” únicamente en aquellos casos en los que el sistema informático realice la remisión de todos los registros de facturación a la Agencia Estatal de Administración Tributaria»«la frase «Factura verificable en la sede electrónica de la AEAT» o «VERI*FACTU», que deberá tener un tipo de letra y tamaño bien visibles, similares a los del resto de datos de la factura.»«justo debajo del código «QR» deberá aparecer la frase «Factura verificable en la sede electrónica de la AEAT» o «VERI*FACTU», preferiblemente centrada con respecto al código «QR».»«deberán tener un tipo de letra y tamaño legibles, siempre iguales o superiores a los del resto de datos de la factura.»Printing the legend in small print in the footer, away from the QR.
Printing «Factura verificable en la sede electrónica de la AEAT» centred just below the QR, as large as the invoice lines.
«QR tributario:» goes just above the QR
Above the QR, print the text «QR tributario:», preferably centred on it, in a legible type size equal to or larger than the rest of the invoice data.
- Why
- AEAT's specification presents the QR with this label, so that the recipient knows which code to scan.
- Responsibility
- Responsibility: your integration.
- Applies to
- Any document that carries the QR, including one you render.
Legal basisAEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3 · AEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3
«La presentación del código «QR» incluirá también un texto que siempre deberá ir precediéndolo: «QR tributario:», y que se situará encima del propio código «QR» (preferiblemente centrado con respecto a este)»«Tanto el texto que siempre debe preceder al código «QR», como, en su caso, la frase que habrán de incluir los sistemas «VERI*FACTU» deberán tener un tipo de letra y tamaño legibles, siempre iguales o superiores a los del resto de datos de la factura.»Printing the QR on its own, or with a label in a smaller font than the invoice lines.
Printing «QR tributario:» centred above the QR, at the same size as the invoice data.
The QR goes once, at the start of the first page
Place the QR at the beginning of the invoice, before its content. On a portrait page it goes near the top margin, preferably centred (otherwise top left); on a landscape page, on the left, preferably near the top-left corner (otherwise centred between the top and bottom margins). On an invoice of several pages it appears once, on the first page.
- Why
- AEAT's specification fixes where the recipient finds the code; a QR repeated or buried in the footer departs from it.
- Responsibility
- Responsibility: your integration.
- Applies to
- Any document that carries the QR, including one you render.
Legal basisAEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3 · AEAT, Preguntas frecuentes SIF y VERI*FACTU, Remisión de información por el receptor / QR · AEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3
«Si la factura ocupara varias páginas, el código «QR» aparecería una única vez, en la primera página.»«El QR tributario solo debe aparecer una vez, al principio de la factura y antes del contenido de esta.»«En el caso de utilizar un formato de orientación horizontal (apaisado) para la factura, el código «QR» se situará a la izquierda de esta, preferiblemente cercana al margen superior-izquierdo (o, si no, centrada respecto a los márgenes superior e inferior de la factura).»Repeating the QR in the footer of every page.
Printing it once, at the top of page one, centred between the margins.
Keep a blank margin around the QR
Leave at least 2 mm of blank space on all four sides of the QR (6 mm recommended), with enough contrast against the background.
- Why
- Without a quiet zone, text or lines next to the code stop it from scanning.
- Responsibility
- Responsibility: your integration.
- Applies to
- Any document that carries the QR, including one you render.
Legal basisAEAT, Detalle de las especificaciones técnicas del código QR de la factura (v0.5.0), apartado 3
«se deben mantener como mínimo 2 milímetros de espacio vacío (en blanco) alrededor de los cuatro lados del código «QR», recomendándose que sean 6 milímetros.»Placing the QR flush against a table border.
Keeping a white margin around it on every side.
A structured e-invoice carries the QR URL as a field
When you send an invoice as a structured electronic invoice, include the qr_url as a separate field; the QR image itself is then not needed. A PDF still shows the QR image.
- Why
- In a structured file there is no image to scan: the URL is how the recipient reaches AEAT's check.
- Responsibility
- Responsibility: your integration.
- Applies to
- Invoices you send as structured e-invoices (Facturae, UBL and similar).
Legal basisOrden HAC/1177/2024, art. 20.2 · Orden HAC/1177/2024, art. 20.2
«En caso de tratarse de una factura electrónica, destinada al intercambio de su información de forma estructurada»«se deberá incluir como un campo independiente la «URL» contenida en el código «QR», no siendo necesario incluir el propio código «QR».»Converting the invoice to a structured format and dropping the QR data.
Mapping verifactu.qr_url to its own field of the structured invoice.