# Migrating from apiefactura.ro apiefactura.ro is winding down: it no longer accepts new registrations, and all new e-Factura integrations move to Fint. This guide maps the apiefactura.ro API onto Fint's eFactura API so you can switch with minimal changes. > **Same model, different names.** Both APIs are asynchronous and JSON-in: you post one invoice as JSON, the service builds the UBL XML and submits it to ANAF for you, and you poll for the final status. Migration is mostly renaming fields, swapping authentication, and adding a one-time ANAF consent step. ## What changes | Area | apiefactura.ro | Fint | |------|----------------|------| | Base URL | `https://secure.apiefactura.ro/api` | `https://api.fint.ro/v1` | | Auth | `Apikey` + `Apipassword` | `X-Org-Key` + `X-Api-Key` | | Invoice body | JSON wrapped in `documentData` | Flat JSON, no wrapper | | Document id | Numeric `id` | String `uid` | | Errors | Always HTTP 200; branch on `status` | Real HTTP codes; branch on `reason` | | ANAF consent | Handled per license, out of band | Explicit onboarding, required before `/send` | ## Before you start Set up three things in Fint once: 1. **Get two API keys.** Create an organization key at `/ui/organization/apikeys` and a company key at `/ui/company/apikeys`. Both are sent on every request; the company (CUI) is resolved from the company key, so you never pass a CUI for authentication. 2. **Enable the eFactura service** on that company key and on the company's license. 3. **Complete ANAF consent.** This is the one genuinely new step. Before `/send` works, the company must grant Fint access to ANAF e-Factura for its CUI - via the Fint UI or the onboarding endpoint. Without it, `/send` returns `403 efactura_consent_required`. Full detail is in the [eFactura API reference](https://docs.fint.ro/efactura.md). ## Base URL & authentication apiefactura.ro used two custom headers matched against your license. Fint uses two keys as well, but they are separate concerns: an organization key and a company key. | apiefactura.ro | Fint | Notes | |----------------|------|-------| | `Apikey` | `X-Org-Key` | Organization key, format `org_live_…` | | `Apipassword` | `X-Api-Key` | Company key, format `key_live_…` (may also be sent as `Authorization: Bearer`) | > **Check HTTP status codes now.** apiefactura.ro returned `200 OK` for everything and you branched on the JSON `status` field. Fint returns real HTTP codes (`201`, `422`, …) and a stable `reason` string. Branch on `reason`, not on the message text. ## Endpoint mapping | apiefactura.ro | Fint | Notes | |----------------|------|-------| | `POST /sendDocument` | `POST /v1/efactura/send` | Submit one outgoing invoice | | `POST /getDocument` | `GET /v1/efactura/document/{uid}` | The id is now a `uid` in the path, not a body field | | `POST /getDocuments` | `GET /v1/efactura/documents` | Query params `?type=all\|outgoing\|incoming&status&limit&offset` replace the `{start}` cursor | | `POST /downloadPdf` / `downloadZip` | `GET /v1/efactura/download/{uid}?type=pdf\|xml` | Streams the file bytes directly (not a URL to a file); `zip` aliases `xml` | | `POST /testDocument` | Sandbox `POST /v1/efactura/send` | Use the [sandbox](#testing-with-the-sandbox) for dry runs; it checks the document structure only and never touches ANAF | | `GET /testAuth` | - (any authenticated call) | No dedicated endpoint; e.g. call `GET /v1/efactura/documents` to confirm keys | | `GET /getLicense` | `GET /v1/efactura/consent` | Its practical use - "is my access still valid?" - maps to the consent check: returns `consentStatus` and `validUntil`, or `data: null` if no enabled consent. Company/plan metadata lives in the Fint UI, or the [Organization API](https://docs.fint.ro/organization.md) (Enterprise). | ## Invoice payload mapping Drop the `documentData` wrapper and send fields at the top level. Seller and client fields, which were flat, become nested `from` and `to` objects with an `address`. | apiefactura.ro | Fint | Notes | |----------------|------|-------| | `number` | `documentNumber` | Required, non-empty JSON string (`"123"`, not `123`) | | `issueDate` | `documentDate` | `YYYY-MM-DD` | | `currency` | `currency` | **Must be `RON`.** | | `invoiceCode` | `documentTypeCode` | Same UNCL 1001 set: `380`, `381`, `384`, `389`, `751`; default `380` | | `name`, `address`, `city`, `subdivision`, `country` | `from.name`, `from.address.{line, city, countrySubdivision, country}` | Add `from.cui` - your company CUI, which **must equal the enabled consent CUI**. On apiefactura.ro the seller CUI came from the license; on Fint you send it explicitly. | | `clientCui`, `clientName`, `clientAddress`, `clientCity`, `clientSubdivision`, `clientCountry` | `to.cui`, `to.name`, `to.address.{line, city, countrySubdivision, country}` | B2C: use CUI `0000000000000` or the client CNP, as before | | `regCom`, `clientRegCom` | `from.regCom`, `to.regCom` | Trade register numbers, same values and same format (`J40/12813/2016`). `from.regCom` is optional on Fint: leave it out and it is filled from Info CUI by `from.cui`. | | `email` | - (not required) | Fint does not require a seller email | | `iban` + `bank` | `paymentMeans` | Object: `{ paymentMeansCode, iban, paymentId }`, or an array of them for several accounts; `paymentMeansCode` (UNCL 4461, e.g. `30`) required when present | | `note`, `deliveryDate` | `note`, `deliveryDate` | Same, at header level | | `items[].{name, price, quantity, vatRate, vatScheme}` | `items[].{name, quantity, price, vatRate, vatScheme}` | Same fields. VAT schemes unchanged (UNCL 5305: `S`, `Z`, `E`, `AE`, `K`, `G`, `O`, `L`, `M`) | | `items[].vatexCode` | `items[].vatexCode` | Same VAT exemption code; also `vatexReason`, `classificationCode` + `classificationList` | > **Addresses are normalized for you.** As on apiefactura.ro, you do not pre-format addresses to CIUS-RO. Fint accepts county names (e.g. `Cluj`) or codes (`RO-CJ`) and handles Bucharest sectors. `line`, `city`, `countrySubdivision` and `country` are still required on both parties; a Romanian city or county that Fint cannot recognise is corrected from Info CUI by the party's CUI. ## Send example, side by side apiefactura.ro - `POST /sendDocument`: ```json { "documentData": { "number": "INV-1", "issueDate": "2026-03-21", "currency": "RON", "email": "contact@seller.ro", "name": "Seller SRL", "address": "Str. Test 1", "city": "Bucuresti", "subdivision": "Bucuresti", "country": "RO", "clientCui": "12345678", "clientName": "Buyer SRL", "clientAddress": "Str. Client 2", "clientCity": "Bucuresti", "clientSubdivision": "Bucuresti", "clientCountry": "RO", "items": [ { "name": "Service", "price": 100, "quantity": 1, "vatRate": 21, "vatScheme": "S" } ] } } ``` Fint - `POST /v1/efactura/send`: ```bash curl -sS -X POST 'https://api.fint.ro/v1/efactura/send' \ -H 'X-Org-Key: YOUR_ORG_KEY' \ -H 'X-Api-Key: YOUR_COMPANY_KEY' \ -H 'Content-Type: application/json' \ -d '{ "documentNumber": "INV-1", "documentDate": "2026-03-21", "currency": "RON", "from": { "cui": "34790982", "name": "Seller SRL", "address": { "line": "Str. Test 1", "city": "Bucuresti", "postalCode": "010001", "countrySubdivision": "Bucuresti", "country": "RO" }, "regCom": "J40/12813/2016" }, "to": { "cui": "12345678", "name": "Buyer SRL", "address": { "line": "Str. Client 2", "city": "Bucuresti", "postalCode": "010002", "countrySubdivision": "Bucuresti", "country": "RO" }, "regCom": "J40/8853/2015" }, "items": [ { "name": "Service", "quantity": 1, "price": 100, "vatRate": 21, "vatScheme": "S" } ] }' ``` Success response: ```json { "status": "success", "msg": "Document has been validated with Fint. Pending upload and ANAF confirmation.", "reason": null, "data": { "uid": "Xk7pQ2mZ9vLw4RtB8nYc3HsJ6dFg1aEu", "status": "pending" } } ``` Keep the `uid`: you use it to poll status and to download the PDF or signed XML. ## Document status The lifecycle is the same shape with renamed states. Poll `GET /v1/efactura/document/{uid}` until the status is final: `validated`, `rejected` or `failed`. A document can stay `pending` with an `errorMessage` while Fint retries a failed upload, so poll with a timeout. | apiefactura.ro | Fint | Meaning | |----------------|------|---------| | `lobby` | `pending` | Validated by the service, queued for ANAF upload | | `pending` | `sent` | Uploaded to ANAF, awaiting confirmation | | `validated` | `validated` | Accepted by ANAF | | `errors` | `rejected` | ANAF rejected it (see `errorMessage`). Fint also has `failed`: the upload to ANAF failed 12 times and Fint stopped retrying. | Incoming documents (your inbox) are no longer a separate endpoint - list them with `GET /v1/efactura/documents?type=incoming`. ## Error handling apiefactura.ro returned `{ status, message, errors[] }` at HTTP 200. Fint returns `{ status, msg, reason, data }` with a real HTTP code; validation failures list machine-readable codes under `data.errors[]`. | Case | apiefactura.ro | Fint | |------|----------------|------| | Bad credentials | 200, `"API autentification failed."` | `401 invalid_api_key` / `invalid_org_api_key` (wrong key; `missing_api_key` / `missing_org_api_key` when a header is absent), `403` for a disabled key, license or service (e.g. `api_key_disabled`) | | Invalid invoice | 200, `errors[]` strings | `422 validation_failed`, `data.errors[].code` | | Duplicate number | 200, `"Duplicated document number"` | `409 duplicate_document`, `data.existingDocumentUid` (only while the earlier document with that number and seller CUI is `pending` or `sent`; a number already `validated`, `rejected` or `failed` is accepted again) | | Quota reached | 200, `"License document limit has been reached."` | `429 limit_exceeded` | | No consent | - (consent handled per license) | `403 efactura_consent_required` | ## Testing with the sandbox apiefactura.ro's `testDocument` validated a document without uploading. On Fint, use the mocked [sandbox](https://docs.fint.ro/sandbox.md) at `https://sandbox.fint.ro/v1`: same paths and envelope and the same structural checks, but it never touches ANAF. The live API also builds the UBL, normalizes addresses, runs ANAF validation and checks for duplicates, so a document the sandbox accepts can still get `422` or `409` live. - Generate separate sandbox keys (`org_sandbox_…`, `key_sandbox_…`) from the same API-keys pages; live keys are rejected on the sandbox, and sandbox keys are rejected on the live API. - The sandbox consent CUI is `123456`, so `from.cui` must be `123456` (or `RO123456`) there. See the [Sandbox API](https://docs.fint.ro/sandbox.md) and the full [eFactura reference](https://docs.fint.ro/efactura.md) for every field, error code, and example.