TicketBAI invoice examples with the API

Here are 24 TicketBAI invoice examples, one per invoice type or case (full, simplified, corrective, credit notes, exchange, intra-EU, exports, exempt, non-subject, reverse charge, REBU, equivalence surcharge, cancellation and correction), almost all with the JSON request to the Verifacti TicketBAI API ready to copy. The same request works in Álava, Bizkaia and Gipuzkoa unless the case says otherwise.

TicketBAI invoice types

TicketBAI invoice examples by invoice type or case
CaseInvoice type or keyWhen to use it
Simplified invoicesimplificada: trueReceipts up to €400 VAT included (€3,000 for certain activities), with no recipient details.
Full invoicesimplificada: falseInvoices to businesses and professionals that identify the recipient.
Several VAT ratesVarias entradas en desglose_ivaInvoices with lines at different VAT rates.
Intra-EU B2B goodsexenta con causa_exencion E5Sales of goods to businesses in other EU countries.
Intra-EU B2B servicesno_sujeta con causa RLServices to businesses in other EU countries.
Intra-EU B2C below the thresholddesglose_iva con IVA españolSales to consumers in other EU countries below the threshold.
Intra-EU B2C above the threshold (OSS)clave_regimen 17 y no_sujeta IESales to consumers in other EU countries above the threshold, declared through the One-Stop Shop (OSS).
Export of goodsclave_regimen 02 y exenta E2Sales of goods to customers outside the EU.
Services outside the EUno_sujeta con causa RLServices to businesses outside the EU, and to consumers outside the EU when they are article 69.Two services (advice, consultancy, electronic services, assignment of rights…).
Exempt invoiceexenta con causa_exencion E1–E6VAT-exempt operations.
Non-subject operationno_sujeta con causa OT, RL, VT o IEOperations not subject to VAT.
Disbursements and withholdingespecial.retencion_soportadaInvoices from professionals with income tax withholding.
Credit noteRectificativa R1 por diferencias, en negativoReturns and discounts after the invoice.
Exchange invoicesustitucion_simplificada: trueWhen the customer asks for an invoice in their name for a receipt already issued.
Corrective invoicesrectificativa.codigo R1–R5Correcting errors or changing amounts of invoices already issued.
↳ By substitutionrectificativa.tipo SReplacing an invoice with another one with the correct amounts.
↳ By differencesrectificativa.tipo ICorrecting an invoice by adding or subtracting the difference.
Equivalence surchargetipo_recargo_equivalencia en desglose_ivaSales to retailers under the equivalence surcharge regime.
Issued by third partiesSin campo adicionalInvoices a third party issues on behalf of the issuer.
REBUclave_regimen 03Sales of second-hand goods, works of art or antiques under REBU.
Reverse chargeespecial.inversion_sujeto_pasivo: trueOperations where the recipient accounts for VAT (for example, certain construction work).
CancellationEndpoint /ticketbai/cancelInvoices issued by mistake.
CorrectionPUT /ticketbai/modify con accion SUBSANAR o MODIFICARFixing in Álava and Gipuzkoa an invoice that was rejected or accepted with errors.

What a TicketBAI example looks like

Each case comes with the JSON request to the TicketBAI API, with tabs for cURL, Python, JavaScript, Node.js, PHP, Go, Java, C# and VB6. The free account includes the TicketBAI test environment: ask soporte@verifacti.com for a test NIF for your territory and try the request with its test API key. The issue date is already today's. To repeat a submission, change numero (or serie): the API rejects two invoices with the same series, number and year.

You do not have to generate the XML: from that request, Verifacti builds the TicketBAI file, signs it, calculates the TicketBAI code and the QR, and sends it to the NIF's foral treasury. The response carries the invoice identifier (uuid), the TicketBAI code (tbai), the estado, the verification URL (url) and the QR in Base64 (qr); the TicketBAI code and the QR are printed on the invoice.

The endpoint is the same in all three territories; what is behind it changes:

  • Álava and Gipuzkoa: an invoice that was rejected or accepted with errors is fixed through the Zuzendu service (SUBSANAR or MODIFICAR).
  • Bizkaia: the submission goes to Batuz, inside the LROE; if the issuer is a natural person, the invoice carries detalle_renta.

Questions about the examples

FAQ TicketBAI

Does the response include the QR and the TicketBAI code?

Yes, straight away. The response of POST /ticketbai/create includes the QR in Base64 (qr), its URL (url) and the TicketBAI code (tbai), which are printed on the invoice. All fields in the documentation.

Can I correct a rejected invoice?

In Álava and Gipuzkoa, yes: with the SUBSANAR action of PUT /ticketbai/modify. In Bizkaia, no: the API offers no modification or correction, but it does offer cancellation with /ticketbai/cancel. Examples in correction and cancellation.

Can I test TicketBAI with the free account?

Yes. The free account includes the TicketBAI test environment, so you can do the integration at no cost. For the foral treasury test NIF, write to soporte@verifacti.com. To send invoices of real NIFs to the foral treasury you need a paid subscription.

Try the examples in the test environment

Create your free account, ask soporte@verifacti.com for a TicketBAI test NIF and send any of these requests with its test API key.

Test environment and test NIF includedRead the documentation