Skip to content

About

Official TypeScript/JavaScript SDK for RechnungsAPI (rechnungsapi.de): create, validate and analyze ZUGFeRD & XRechnung e-invoices in a few lines of code.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

RechnungsAPI: the XRechnung and ZUGFeRD API for developers

npm version npm downloads per month tests TypeScript types included zero runtime dependencies MIT license

rechnungsapi-sdk

E-invoices in a few lines of code.
The official TypeScript/JavaScript SDK for RechnungsAPI: create, validate and read ZUGFeRD and XRechnung invoices.

Germany's e-invoicing obligation (E-Rechnungspflicht) is being phased in, and structured invoices such as XRechnung and ZUGFeRD are becoming the standard. RechnungsAPI is the REST API that takes care of the hard parts, and this SDK is the quickest way to use it from Node.js, serverless functions and any TypeScript backend.

Start free · Try the free XRechnung validator · Pricing · Documentation

What you can do

Create Turn invoice JSON into a ZUGFeRD PDF/A-3 or an XRechnung XML, using your own invoice templates
Validate Check XRechnung XML and ZUGFeRD PDFs against the schema and the business rules before you send them
Read Extract structured data from PDFs, scans and photos of invoices with AI-powered recognition
Convert A scan or PDF goes in, a validated ZUGFeRD PDF comes out, in one call
Send Generate the invoice and email it in the same call, DKIM-signed, without any mail infrastructure of your own

Quick start

npm install rechnungsapi-sdk
  1. Create a free account, open your Profile and copy your API token.
  2. Keep it in an environment variable and never commit it: RECHNUNGSAPI_TOKEN=your-token-here
  3. Make your first calls:
import { RechnungsApiClient } from "rechnungsapi-sdk"

const client = new RechnungsApiClient({ apiToken: process.env.RECHNUNGSAPI_TOKEN! })

// 1. Create a ZUGFeRD e-invoice (a PDF with the structured XML embedded) from your invoice data
const zugferd = await client.createZugferdFromJson(
  { invoiceNumber: "RE-2026-001", /* seller, buyer, lines, totals ... */ },
  invoicePdfBase64, // your invoice layout as a base64 PDF
)

// 2. Validate an XRechnung before you send it
const validation = await client.validateXRechnungXml(xmlString)
if (!validation.isValid) {
  console.log(validation.messages)
}

// 3. Turn a scan or a PDF invoice into structured data
const extracted = await client.analyzePdfInvoiceV2(pdfBase64, /* withLineItems */ true)

The invoice objects follow EN 16931. The Invoice Object Reference lists every field and which ones are mandatory.

Generate and send in one call

Add a transport option and the generated invoice is emailed in the same call:

await client.createXRechnungFromJson(
  { invoiceNumber: "RE-2026-002", /* ... */ },
  {
    transport: {
      type: "email",
      useTransport: true,
      sender: "[email protected]",
      senderName: "Your Company",
      receiver: "[email protected]",
      subject: "Invoice {invoicenumber} from {invoicedate}",
      message: "<p>Hello, please find invoice {invoicenumber} attached.</p>",
    },
  },
)

Email delivery is switched on per account and needs your sender domain authenticated once. See Email Transport.

Why RechnungsAPI

  • One API for the formats that matter. ZUGFeRD, XRechnung and Factur-X compliant.
  • Compliance built in. Built for EN 16931, GoBD and GDPR, with data processed on German servers.
  • Works with what you have. Keep your existing PDF layouts and workflows; it is a plain REST API, so it fits ERP systems and custom software alike.
  • Developer first. A typed SDK with zero runtime dependencies, documentation in English and German, and an AI integration assistant on rechnungsapi.de that maps your fields and writes code stubs.
  • Free to start. Try it without a credit card.

Built for

  • Small and medium businesses that want to modernise invoicing without changing how they work.
  • Software vendors and IT teams adding e-invoicing to an ERP or a custom system.
  • Tax advisors who help clients move to e-invoices.

Use it from AI agents

Prefer to let your AI assistant do the work? rechnungsapi-mcp is the official MCP server for RechnungsAPI. Connect it once, then ask in plain language to validate an XRechnung, read a scanned invoice or create a ZUGFeRD PDF.

API reference

Method Description API docs
createZugferdFromJson(invoice, invoicePdf64, options?) Create a ZUGFeRD PDF/A-3 from structured invoice JSON docs
createXRechnungFromJson(invoice, options?) Create an XRechnung XML from structured invoice JSON docs
createZugferdPdf(invoicePdf64, xrechnungXml) Embed an existing XRechnung XML into a visual PDF docs
extractXRechnungFromZugferd(zugferd64) Extract the embedded XRechnung XML from a ZUGFeRD PDF as JSON docs
validateXRechnungXml(xml) Validate an XRechnung XML against schema and business rules docs
validateZugferdPdf(zugferdFile64, options?) Validate a ZUGFeRD PDF's embedded XML docs
analyzePdfInvoice(pdfBase64) Extract structured JSON from a PDF/scanned invoice (sync) docs
analyzePdfInvoiceV2(pdfBase64, withLineItems?) High-accuracy analyzer, optional line-item extraction docs
analyzePdfInvoiceAsync(pdfBase64, withLineItems?) / getAnalysisStatus(jobId) Async analysis for large files submit / status
createZugferdFromPdf(pdfBase64, fileName?) Convert a PDF/scan directly into a validated ZUGFeRD PDF docs

Errors are thrown as RechnungsApiError (with .status and .body), or ValidationFailedError for HTTP 412 responses (missing mandatory invoice fields). What each status code means is described under Errors in the API documentation.

By default the client talks to the production gateway (https://api.rechnungsapi.de). To point it at a different gateway, pass baseUrl:

const client = new RechnungsApiClient({
  apiToken: process.env.RECHNUNGSAPI_TOKEN!,
  baseUrl: "https://your-gateway.example.com",
})

Documentation

The complete API reference, with every endpoint, request, response and error code, is at rechnungsapi.de/api-docs (English and German).

Start free

RechnungsAPI is free to start, with no credit card required. Create your account, copy your token and make your first call in minutes. Questions about plans, integration or your project? Talk to us or write to [email protected].

Development

yarn install
yarn test
yarn build

Found a security problem? Please read SECURITY.md.

License

MIT © RechnungsAPI · rechnungsapi.de · [email protected]

About

Official TypeScript/JavaScript SDK for RechnungsAPI (rechnungsapi.de): create, validate and analyze ZUGFeRD & XRechnung e-invoices in a few lines of code.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages