@gaperi/fiscura-sdk
v0.1.0
Published
TypeScript SDK for the Fiscura e-Factura / EN 16931 API — validate, generate, convert and extract Romanian e-invoices.
Maintainers
Readme
@gaperi/fiscura-sdk
TypeScript SDK for the Fiscura e-Factura / EN 16931 API — validate, generate, convert, and extract Romanian e-invoices from your own code. Works in Node 18+ and the browser.
npm i @gaperi/fiscura-sdkGet a free API key (100 calls/day, no card, no account) at https://fiscura.ro/free-key — or subscribe at https://fiscura.ro/pricing for production volume. Full endpoint docs and copy-paste examples: https://fiscura.ro/docs. The free web validator needs no key; the rest of the API does.
Quick start
import { Fiscura } from "@gaperi/fiscura-sdk";
const fiscura = new Fiscura({ apiKey: process.env.FISCURA_API_KEY! });
// Validate — see exactly which EN 16931 / CIUS-RO rules fail, explained.
const result = await fiscura.validate(xml, { profile: "ro" });
if (!result.valid) {
for (const e of result.errors) {
console.log(e.ruleId, e.explanation?.en ?? e.message);
}
}API
new Fiscura({ apiKey, baseUrl?, fetch? })
fiscura.validate(xml, { profile?: "ro" | "en16931", explain?: boolean }): Promise<ValidateResponse>
fiscura.generate(input): Promise<GenerateResponse> // JSON → RO_CIUS UBL 2.1
fiscura.convert(xml, target: "ubl" | "cii"): Promise<ConvertResponse>
fiscura.extract(pdfBase64): Promise<ExtractResponse> // invoice PDF → structured dataEvery response is fully typed. A non-2xx throws FiscuraError (with .status and .code).
baseUrldefaults tohttps://fiscura.ro/api.fetchdefaults to the globalfetch; pass one for older runtimes.
Not tax advice
Validation runs the official EN 16931 + CIUS-RO Schematron artefacts. Fiscura provides information, not tax advice — for your specific situation, consult a licensed accountant or ANAF.
MIT © Gaperi
