Which API do you need?
| AI Invoice API | Account API | |
|---|---|---|
| For | One Swiss invoice PDF with a QR-bill | Clients, invoices, expenses and bank accounts in a Magic Heidi account |
| Access | Free, no account and no API key | API key from your Magic Heidi account |
| Base URL | https://api.magicheidi.ch/v1/ai-invoice | https://api.magicheidi.ch/v1 |
| Data | Nothing stored; only the "link back" option keeps the PDF for 24 hours | In your account |
| Docs | AI Invoice API with live demo, guide for AI models | Interactive reference, OpenAPI |
AI Invoice API: a QR invoice PDF, no sign-up
Built for AI assistants such as ChatGPT and Claude, and usable from any program. You send the invoice data as JSON; the API puts the SIX payment part with the Swiss QR code at the bottom of the last page. It supports IBANs from Switzerland and Liechtenstein, CHF and EUR, invoices in German, French, Italian and English, and all three reference types: QR-IBAN with QR reference, regular IBAN with creditor reference (SCOR) or without reference.
curl -X POST https://api.magicheidi.ch/v1/ai-invoice \
-H "Content-Type: application/json" \
-H "Accept: application/pdf" \
-d '{
"language": "en",
"currency": "CHF",
"creditor": {"name": "Lea Brunner Graphic Design", "street": "Kramgasse", "building_number": "12",
"postal_code": "3011", "city": "Bern", "country": "CH", "iban": "CH9300762011623852957"},
"invoice": {"number": "2026-041", "date": "2026-11-30"},
"items": [{"description": "Flyer design", "quantity": 8, "unit": "h", "unit_price": 95}]
}' -o invoice.pdf
- Three ways to get the PDF: a GET link with the JSON in the
dataparameter (nothing stored), a POST that returns a link (the PDF stays available for 24 hours, then it is deleted), or a POST withAccept: application/pdf(the PDF file itself, nothing stored). - Your own design: with nothing extra you get the default template.
cssrestyles it,htmlreplaces the whole invoice body.GET /v1/ai-invoice/template?language=enreturns the template. - Always included: the "Created with Magic Heidi" banner right above the payment part, and the payment part itself.
- Rules: no JavaScript, no external resources (logos as
data:URIs), size and page limits, rate limits per IP address. - Errors come back as
{"success": false, …}with messages that say what to fix.
All fields, the three ways with examples and a live demo are on the AI Invoice API page.
Account API: working inside your Magic Heidi account
With the Account API your programs create and read clients, invoices and expenses directly in your Magic Heidi account, for example to issue invoices in bulk or connect a shop. Whatever you create through the API then shows up in the app.
- Authentication: an API key from your account, sent as the
X-API-Keyheader or asAuthorization: Bearer. - Resources: clients, invoices, saved line items, categories, expenses, bank accounts and letters.
- Reference: api.magicheidi.ch/v1/docs (interactive) and openapi.json.
curl https://api.magicheidi.ch/v1/clients -H "X-API-Key: YOUR_API_KEY"
To connect Magic Heidi to other apps without code, use Zapier.
QR-IBAN or regular IBAN?
QR-IBAN: recognisable by the institution ID (digits 5 to 9) between 30000 and 31999. It always requires the 27-digit QR reference, which lets you match every payment to its invoice. Your bank issues a QR-IBAN in addition to your regular IBAN.
Regular IBAN: works without a reference, with the invoice number in the message, or with an ISO 11649 creditor reference (starts with RF). This is the right choice for most freelancers.
Not allowed: a QR reference with a regular IBAN, or a QR-IBAN without a QR reference.
Check before going live
- Test with made-up businesses and a test IBAN such as
CH93 0076 2011 6238 5295 7, not with real client data. - Check totals, rounding, language and VAT details in the PDF.
- Scan the QR code with a banking app without paying, and compare payee, IBAN, amount and reference. Templates you use often are worth checking with the SIX validation tools as well.
- A QR PDF does not prove a payment arrived. Matching payments needs bank data, for example through the bank import in Magic Heidi.
Questions about the API? Write to hello@magicheidi.ch.
