Documentation

4invoices documentation has two layers: the panel, which you use without writing code, and the public API, through which your own system issues invoices and carries the document through the national e-invoicing circuit (in Romania, ANAF e-Factura). This page is the entry point to the second layer.

Open the full API reference →

What you can automate

The public API covers issuing invoices and proformas, credit notes, clients with a check in the company registry (in Romania, the ANAF registry), numbering series and the whole national e-invoicing round-trip (in Romania, e-Factura): CIUS-RO preflight, SPV submission, status tracking, the signed response and the inbox of invoices your suppliers sent you.

https://api.4invoices.net/v1 · 25 endpoints · OpenAPI spec (no key needed)

invoices:read · invoices:write · clients:read · clients:write · efactura:read · efactura:submit

Authentication

Before your first callInvoicing → Settings → API access
bash
curl -sS -X POST https://api.4invoices.net/v1/auth/token \
  -H 'Content-Type: application/json' \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "cli_XXXXXXXXXXXX",
    "client_secret": "sec_XXXXXXXXXXXXXXXXXXXX"
  }'

# → {"access_token":"eyJ...","token_type":"Bearer","expires_in":3600,
#    "scope":"invoices:read invoices:write efactura:submit"}
Server-to-server only. Never call the API from browser JavaScript: the client_secret would reach the visitor, and CORS blocks every origin anyway.

Your first invoice in 6 steps

  1. Mint a credential in the panel under Invoicing → Settings → API access and copy the client_secret — it is shown once.
  2. Complete the company profile and activate at least one series of kind fiscale, otherwise issuance returns issuer_profile_incomplete or no_series_configured.
  3. Exchange the credential for a token: POST /v1/auth/token with grant_type client_credentials. The token lasts one hour — cache it, do not mint one per request.
  4. Issue the invoice: POST /v1/invoices with an Idempotency-Key header and vat_rate as a percent (21, not 0.21).
  5. For the Romanian market, run the CIUS-RO preflight with POST /v1/invoices/{id}/efactura/validate, then send it to ANAF with POST /v1/invoices/{id}/efactura/submit.
  6. Track the state with GET /v1/efactura/submissions/{id} until it reaches accepted or rejected.
bash
# 1 — token (1 hour, cache it)
ACCESS_TOKEN=$(curl -sS -X POST https://api.4invoices.net/v1/auth/token \
  -H 'Content-Type: application/json' \
  -d '{"grant_type":"client_credentials","client_id":"cli_XXX","client_secret":"sec_XXX"}' \
  | python3 -c 'import sys,json; print(json.load(sys.stdin)["access_token"])')

# 2 — issue the invoice (Idempotency-Key is REQUIRED)
curl -sS -X POST https://api.4invoices.net/v1/invoices \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: order-10457-invoice' \
  -d '{"buyer":{"name":"Exemplu Comert SRL","tax_id":"RO12345678","county":"Cluj","city":"Cluj-Napoca","country":"RO"},
       "lines":[{"description":"Abonament SaaS","quantity":1,"unit_price":400,"vat_rate":21}]}'

# 3 — preflight CIUS-RO, then send to ANAF
curl -sS -X POST https://api.4invoices.net/v1/invoices/inv_01J7ABC/efactura/validate \
  -H "Authorization: Bearer $ACCESS_TOKEN"

curl -sS -X POST https://api.4invoices.net/v1/invoices/inv_01J7ABC/efactura/submit \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Idempotency-Key: efactura-inv_01J7ABC-1'

Guides by topic

Each topic has its own page with the relevant endpoints, samples and errors.

Open the full API reference →