Skip to content

Quickstart Guide

Generate your first EN 16931 compliant e-invoice in less than 5 minutes.

In this guide, we will generate a ZUGFeRD 2.2 (PDF/A-3) invoice using a simple cURL request.

Prerequisites

Before you begin, ensure you have:

  1. Created an account on the Dashboard.
  2. An active subscription.
  3. Generated an API Token in your settings.

Step 1: Prepare the JSON

Create a file named invoice.json. This contains the business data for your invoice.

IMPORTANT: Integer Logic

  • Amounts are in Cents: 10000 = 100.00 €
  • Tax Rates are in Basis Points: 1900 = 19.00%

Paste the following content into invoice.json:

json
{
    "document_number": "QS-2024-001",
    "date": "2024-01-27",
    "type": "380",
    "currency_code": "EUR",
    "recipient": {
        "name": "Demo Client GmbH",
        "street": "Musterstrasse 1",
        "zip": "10115",
        "city": "Berlin",
        "country_code": "DE"
    },
    "items": [
        {
            "description": "Web Development Services",
            "quantity": 10,
            "unit_code": "HUR",
            "unit_price": 10000,
            "tax_type": "S",
            "tax_rate": 1900
        }
    ],
    "pdf_presentation": {
        "theme": "modern",
        "primary_color": "#3b82f6",
        "currency_as_symbol": true
    }
}

Step 2: Send the Request

We will send a POST request to the generation endpoint. Replace YOUR_API_TOKEN with your actual token.

bash
curl -X POST https://api.invoiceable.com/v1/generate/json/zugferd \
    -H "Authorization: Bearer YOUR_API_TOKEN" \
    -H "Content-Type: application/json" \
    -H "Accept: application/pdf" \
    -d @invoice.json \
    --output invoice.pdf
javascript
const token = 'YOUR_API_TOKEN';
const data = { /* ... JSON from Step 1 ... */ };

fetch('https://api.invoiceable.com/v1/generate/json/zugferd', {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json',
    },
    body: JSON.stringify(data)
})
.then(response => response.blob())
.then(blob => {
    // Handle PDF Blob
    console.log('Invoice generated!');
});

Step 3: Check the Result

If the request was successful (HTTP 200), you will find a file named invoice.pdf in your current directory.

Open it to see:

  • A visual PDF representation (using the "modern" theme).
  • An embedded factur-x.xml file (check the attachments panel in Acrobat Reader).

Troubleshooting

If you receive an error, check the HTTP status code:

  • 401 Unauthorized: Your token is missing or invalid.
  • 422 Unprocessable Entity: Your JSON data is invalid (e.g., missing required fields). The response body will contain the exact error message.

Common Mistake

Don't send floats! Sending "unit_price": 100.00 will result in a validation error. Always use integers: "unit_price": 10000.

Next Steps

  • Explore the API Reference for all available fields.
  • Learn about White Labeling to customize the PDF.