VeriFactu
v0.1.1Audit VERI*FACTU hash chains, build the AEAT tax QR, build and validate Facturae 3.2.2 invoices.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
verifactu_hash Compute VeriFactu record hash
Compute the VERI*FACTU fingerprint (huella, SHA-256) of one invoicing record. record (AEAT field names; snake_case aliases accepted): alta: IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura (DD-MM-AAAA), TipoFactura (F1, F2, F3, R1-R5), CuotaTotal, ImporteTotal (as written in the XML, decimal point), FechaHoraHusoGenRegistro (AAAA-MM-DDThh:mm:ss+hh:mm). anulación (TipoRegistro="anulacion"): IDEmisorFacturaAnulada, NumSerieFacturaAnulada, FechaExpedicionFacturaAnulada, FechaHoraHusoGenRegistro. previous_huella: fingerprint of the previous rec…
| Parameter | Type | Description |
|---|---|---|
record * | object | |
previous_huella | string |
validate_invoice_chain Validate VeriFactu invoice chain
Audit a VERI*FACTU chain of records (in generation order) given as JSON objects. Each record has the fields of `verifactu_hash` plus `Huella` (stored fingerprint) and optionally `HuellaAnterior` or `RegistroAnterior` {IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura, Huella} and `PrimerRegistro` ("S"). For every record the fingerprint is recomputed and compared, and the link to the previous record checked. Reports chain breaks, altered records, PrimerRegistro misuse, duplicate invoices, cancellations of unknown invoices, timestamps going backwards, invalid NIF/date…
| Parameter | Type | Description |
|---|---|---|
records * | array | |
continues_from | string |
validate_verifactu_xml Validate VeriFactu XML
Audit VERI*FACTU XML exported by an invoicing program (RegFactuSistemaFacturacion, a SOAP envelope, or any XML holding RegistroAlta / RegistroAnulacion elements, in document order). Validates RegFactuSistemaFacturacion against the official AEAT schema (SuministroLR.xsd) when present, then runs every chain and fingerprint check of `validate_invoice_chain`. XML that holds no records is not charged.
| Parameter | Type | Description |
|---|---|---|
content | string | |
content_base64 | string | |
continues_from | string |
generate_verifactu_qr Generate VeriFactu QR code
Generate the AEAT tax QR ("QR tributario") of an invoice: URL and image. Args: nif: Issuer NIF. numserie: Invoice series + number exactly as registered. fecha: Issue date (DD-MM-AAAA; AAAA-MM-DD and DD/MM/AAAA are converted). importe: ImporteTotal with decimal point, e.g. "241.40". verifactu: true for VERI*FACTU systems (ValidarQR), false for non-verifiable systems (ValidarQRNoVerifactu). environment: produccion (default) or pruebas (AEAT test portal). size_px: Image width in pixels (100-2000). image_format: png (default) or svg. The ima…
| Parameter | Type | Description |
|---|---|---|
fecha * | string | |
importe * | string | |
nif * | string | |
numserie * | string | |
environment | string | |
image_format | string | |
size_px | integer | |
verifactu | boolean |
build_facturae Build Facturae e-invoice
Build a Facturae 3.2.2 invoice (XML) from plain data, with totals computed and the official XSD checked. invoice: number (max 20), series, issue_date, operation_date?, currency (EUR), description?, notes?, legal_literals? [text], receiver_contract_reference?, seller / buyer: nif, name (company name, or first name with first_surname/second_surname for a person), address, post_code, town, province, country (ISO alfa-3, default ESP), residence? (R/U/E), email?, phone?; buyer.face: {oficina_contable, organo_gestor, unidad_tramitadora, organo_proponente?} DIR3…
| Parameter | Type | Description |
|---|---|---|
invoice * | object |
validate_facturae Validate Facturae e-invoice
Validate a Facturae 3.2.2 file (.xml or signed .xsig) before sending it to FACe or a client. Checks the official XSD, the arithmetic FACe checks (line amounts, tax quotas, header vs line bases, totals, batch totals, installments), NIFs of resident parties, the three DIR3 codes for public administrations, and whether the file is signed. Files that are not Facturae are not charged.
| Parameter | Type | Description |
|---|---|---|
content | string | |
content_base64 | string |
check_qr_url Check VeriFactu QR URL
Check a tax QR URL read from an invoice: official AEAT host, path, parameters and formats. Free.
| Parameter | Type | Description |
|---|---|---|
url * | string |
validate_nif Validate Spanish tax ID (NIF)
Check a Spanish NIF / NIE / CIF control character. Free.
| Parameter | Type | Description |
|---|---|---|
nif * | string |
verifactu_calendar Show VeriFactu deadlines
Legal deadlines for VERI*FACTU and mandatory B2B e-invoicing in Spain, with sources and what is still pending publication. Free.
pricing Show tool prices
Credit price of each tool and where to buy credits. Free.
credits_balance Check credit balance
Remaining credits on your KeyFlint license. Free.