Quickstart

Create an API key, make your first request and take an invoice from draft to issued and paid in ten minutes.

In this guide you will create a customer, prepare a draft invoice, issue it, download its PDF and record the payment. Every step has examples in cURL, JavaScript (Node.js 18+ with fetch), Python (requests) and PHP (cURL).

Use a test organization

Issuing an invoice is irreversible and, if the organization has VeriFactu enabled, it is submitted to the Spanish Tax Agency. While you develop, work in a test organization without VeriFactu. See Environments.

1. Create an API key

  1. Sign in to Billora as an owner or admin and go to Settings → API.
  2. Click Create API key, give it a name that identifies the integration (for example “ERP production”) and select these scopes: contacts:write, invoices:write, payments:write, series:read and taxes:read.
  3. Copy the key. It starts with blr_ and is shown only once: Billora only stores a hash.

Store it in an environment variable; every example reads it from there:

export BILLORA_API_KEY="blr_…"
bash

2. Make your first request

List the organization's numbering series. It checks that the key works and tells you which series to use when invoicing.

curl https://api.billora.app/api/v1/settings/series/ \
  -H "Authorization: Bearer $BILLORA_API_KEY"
bash

The response is a paginated list. Note the id of the invoice series ("type": "INVOICE"):

{
  "count": 3,
  "next": null,
  "previous": null,
  "results": [
    { "id": 12, "type": "INVOICE", "code": "F", "name": "Facturas", "prefix": "F-", "next_number": 1 },
    { "id": 13, "type": "CREDIT_NOTE", "code": "R", "name": "Rectificativas", "prefix": "R-", "next_number": 1 },
    { "id": 14, "type": "QUOTE", "code": "P", "name": "Presupuestos", "prefix": "P-", "next_number": 1 }
  ]
}
JSON

If you get a 401, check the Authorization header; if it is a 403, look at the error code (missing scope, plan without API…). Every code is listed in Errors.

3. Look up the tax to apply

Line taxes are given as ids from the Spanish tax catalog (VAT/IVA, IGIC, equivalence surcharge, IRPF withholding…). Look it up once and keep the id in your configuration:

curl "https://api.billora.app/api/v1/spanish-tax-rates/?page_size=200" \
  -H "Authorization: Bearer $BILLORA_API_KEY"
bash
{
  "results": [
    { "id": 1, "name": "IVA General 21%", "tax_type": "IVA", "category": "incremental", "rate": "21.00", "is_active": true },
    { "id": 9, "name": "IRPF Profesionales 15%", "tax_type": "IRPF_PROF", "category": "retencion", "rate": "15.00", "is_active": true }
  ]
}
JSON

The examples use 1 (standard 21% VAT). More details in Spanish taxes.

4. Create a customer

curl https://api.billora.app/api/v1/customers/ \
  -H "Authorization: Bearer $BILLORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "legal_name": "Talleres Martín S.L.",
    "vat_id": "B12345674",
    "party_type": "company",
    "email": "administracion@talleresmartin.es",
    "billing_address": {
      "line1": "Calle Mayor 10",
      "city": "Zaragoza",
      "postal_code": "50001",
      "province": "Zaragoza",
      "country": "ES"
    }
  }'
bash

The API answers 201 Created with the full customer. Before creating customers from an integration, search by tax id first (GET /customers/?search=B12345674) to avoid duplicates.

5. Create the draft invoice

Prices are before tax and amounts are decimal strings ("85.00"). Billora computes the base, VAT, withholdings and total.

curl https://api.billora.app/api/v1/invoices/ \
  -H "Authorization: Bearer $BILLORA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: pedido-2026-1042" \
  -d '{
    "customer": 318,
    "series": 12,
    "due_date": "2026-12-01",
    "notes": "Pedido 2026-1042",
    "lines": [
      {
        "description": "Revisión anual de maquinaria",
        "quantity": "10",
        "unit_price": "85.00",
        "spanish_taxes": [1]
      }
    ]
  }'
bash
{
  "id": 5120,
  "status": "draft",
  "number": null,
  "customer": { "id": 318, "legal_name": "Talleres Martín S.L.", "vat_id": "B12345674" },
  "series": { "id": 12, "code": "F", "name": "Facturas", "type": "INVOICE" },
  "subtotal": "850.00",
  "tax_total": "178.50",
  "withholding_total": "0.00",
  "total": "1028.50",
  "balance": "1028.50",
  "lines": [
    { "id": 9001, "description": "Revisión anual de maquinaria", "quantity": "10.00", "unit_price": "85.00",
      "discount_percent": "0.00", "spanish_taxes": [1], "line_subtotal": "850.00", "line_tax": "178.50", "line_total": "1028.50" }
  ]
}
JSON

The Idempotency-Key header makes sure that, if you repeat the request after a timeout, no second invoice is created. See Idempotency.

6. Issue the invoice

Issuing assigns the series number and issue date (today) and records the invoice in VeriFactu. It cannot be undone.

curl -X POST https://api.billora.app/api/v1/invoices/5120/send/ \
  -H "Authorization: Bearer $BILLORA_API_KEY" \
  -H "Idempotency-Key: emitir-5120"
bash
{
  "number": "F-2026-0001",
  "status": "sent",
  "message": "Factura enviada correctamente",
  "verifactu_processed": true,
  "sent_to_aeat": true
}
JSON

If VeriFactu rejects the record, the API answers 400, the invoice stays as a draft and no number is consumed: fix the problem (for example the customer's tax id) and issue again.

7. Download the PDF

curl https://api.billora.app/api/v1/invoices/5120/download-pdf/ \
  -H "Authorization: Bearer $BILLORA_API_KEY" \
  -o F-2026-0001.pdf
bash

The response is application/pdf. You can also email it to the customer with POST /invoices/5120/email/ and {"to": ["administracion@talleresmartin.es"]}.

8. Record the payment

curl https://api.billora.app/api/v1/payments/ \
  -H "Authorization: Bearer $BILLORA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: cobro-5120-1" \
  -d '{ "invoice": 5120, "amount": "1028.50", "currency": "EUR", "date": "2026-11-15", "reference": "Transferencia 88231" }'
bash

A partial payment leaves the invoice as partially_paid; once payments cover the total it becomes paid. To settle the whole outstanding amount at once there is POST /invoices/{id}/mark-paid/.

Next steps