Authentication and API keys

How to authenticate requests with API keys, which scopes exist, who can manage keys and how to rotate them without downtime.

The API is authenticated with API keys: secret keys that start with blr_, belong to one organization and carry a set of permissions (scopes).

Sending the key

Send the key in the Authorization header with the Bearer scheme. This is the recommended format:

GET /api/v1/invoices/ HTTP/1.1
Host: api.billora.app
Authorization: Bearer blr_8fK2…
HTTP
curl https://api.billora.app/api/v1/customers/ \
  -H "Authorization: Bearer $BILLORA_API_KEY"
bash

For backwards compatibility these two forms are also accepted and behave the same:

HeaderExampleUse
Authorization: BearerAuthorization: Bearer blr_…Recommended. Works with OpenAPI generators and most HTTP clients.
Authorization: ApiKeyAuthorization: ApiKey blr_…Previous format; still supported.
X-Api-KeyX-Api-Key: blr_…For tools that can't set Authorization.

A Bearer value starting with blr_ is always treated as an API key. The key identifies the organization: don't send X-Organization-Id (it is ignored).

Never in the browser or a mobile app

An API key gives access to your organization's invoicing data. Use it only from servers. Don't ship it in web JavaScript or a mobile app, don't commit it, and don't put it in URLs (query strings end up in logs).

Creating an API key

Keys are created in Settings → API in the app. You need:

  • A plan with API access (Pro or Business).
  • To be an owner (OWNER) or admin (ADMIN) of the organization. Only these roles can create, list, rename, rotate or revoke keys.

When creating it you choose a name, the scopes and, optionally, an expiry date. The full key is shown only once; Billora only stores a hash and its prefix (so you can recognize it in the list next to its last-used date).

Scopes

Each scope looks like resource:read or resource:write. write includes read for the same resource. Give each key only what it needs.

ScopeAllows
invoices:readRead invoices, quotes, proformas, credit notes, third-party invoices, recurring invoices, income categories and payment methods; download PDF and Facturae.
invoices:writeCreate, edit and delete drafts; issue (number and record in VeriFactu), cancel, correct, convert, email and create payment links. Includes irreversible actions.
contacts:readRead customers, suppliers, contact people, addresses, tags and payment terms.
contacts:writeCreate, edit and delete all of the above.
products:readRead products, units and tax templates.
products:writeCreate, edit and delete products, units and tax templates.
payments:readRead invoice payments and expense payments.
payments:writeRecord, edit and delete invoice and expense payments.
expenses:readRead expenses, categories, expense payment methods and document scans.
expenses:writeCreate, edit, confirm and delete expenses and categories; upload documents for scanning.
series:readRead numbering series.
taxes:readRead tax rates (VAT, IGIC, IRPF, surcharge…), regimes, templates and the tax configuration.
webhooks:readRead webhook endpoints, events and deliveries.
webhooks:writeCreate, edit, test and delete endpoints, rotate secrets and redeliver.
files:readDownload generated files (bulk PDF downloads as ZIP) and read scans.
files:writeUpload documents for scanning (OCR).
cases:readRead cases, parties, actions, folders, files and linked documents.
cases:writeCreate, edit and delete cases and their content, including file uploads.
crm:read / crm:writePipelines, stages, leads, opportunities, activities and notes.
agenda:read / agenda:writeEvent types, bookings and availability.
accounting:readChart of accounts, fiscal years, journal entries, general ledger and accounting reports.
accounting:writeCreate and edit fiscal years (and close them), accounts and journal entries (and post them), the accounting settings, and initialize the PGC PYMES chart of accounts.
treasury:readTreasury: bank accounts, imported statements, bank transactions with their reconciliation suggestions, rules, bank vs. ledger summary and settings. Status, accounts, sync history and queries of the Revolut Business integration.
treasury:writeCreate and edit bank accounts and rules, import statements (Norma 43, CSV, XLSX), reconcile transactions (payments, transfers, taxes, payroll, fees), accept suggestions, ignore and undo reconciliations. Configure the Revolut Business connection, link accounts, sync, register the webhook and create payment drafts.
reports:readTax and VAT reports, tax forms (303, 130, 111, 347…) and dashboard indicators.
reports:writeManually adjust editable boxes of tax forms.
purchases:read / purchases:writePurchase orders, vendor bills (approve, cancel, PDF, email) and vendor payments.
settings:read / settings:writeOrganization data (profile, tax details, logo), numbering series, tax configuration, invoice designs and email templates.
templates:read / templates:writeWord templates for cases, clinic and consents, and generating documents from them.
hr:read / hr:writeHR: employees, departments, positions, work centers, contracts, schedules, leave, holidays, time entries, payroll and documents.
clinica:read / clinica:writeClinic: patients, episodes, allergies, medical history, vitals, consents, diagnoses, treatments and clinical files. Health data: every access is audited.
signatures:read / signatures:writeDigital signature requests: create, send, remind, cancel and download the signed PDF, evidence and certificate.
imports:read / imports:writeExcel imports (upload, validate, process and check the per-row result).
verifactu:read / verifactu:writeVeriFactu records and their submission status with the AEAT; retry submissions and register invoices (irreversible).
audit:readThe organization's audit log (creations, changes, deletions and access to clinical data).
sms:read / sms:sendSMS balance, bundles and history; sms:send sends SMS (uses credits).
account:readAccount summary (plan, modules and usage), members, plans, features and integration status (no tokens).

For SMS the write level is called send: sms:send includes sms:read.

Some operations require more than one scope (the key needs all of them):

  • Generating documents from templates: templates:read plus cases:read (cases) or clinica:read (patients and consents).
  • Imports: besides imports:write, the write scope of the imported resource (contacts:write for customers, suppliers and contacts; products:write; invoices:write for invoices and third-party invoices; expenses:write).

The reference shows the scope each operation requires (x-scope). If the key lacks the required scope, the API answers 403 with "code": "insufficient_scope" and the missing scope in required_scope:

{
  "detail": "Tu API key no tiene permisos para este recurso.",
  "code": "insufficient_scope",
  "required_scope": "invoices:write",
  "request_id": "req_01JBQ7X9K2M4N6P8R0S2T4V6W8"
}
JSON

Which endpoints accept API keys

An API key only works on the public API endpoints, the ones listed in the reference. The app's account and session endpoints (profile, password, 2FA, subscription, managing API keys themselves, Claude connections…) reject API keys with 403 api_key_not_allowed, even if the key has every scope.

When a key stops working

SituationResponse
Unknown or revoked key401 authentication_failed
Expired key401 api_key_expired
No authentication header401 not_authenticated
The user who created it is no longer active or no longer an owner/admin403 api_key_creator_inactive
The organization's plan no longer includes API access403 plan_no_api_access
Endpoint not available with API keys403 api_key_not_allowed
Missing scope403 insufficient_scope

Keys are tied to their creator

A key acts under the responsibility of whoever created it. If that person leaves the organization or loses the admin role, their keys stop working. For long-lived integrations, create keys with a stable admin user.

Rotation and revocation

Rotate keys periodically and whenever you suspect one has been exposed.

Zero-downtime rotation (recommended):

  1. Create a new key with the same scopes.
  2. Deploy your integration with the new key.
  3. Check in Settings → API that the new key shows usage (“last used”) and the old one no longer does.
  4. Revoke the old key.

From the same screen you can also:

  • Rotate a key: Billora generates a new secret with the same name, scopes and expiry, and shows it once. The previous secret stops working right away (and the key becomes tied to whoever rotated it), so use it when you can update the integration immediately or when the key has leaked.
  • Revoke a key: it is rejected immediately and cannot be reactivated.

Best practices

  • One key per integration and environment, with a descriptive name, so you can revoke one without affecting the rest.
  • Least privilege: if you only read invoices for your BI, invoices:read is enough.
  • Keep the key in a secrets manager or environment variable, never in code.
  • Set an expiry date on temporary keys (tests, external consultants).
  • Log the X-Request-Id of every response: support will ask for it.
  • If a key leaks, revoke it first and create a new one afterwards.