Verifactu XML structure: the invoicing record

The Verifactu invoicing record is an XML that follows the AEAT schemas SuministroLR.xsd and SuministroInformacion.xsd: a RegFactuSistemaFacturacion with a Cabecera (the taxpayer obliged to issue) and one or more RegistroFactura, each with a RegistroAlta or a RegistroAnulacion chained to the previous one by its hash. With the Verifactu API you don't build it: you send JSON and Verifacti generates the XML, which you can download.

The content and format of the record are set by RD 1007/2023 and Order HAC/1177/2024, in force; the schemas are on the AEAT developer portal.

Before you start

  • To download a real XML, a free account: it includes a test environment and a test NIF.
  • The AEAT XSD schemas, on its developer portal.

What the rules require

Each invoice generates an invoicing record with the content and format set by Order HAC/1177/2024. In the VERI*FACTU mode, that record is sent to the AEAT. Don't confuse the invoicing record with the invoice: the record is the XML that goes with each invoice, and one invoice can have several (registration, correction, cancellation). The summary of the rules, in Verifactu regulations.

General structure of a submission

A submission has one root, RegFactuSistemaFacturacion, with a Cabecera that identifies the taxpayer and one or more RegistroFactura. The elements use two namespaces: sum (SuministroLR.xsd) and sum1 (SuministroInformacion.xsd). It all travels inside a SOAP envelope.

Structure of a submission
RegFactuSistemaFacturacion
├── Cabecera
│   ├── ObligadoEmision              NombreRazon and NIF
│   ├── Representante                (optional)
│   ├── RemisionVoluntaria           (optional) FechaFinVeriFactu, Incidencia
│   └── RemisionRequerimiento        (optional)
└── RegistroFactura                  (one or more, up to 1,000)
    └── RegistroAlta  or  RegistroAnulacion

Registration record (RegistroAlta)

Example: an F1 invoice

The XML Verifacti generates for the invoice in the PHP tutorial (the NIF's first record). It validates against the AEAT XSD. The SistemaInformatico data and the generation date and time are placeholders.

RegistroAlta · F1
<sum:RegFactuSistemaFacturacion xmlns:sum="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" xmlns:sum1="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd">
  <sum:Cabecera>
    <sum1:ObligadoEmision>
      <sum1:NombreRazon>EMPRESA DE PRUEBA SL</sum1:NombreRazon>
      <sum1:NIF>B12345674</sum1:NIF>
    </sum1:ObligadoEmision>
  </sum:Cabecera>
  <sum:RegistroFactura>
    <sum1:RegistroAlta>
      <sum1:IDVersion>1.0</sum1:IDVersion>
      <sum1:IDFactura>
        <sum1:IDEmisorFactura>B12345674</sum1:IDEmisorFactura>
        <sum1:NumSerieFactura>A1</sum1:NumSerieFactura>
        <sum1:FechaExpedicionFactura>18-11-2026</sum1:FechaExpedicionFactura>
      </sum1:IDFactura>
      <sum1:RefExterna>11111111-2222-3333-4444-555555555555</sum1:RefExterna>
      <sum1:NombreRazonEmisor>EMPRESA DE PRUEBA SL</sum1:NombreRazonEmisor>
      <sum1:Subsanacion>N</sum1:Subsanacion>
      <sum1:RechazoPrevio>N</sum1:RechazoPrevio>
      <sum1:TipoFactura>F1</sum1:TipoFactura>
      <sum1:DescripcionOperacion>Servicios de consultoría</sum1:DescripcionOperacion>
      <sum1:Destinatarios>
        <sum1:IDDestinatario>
          <sum1:NombreRazon>Empresa Cliente SL</sum1:NombreRazon>
          <sum1:NIF>A15022510</sum1:NIF>
        </sum1:IDDestinatario>
      </sum1:Destinatarios>
      <sum1:Desglose>
        <sum1:DetalleDesglose>
          <sum1:ClaveRegimen>01</sum1:ClaveRegimen>
          <sum1:CalificacionOperacion>S1</sum1:CalificacionOperacion>
          <sum1:TipoImpositivo>21</sum1:TipoImpositivo>
          <sum1:BaseImponibleOimporteNoSujeto>200.00</sum1:BaseImponibleOimporteNoSujeto>
          <sum1:CuotaRepercutida>42.00</sum1:CuotaRepercutida>
        </sum1:DetalleDesglose>
      </sum1:Desglose>
      <sum1:CuotaTotal>42.00</sum1:CuotaTotal>
      <sum1:ImporteTotal>242.00</sum1:ImporteTotal>
      <sum1:Encadenamiento>
        <sum1:PrimerRegistro>S</sum1:PrimerRegistro>
      </sum1:Encadenamiento>
      <sum1:SistemaInformatico>
        <sum1:NombreRazon>PRODUCTOR DEL SOFTWARE SL</sum1:NombreRazon>
        <sum1:NIF>89890001K</sum1:NIF>
        <sum1:NombreSistemaInformatico>MiFacturador</sum1:NombreSistemaInformatico>
        <sum1:IdSistemaInformatico>MF</sum1:IdSistemaInformatico>
        <sum1:Version>2.1.0</sum1:Version>
        <sum1:NumeroInstalacion>0001</sum1:NumeroInstalacion>
        <sum1:TipoUsoPosibleSoloVerifactu>S</sum1:TipoUsoPosibleSoloVerifactu>
        <sum1:TipoUsoPosibleMultiOT>S</sum1:TipoUsoPosibleMultiOT>
        <sum1:IndicadorMultiplesOT>S</sum1:IndicadorMultiplesOT>
      </sum1:SistemaInformatico>
      <sum1:FechaHoraHusoGenRegistro>2026-11-18T09:30:00+00:00</sum1:FechaHoraHusoGenRegistro>
      <sum1:TipoHuella>01</sum1:TipoHuella>
      <sum1:Huella>5F291F83D926980C021E9BD733B3588E6593D803A822C57E039E6F894DD0DCE1</sum1:Huella>
    </sum1:RegistroAlta>
  </sum:RegistroFactura>
</sum:RegFactuSistemaFacturacion>
Elements of the Verifactu registration record, in XSD order
ElementWhat it holds
IDVersionFormat version (1.0)
IDFacturaIDEmisorFactura, NumSerieFactura and FechaExpedicionFactura
RefExternaYour own reference (optional)
NombreRazonEmisorName or company name of the issuer
Subsanacion · RechazoPrevioIf the record corrects an earlier one (optional)
TipoFacturaF1, F2, F3, R1–R5
TipoRectificativa · FacturasRectificadas · FacturasSustituidas · ImporteRectificacionOnly in corrective and replacement invoices
FechaOperacionIf the transaction date differs from the issue date (optional)
DescripcionOperacionDescription of the transaction
FacturaSimplificadaArt7273 · FacturaSinIdentifDestinatarioArt61dQualified simplified invoice (arts. 7.2 and 7.3) and invoice without recipient identification (art. 6.1.d) of the Invoicing Regulation (optional)
MacrodatoVery high-value invoices (optional)
EmitidaPorTerceroODestinatario · TerceroInvoices issued by a third party or by the recipient (optional)
DestinatariosIDDestinatario: NombreRazon and NIF or IDOtro (not in F2 or R5)
CuponOptional
DesgloseDetalleDesglose: tax, regime key, classification or exemption, rate, base, tax amount and equivalence surcharge
CuotaTotal · ImporteTotalSum of tax amounts and invoice total
EncadenamientoPrimerRegistro or RegistroAnterior
SistemaInformaticoIdentity of the invoicing system
FechaHoraHusoGenRegistroDate, time and time zone when the record was generated
NumRegistroAcuerdoFacturacion · IdAcuerdoSistemaInformaticoOnly with invoicing agreements with the AEAT (optional)
TipoHuella · Huella01 (SHA-256) and the record hash

Cancellation record (RegistroAnulacion)

RegistroAnulacion of the previous invoice
<sum:RegFactuSistemaFacturacion xmlns:sum="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" xmlns:sum1="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd">
  <sum:Cabecera>
    <sum1:ObligadoEmision>
      <sum1:NombreRazon>EMPRESA DE PRUEBA SL</sum1:NombreRazon>
      <sum1:NIF>B12345674</sum1:NIF>
    </sum1:ObligadoEmision>
  </sum:Cabecera>
  <sum:RegistroFactura>
    <sum1:RegistroAnulacion>
      <sum1:IDVersion>1.0</sum1:IDVersion>
      <sum1:IDFactura>
        <sum1:IDEmisorFacturaAnulada>B12345674</sum1:IDEmisorFacturaAnulada>
        <sum1:NumSerieFacturaAnulada>A1</sum1:NumSerieFacturaAnulada>
        <sum1:FechaExpedicionFacturaAnulada>18-11-2026</sum1:FechaExpedicionFacturaAnulada>
      </sum1:IDFactura>
      <sum1:RefExterna>66666666-7777-8888-9999-000000000000</sum1:RefExterna>
      <sum1:Encadenamiento>
        <sum1:RegistroAnterior>
          <sum1:IDEmisorFactura>B12345674</sum1:IDEmisorFactura>
          <sum1:NumSerieFactura>A1</sum1:NumSerieFactura>
          <sum1:FechaExpedicionFactura>18-11-2026</sum1:FechaExpedicionFactura>
          <sum1:Huella>5F291F83D926980C021E9BD733B3588E6593D803A822C57E039E6F894DD0DCE1</sum1:Huella>
        </sum1:RegistroAnterior>
      </sum1:Encadenamiento>
      <sum1:SistemaInformatico>
        <sum1:NombreRazon>PRODUCTOR DEL SOFTWARE SL</sum1:NombreRazon>
        <sum1:NIF>89890001K</sum1:NIF>
        <sum1:NombreSistemaInformatico>MiFacturador</sum1:NombreSistemaInformatico>
        <sum1:IdSistemaInformatico>MF</sum1:IdSistemaInformatico>
        <sum1:Version>2.1.0</sum1:Version>
        <sum1:NumeroInstalacion>0001</sum1:NumeroInstalacion>
        <sum1:TipoUsoPosibleSoloVerifactu>S</sum1:TipoUsoPosibleSoloVerifactu>
        <sum1:TipoUsoPosibleMultiOT>S</sum1:TipoUsoPosibleMultiOT>
        <sum1:IndicadorMultiplesOT>S</sum1:IndicadorMultiplesOT>
      </sum1:SistemaInformatico>
      <sum1:FechaHoraHusoGenRegistro>2026-11-18T09:31:00+00:00</sum1:FechaHoraHusoGenRegistro>
      <sum1:TipoHuella>01</sum1:TipoHuella>
      <sum1:Huella>CC9B545E52FBF2AB47B88C7280F2C79070A2A67342F8B6737DFC349FA79EC055</sum1:Huella>
    </sum1:RegistroAnulacion>
  </sum:RegistroFactura>
</sum:RegFactuSistemaFacturacion>
Elements of the Verifactu cancellation record, in XSD order
ElementWhat it holds
IDVersionFormat version (1.0)
IDFacturaIDEmisorFacturaAnulada, NumSerieFacturaAnulada and FechaExpedicionFacturaAnulada
RefExternaYour own reference (optional)
SinRegistroPrevio · RechazoPrevioIf an invoice with no previous record, or after a rejection, is cancelled (optional)
GeneradoPor · GeneradorWho generates the cancellation, if not the issuer (optional)
EncadenamientoPrimerRegistro or RegistroAnterior
SistemaInformatico · FechaHoraHusoGenRegistro · TipoHuella · HuellaAs in the registration

The Encadenamiento block

In a taxpayer's first record, Encadenamiento carries PrimerRegistro with value S. From the second on, it carries RegistroAnterior with the IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura and Huella of the previous record, whether a registration or a cancellation (as in the cancellation example above). How that hash is computed, in hash and chaining.

What the API generates from your JSON

With the Verifactu API you send JSON and Verifacti builds the XML. This is how fields map:

Mapping between the Verifactu API JSON and the invoicing record
API JSON fieldXML element
NIF of the API keyIDEmisorFactura (and ObligadoEmision/NIF in the header)
serie + numeroNumSerieFactura (joined, at most 60 characters)
fecha_expedicionFechaExpedicionFactura
fecha_operacionFechaOperacion
tipo_facturaTipoFactura
tipo_rectificativa, facturas_rectificadas, facturas_sustituidas, importe_rectificativaTipoRectificativa, FacturasRectificadas, FacturasSustituidas, ImporteRectificacion
descripcionDescripcionOperacion
nif or id_otro, and nombreDestinatarios/IDDestinatario
lineas[]Desglose/DetalleDesglose (one per line)
Sum of the tax amounts of the linesCuotaTotal
importe_totalImporteTotal
Record uuidRefExterna
Computed by VerifactiEncadenamiento, FechaHoraHusoGenRegistro, TipoHuella, Huella
sistema_informatico (optional, integrator identity)SistemaInformatico

Special characters

Values are written escaped in the XML (& as &amp;, < as &lt;), but the hash and the QR URL are computed over the unescaped value, which is what the AEAT stores. That is why the API rejects a serie or numero that already contains escaped entities (vf-verifactu-serie_numero_entidad): send the text as is.

How to see the XML that was sent

Download an invoice's XML with POST /verifactu/downloadXML (by serie and numero; it returns the request and response exactly as exchanged with the AEAT, SOAP envelope included) or export a period's with POST /verifactu/export (by ejercicio and periodo; it returns up to 500 URLs valid for 15 minutes and a token for the next ones). Since the AEAT receives records in batches, the XML may include records of other invoices. With the free account's test NIF you can use downloadXML; export only works with your own NIFs. In the test environment, XML files are kept for at most 90 days.

Download an invoice XML · cURL
curl -X POST https://api.verifacti.com/verifactu/downloadXML \
  -H "Authorization: Bearer $VERIFACTI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"serie": "A", "numero": "1"}'
Export a period’s XML · cURL
curl -X POST https://api.verifacti.com/verifactu/export \
  -H "Authorization: Bearer $VERIFACTI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ejercicio": "2026", "periodo": "11"}'

Validate an XML

If you generate the XML yourself, validate it against the AEAT XSD schemas (for example with xmllint --schema SuministroLR.xsd) or with the Verifactu XML validator. The XSD checks the structure; the business rules are in the AEAT validations and errors document (v1.2.2). For the JSON of each case, see the Verifactu examples.

Common structure errors

Verifactu API errors tied to the XML content
CodeCauseFix
vf-verifactu-importe_total_cuadreimporte_total does not match (€10 margin) the sum of base_imponible, cuota_repercutida and cuota_recargo_equivalencia of the linesRecalculate the total
vf-verifactu-serie_numero_entidadserie or numero with already-escaped XML entitiesSend the text unescaped
vf-verifactu-fecha_expedicion_hoyfecha_expedicion is not today's date (test environment)Send today's date as DD-MM-YYYY
vf-verifactu-nif_formatoThe recipient's NIF is not validly formattedCheck the NIF; for foreign recipients, use id_otro

Every other code, in Verifactu errors.

Next step

With the Verifactu API you don't build the XML: you send JSON and Verifacti generates the record, chains it and sends it to the AEAT. Start with the quick start guide or the documentation.

Test environment and test NIF included

Questions about the Verifactu XML

More questions about the Verifactu API

Where are the Verifactu XSD files?

On the AEAT developer portal: SuministroLR.xsd and SuministroInformacion.xsd for the submission, and RespuestaSuministro.xsd for the response.

Is an invoicing record the invoice?

No. It is the XML that goes with each invoice. An invoice can have several records: registration, correction and cancellation.

Do I have to sign the XML?

In the VERI*FACTU mode each record is not signed: the submission to the AEAT is an authenticated call with an electronic certificate. With the Verifactu API you need no certificate: Verifacti sends as a colaborador social of the AEAT.

Can I see the XML the API generated?

Yes, with POST /verifactu/downloadXML (one invoice) or POST /verifactu/export (a period).

Where can I see the JSON of a corrective invoice?

In the corrective invoice example; the table above says which XML element each field maps to.

Send JSON and leave the XML to the API

Try it with the free account and download the XML it generates.

Test environment and test NIF includedRead the documentation