---
title: "Export e-invoice XML"
method: POST
path: "/v1/invoices/{invoiceId}/einvoice/export"
tags: ["E-Invoicing"]
---

# Export e-invoice XML

`POST /v1/invoices/{invoiceId}/einvoice/export`

## Request

- Base URL: `https://api.frihet.io`
- URL: `https://api.frihet.io/v1/invoices/{invoiceId}/einvoice/export`
- Auth: API key in header `X-API-Key`

Generate and return an e-invoice XML document for the invoice in one of 9 supported formats.
Optionally sign with XAdES-EPES (Facturae only). Conforms to EN16931 semantic model.

Supported formats: Facturae 3.2.2, XRechnung-CII, XRechnung-UBL, Factur-X (EN16931),
FatturaPA 1.2.2, PEPPOL-BIS-3, FA-2-KSeF (Polish KSeF FA(3)), UBL 2.1, CII D16B.

**Trust Area: COMPLIANCE** — Requires owner role or API key with `einvoice:*` scope.

## Path parameters

- `invoiceId` string, required

## Request body

- object
  - `format` 'Facturae' | 'XRechnung-CII' | 'XRechnung-UBL' | 'Factur-X' | 'FatturaPA' | 'PEPPOL-BIS-3' | 'FA-2-KSeF' | 'UBL' | 'CII', required: Target e-invoice format. - Facturae: Spanish B2G (Agencia Tributaria, FACe) - XRechnung-CII/UBL: German B2G (PEPPOL/ZRE/OZG-RE) - Factur-X: French standard (PDF/A-3 XML component) - FatturaPA: Italian SDI clearance - PEPPOL-BIS-3: Pan-European PEPPOL network - FA-2-KSeF: Polish KSeF FA(3) XML - UBL/CII: Generic cross-border EU
  - `signed` boolean: Sign the XML with XAdES-EPES. Only supported for `format: Facturae`. Requires a valid PKCS#12 certificate uploaded in Settings > Compliance.

## Response `200`

E-invoice XML generated successfully

- object
  - `data` object
    - `xml` string: E-invoice XML content (UTF-8)
    - `contentType` string
    - `filename` string
    - `signed` boolean: Whether the XML was signed with XAdES-EPES
    - `format` string

## Other responses

- `400`: Invalid format, signing not supported for this format, or body validation error
- `401`: Authentication required or invalid API key
- `403`: Insufficient permissions
- `404`: Resource not found
- `422`: XML generation failed or certificate not configured
- `429`: Rate limit exceeded (100 requests per minute)
- `500`: Internal server error

---

[API](https://skmtc.dev/frihet/apis/frihet-api.md) · [All operations](https://skmtc.dev/frihet/apis/frihet-api/llms.txt) · [OpenAPI document](https://skmtc.dev/frihet/apis/frihet-api/revisions/3dd37f6a72d1?raw)
