Integrations

HTTP API

Call the live demo’s Romania-first validation engine and convert canonical invoices over versioned HTTP. Validate UBL 2.1 Invoice or CreditNote XML, or send canonical invoice JSON and receive UBL XML when the generated document passes every pinned check.

Authentication

Both POST /api/v1/preflight and POST /api/v1/convert require a valid API key on every request.

The browser demo at /demo/ does not require a key. It uses the same validator under a separate limit of 20 requests per 60-second window from your network address.

Pre-flight validation

Each stages entry has stage and outcome (passed or failed). Only completed stages appear; stage outcomes account for all findings even when the findings list is truncated. Each finding has rule_id, severity, stage, location, and message. The optional summary contains the parsed canonical model using Python field names.

Client errors use {"error": {"code": "...", "message": "..."}} instead of the validation response. 400 covers empty bodies, invalid UTF-8, malformed or unsafe XML, unsupported UBL roots, and excessive element counts; 413 covers oversized bodies; 415 covers missing or unsupported content types. Unsupported HTTP methods return 405 without the JSON error contract.

Responses use Cache-Control: no-store. XML is processed in memory only; it is not written to disk or logged as invoice content.

Example

Bundled fictional sample valid.xml - same invoice as the demo’s passing scenario.

curl -sS -X POST 'https://einvoice.adrianprofir.com/api/v1/preflight' \
  -H 'Authorization: Bearer <your-api-key>' \
  -H 'Content-Type: application/xml' \
  --data-binary @invoices/samples/valid.xml

Canonical to UBL conversion

Malformed JSON, unknown terms, or missing required business fields return 400 with INPUT-MODEL. Unsupported UBL bindings or XML-incompatible values also return 400; OUTPUT-SIZE indicates that the generated document exceeds the conservative 256 KiB construction budget or the final XML size limit.

Example

Request body: canonical JSON with BT/BG keys and model_version EN 16931-1:2017. See the field glossary in canonical model glossary. Download a fictional worked example as a starting point: b2b_invoice.json (invoice) or credit_note.json (credit note). You can also POST bundled valid.xml to pre-flight and reuse the summary object from the JSON response as the convert body (same shape the model accepts).

curl -sS -X POST 'https://einvoice.adrianprofir.com/api/v1/convert' \
  -H 'Authorization: Bearer <your-api-key>' \
  -H 'Content-Type: application/json' \
  --data-binary @my-canonical-invoice.json

Same safety as the demo

Limits and behaviour

Subprocess isolation with the same wall-clock and CPU limits, DOCTYPE and external entity rejection, local XSD imports only, and disabled Saxon URI access. CSRF protection applies to the HTML demo form only, not these JSON endpoints.

Not included yet

Self-service signup, billing plans, ANAF submission, and persistence of submitted invoices remain out of scope.

Try interactively

Prefer a browser walkthrough first? Open the live validator with bundled samples and a readable summary layout.