Invoicing and VeriFactu

Lifecycle of invoices, quotes and proformas; series, Spanish taxes, issuing with VeriFactu, corrective and simplified invoices, PDF, Facturae and third-party invoices.

Document types

DocumentPathNotes
Invoice/invoices/Includes corrective (is_rectifying) and simplified (is_simplified) invoices.
Quote/quotes/Accepted or rejected and converted into a proforma or invoice.
Proforma/proformas/Preliminary document with no tax value; converted into an invoice.
Third-party invoice/external-invoices/Income invoices the organization does not issue (self-billing).
Recurring invoice/recurring-invoices/Templates that generate invoices periodically.
Credit note (legacy)/credit-notes/Credit notes from the previous system. They are not VeriFactu corrective invoices: use /invoices/{id}/create-rectifying/.

All sales documents share a structure: customer, series, dates, currency, notes and lines; Billora computes subtotal, tax_total, withholding_total, surcharge_total, total and balance (outstanding).

Reading documents requires invoices:read; creating, issuing and every other action, invoices:write.

From draft to issued invoice

            PATCH / DELETE
              ┌──────┐
              ▼      │
 POST ───▶  draft ───┘ ──── POST /send/ ───▶ sent ──▶ partially_paid ──▶ paid
 /invoices/                (number +            │
                            VeriFactu)          ├──▶ overdue
                                                ├──▶ cancelled   (POST /cancel/)
                                                └──▶ rectified   (corrective invoices issued)

1. Create the draft

POST/api/v1/invoices/invoices:write
{
  "customer": 318,
  "series": 12,
  "due_date": "2026-12-01",
  "currency": "EUR",
  "notes": "Pedido 2026-1042",
  "terms": "Pago por transferencia a 30 días.",
  "lines": [
    { "product": 77, "description": "Licencia anual", "quantity": "1", "unit_price": "1200.00", "spanish_taxes": [1] },
    { "description": "Formación (4 h)", "quantity": "4", "unit_price": "60.00", "discount_percent": "10", "spanish_taxes": [1] }
  ]
}
JSON
FieldDescription
customerCustomer id. Required except for simplified invoices.
seriesNumbering series (type INVOICE). Needed to issue.
due_dateDue date. Recomputed from the payment terms, if any, when issuing.
operation_dateOperation date if different from the issue date.
currency, exchange_rateISO currency and rate to euros if not EUR.
payment_termsPayment terms (/payment-terms/).
income_categoryIncome category (/income-categories/). With accounting_account (a group 7 account) on the category, its sales are booked to that account.
accounting_accountAccounting account of the sale. Priority: invoice account → category account → 700/705 by product type. A 2xx account makes it a fixed-asset sale (see below).
fixed_assetFixed-asset sale: record of the asset sold (/accounting/fixed-assets/), required when accounting_account is 2xx.
notes, termsTexts shown on the document.
external_referenceYour reference (order, contract…). Useful for reconciliation.
metadataFree-form JSON object for your own data.
lines[]description, quantity, unit_price (before tax), discount_percent, product (optional) and spanish_taxes (tax ids).

The issue date (issue_date) and the number (number) are not sent: Billora assigns them when issuing.

2. Edit or delete the draft

PATCH/api/v1/invoices/{id}/invoices:write

Send only the fields that change. If you send lines, all lines are replaced. A draft is deleted with DELETE /invoices/{id}/ (204). Issued documents can't be deleted or edited.

3. Issue

POST/api/v1/invoices/{id}/send/invoices:write

Assigns the number and issue date, records the invoice in VeriFactu and marks it as issued. Irreversible. Doesn't send any email.

{
  "number": "F-2026-0042",
  "status": "sent",
  "message": "Factura enviada correctamente",
  "verifactu_processed": true,
  "sent_to_aeat": true
}
JSON

Issuing is atomic: if numbering or the VeriFactu record fails, the API returns an error, the invoice stays a draft and no series number is consumed. Always send an Idempotency-Key when issuing.

Numbering series

GET/api/v1/settings/series/series:read

Each series has a type (INVOICE, CREDIT_NOTE, QUOTE, PROFORMA…), a prefix/suffix, number padding and a reset policy (for example yearly). The number is assigned when issuing, sequentially and without gaps, so you must not compute it yourself.

  • Regular and simplified invoices: INVOICE series.
  • Corrective invoices: CREDIT_NOTE series (for example R-2026-0001).
  • Use separate series if you need separate numbering (for example one per shop or channel).

Series are created in Settings → Series in the app.

Spanish taxes

GET/api/v1/spanish-tax-rates/taxes:read

Line taxes go in spanish_taxes as ids from this catalog:

{
  "id": 9,
  "name": "IRPF Profesionales 15%",
  "tax_type": "IRPF_PROF",
  "category": "retencion",
  "rate": "15.00",
  "is_active": true
}
JSON
tax_typeTaxcategory
IVAVAT (21, 10, 4, 0%, exemptions)incremental
IGICIGIC (Canary Islands)incremental
IPSIIPSI (Ceuta and Melilla)incremental
RECARGOEquivalence surcharge (5.2%, 1.4%, 0.5%…)incremental
IRPF_PROFIRPF withholding on professional services (15%, 7%…)retencion
IRPF_ARRWithholding on rentals (19%)retencion
RET_ESPOther withholdingsretencion

A line combines one main tax (IVA, IGIC or IPSI), optionally the equivalence surcharge and optionally one withholding. incremental taxes are added and retencion ones are subtracted:

{ "description": "Honorarios octubre", "quantity": "1", "unit_price": "1000.00", "spanish_taxes": [1, 9] }
JSON
Amount
Tax base€1,000.00
VAT 21%+ €210.00
IRPF withholding 15%− €150.00
Total€1,060.00
  • Exempt or non-taxable operations use the catalog rates with their legal ground (for example exempt under art. 20 or intra-EU supply under art. 25), which is what is reported to VeriFactu.
  • Ids are stable, but don't hard-code them: read them from the catalog once and keep them in your configuration.
  • If a line references a product and you don't send spanish_taxes, the product's default taxes apply.
  • Other read-only endpoints with taxes:read: /spanish-tax-regimes/, /tax-templates/ and /organization-tax-config/.

VeriFactu

Billora is a VeriFactu invoicing system (Spanish Royal Decree 1007/2023). When an invoice is issued:

  1. The invoicing record is generated, with its hash chained to the previous invoice.
  2. If the organization has VeriFactu enabled, the record is submitted to the Spanish Tax Agency (AEAT) and the invoice gets the QR code and the “VERI*FACTU” legend.
  3. Cancellations (/cancel/) generate their own cancellation record.

Related invoice fields:

FieldDescription
verifactu_modeOrganization mode when issued.
verifactu_statusRecord status at the tax agency (pending, accepted, accepted with errors, rejected…).
verifactu_qr_url / has_verifactu_qrQR verification URL and whether the PDF includes it.

Submission to the tax agency can complete a few seconds after issuing. To find out without polling, subscribe to the invoice.verifactu.accepted and invoice.verifactu.rejected events (webhooks). If a record is rejected or the submission fails, you can retry it (with an amendment when appropriate) with:

POST/api/v1/invoices/{id}/retry-verifactu/invoices:write

Invoicing from several systems

VeriFactu requires every invoice to be recorded in the system that issues it. If you issue with Billora through the API, don't also issue it in another program: use Billora as the single issuer and download the PDF from here.

Cancelling an invoice

POST/api/v1/invoices/{id}/cancel/invoices:write

Cancels an issued invoice (and records the cancellation in VeriFactu). Only appropriate when the invoice should never have been issued; rectified or already cancelled invoices can't be cancelled. To correct amounts or data of a valid invoice, issue a corrective invoice.

If the invoice has payments (paid or partially paid) it can only be cancelled with refund=true (query ?refund=true or body {"refund": true}): Billora first records the refund to the customer of each payment (Payment with is_refund: true and a negative amount; entry debit 4300xxxx / credit 572) and then the reversal. Without refund it returns 400 with {"code": "refund_required", "paid_amount": "…"}. The response with refunds is {status, refunds: [Payment…]}.

Selling a fixed asset

An invoice whose accounting_account is a 2xx account and carries fixed_asset (the asset record) records the sale of the asset: the entry is debit 4300xxxx + 28x (+ 671 on a loss) / credit 2xx + 477 (+ 771 on a gain) and the record becomes disposed with disposal_date = invoice date and disposal_amount = net amount. With fixed_asset and no accounting_account the asset's account is used; a 2xx account without fixed_asset returns 400. Cancelling the invoice reactivates the record.

Corrective invoices

POST/api/v1/invoices/{id}/create-rectifying/invoices:write

Creates, from an issued invoice, a draft corrective invoice. Answers 201 with {rectifying_invoice_id, rectification_type, detail}; the new invoice carries is_rectifying: true, rectifies: <original id> and metadata.rectification_type.

{ "notes": "Return of 2 defective units", "series": 13 }
JSON
rectification_typeWhat it creates
differences (default) without linesFull reversal: every line of the original, negated.
differences with linesPartial correction by differences: only the lines sent, with their sign as given (e.g. "unit_price": "-50.00"). An invoice may have several partial corrections.
substitution (requires lines)Correction by substitution: full reversal of the original plus the correct lines, in a single document of the R series.
{ "rectification_type": "differences", "lines": [{ "description": "Late-delivery discount", "quantity": "1", "unit_price": "-50.00", "spanish_taxes": [1] }] }
JSON

lines has the same format as in POST /invoices/.

  1. Review the draft (you can edit its lines with PATCH).
  2. Issue it with POST /invoices/{id}/send/: it is numbered with a CREDIT_NOTE series and recorded in VeriFactu as a corrective invoice.
  3. The original invoice's outstanding amount goes down; if issued corrective invoices cover its whole amount it becomes rectified. Its detail includes credited_amount, refund_due and rectified_by.

The corrective invoice of a simplified invoice is simplified too.

Simplified invoices

Send "is_simplified": true when creating the invoice. They can be issued without a customer: if you don't send customer, Billora uses “Consumidor final” (end consumer). Spanish rules limit their use (generally amounts up to €400 VAT included, or €3,000 in certain sectors).

Quotes and proformas

ActionEndpoint
Create a quotePOST /quotes/ (same body as an invoice)
Number and mark as sentPOST /quotes/{id}/send/
Accept / rejectPOST /quotes/{id}/accept/ · POST /quotes/{id}/reject/
Convert into a proformaPOST /quotes/{id}/to-proforma/
Convert into an invoicePOST /quotes/{id}/to-invoice/
Convert a proforma into an invoicePOST /proformas/{id}/to-invoice/

Conversions copy customer, lines and taxes and answer 201 with the new document (invoice_id or proforma_id). Since they create a document, they count towards the plan's document quota (like create-rectifying). The resulting invoice is a draft: review it and issue it with /send/. You can set the invoice's series and due date:

{ "series": 12, "due_date": "2026-12-15" }
JSON

Quote statuses: draft, sent, accepted, rejected, expired. Proforma statuses: draft, sent, invoiced, cancelled.

POST/api/v1/invoices/{id}/email/invoices:write

Emails the PDF to the recipients in to (if omitted, to the customer's email). Works the same on /quotes/{id}/email/ and /proformas/{id}/email/.

{ "to": ["administracion@talleresmartin.es"] }
JSON

With POST /invoices/{id}/collect-payment/ Billora creates a card payment link (requires the Stripe integration) and sends it to the customer with the invoice; the response includes checkout_url.

PDF and Facturae

DownloadEndpointType
Invoice PDFGET /invoices/{id}/download-pdf/application/pdf
Facturae 3.2.2 (unsigned XML)GET /invoices/{id}/download-facturae/application/xml
Quote / proforma PDFGET /quotes/{id}/download-pdf/ · GET /proformas/{id}/download-pdf/application/pdf
  • The PDF uses the organization's configured design. A draft downloads marked as a draft.
  • Facturae is meant for invoicing Spanish public administrations (FACe): the customer must have its DIR3 codes (dir3_unit, dir3_organ, dir3_office). Sign it with your certificate before submitting it if your flow requires it.
curl -L https://api.billora.app/api/v1/invoices/5120/download-facturae/ \
  -H "Authorization: Bearer $BILLORA_API_KEY" \
  -o F-2026-0042.xml
bash

Third-party and self-billed invoices

Some income invoices are not issued by the organization: the customer issues them on its behalf (self-billing, for example an insurer invoicing its agent's commissions) or a third party does. Those invoices already have a number and are already recorded by their issuer, so they are not created with /invoices/ nor issued: they are registered as-is in /external-invoices/.

POST/api/v1/external-invoices/invoices:write
{
  "issuer_type": "recipient",
  "external_issuer_name": "Aseguradora Ejemplo, S.A.",
  "customer": 412,
  "number": "AF-2026/000318",
  "issue_date": "2026-10-31",
  "declared_total": "1210.00",
  "lines": [
    { "description": "Comisiones octubre 2026", "quantity": "1", "unit_price": "1000.00", "spanish_taxes": [1] }
  ]
}
JSON
  • issuer_type: recipient (self-billing: issued by the customer) or third_party (issued by a third party).
  • declared_total is the original document's total: Billora checks it matches the lines.
  • Attach the original PDF with a multipart/form-data request and the original_document field; download it with GET /external-invoices/{id}/document/.
  • They are not renumbered nor sent to VeriFactu, but they count in VAT books, reports and accounting, and accept payments like any invoice.
  • Cancel them with POST /external-invoices/{id}/cancel/ (if they have no payments). Trying to issue or correct them through /invoices/ returns 400 with "code": "external_invoice".

invoice.created, invoice.updated, invoice.issued, invoice.sent, invoice.paid, invoice.partially_paid, invoice.overdue, invoice.cancelled, invoice.rectified, invoice.deleted, invoice.verifactu.accepted, invoice.verifactu.rejected, quote.*, proforma.*, external_invoice.* and recurring_invoice.generated. See the event catalog.

Every field and filter of each endpoint is in the API reference.