Turn an XRechnung, UBL or CII invoice into a ZUGFeRD or Factur-X PDF/A-3 with one REST call. Charged only when the file validates.
This capability is in beta: it works and is tested, and we may still change details.
On this page
The Klarbon ZUGFeRD and Factur-X API turns an XRechnung, UBL or CII invoice into a hybrid PDF/A-3: a readable invoice with the structured CII data inside. One REST call returns the PDF and its validation report, and you are charged only when both the invoice rules and an independent PDF/A check pass. Files are processed for the request, without a document archive.
What the API does
POST /api/v1/convert with target=zugferd or target=factur-x writes the PDF, in the EN 16931 profile unless you ask for another.
POST /api/v1/make builds the same PDF from invoice JSON.
The report names the rule set, the profile, the embedded XML file name and the PDF/A result.
What it does not do
ZUGFeRD and Factur-X writing is in beta: it works and is tested, and details may still change. Klarbon does not send invoices. For French invoices in scope of the reform, use an approved platform and confirm which format and profile the recipient accepts.
Quick start
Each snippet is the same call. The end-to-end test runs these snippets against a local Klarbon server and the real validation engine.
Create a key on your account page and put it in KLARBON_API_KEY. Never put it in the address.
using System.Net.Http.Headers;
using System.Text.Json;
using var http = new HttpClient();
var key = Environment.GetEnvironmentVariable("KLARBON_API_KEY");
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", key);
var upload = new ByteArrayContent(await File.ReadAllBytesAsync("invoice.xml"));
upload.Headers.ContentType = new MediaTypeHeaderValue("application/xml");
using var request = new HttpRequestMessage(HttpMethod.Post, "https://klarbon.app/api/v1/convert?target=zugferd") { Content = upload };
request.Headers.Add("Idempotency-Key", "invoice-123456XX-zugferd");
using var response = await http.SendAsync(request);
using var json = JsonDocument.Parse(await response.Content.ReadAsStringAsync());
var result = json.RootElement;
if (!result.GetProperty("ok").GetBoolean())
{
Console.Error.WriteLine($"{(int)response.StatusCode} {result.GetProperty("error")}: {result.GetProperty("message")}");
return 1;
}
var written = result.GetProperty("file");
await File.WriteAllBytesAsync(written.GetProperty("filename").GetString()!,
Convert.FromBase64String(written.GetProperty("content").GetString()!));
Console.WriteLine($"{written.GetProperty("filename")} written, {result.GetProperty("credits").GetProperty("balance")} credits left");
return 0;
What comes back
The answer to the curl call above, recorded from that run with KoSIT XRechnung test suite, business case 01.01a (UBL), Apache-2.0.
Prepaid API packs, bought by card on your account page: 1,000 calls for €39.00, 5,000 calls for €129.00, 25,000 calls for €449.00, 100,000 calls for €990.00, never expiring. Your first key brings 25 free calls once per email address, excluding disposable addresses. Paid calls spend the API balance first, then the same credits as the site. A call that fails costs nothing.
Call
Cost
POST /open
Free, fair use 1,000 a day per account
POST /check
Free within your plan's daily checks (20 a day on the free plan)
POST /convert, POST /make
1 call, only when the written file validates
POST /bank/convert
1 call per started 500 transactions, only when converted
Limits
Files up to 20 MB, PDFs up to 50 pages.
60 requests a minute per key, 120 per account. A per-minute rate-limit refusal carries Retry-After.
Up to 10 keys per account. Idempotency-Key is honoured for 24 hours, so a retry never charges twice.
Errors
Every error is { ok: false, error, message }: a stable code and one plain sentence.
Status
Code
When
401
auth
No key, or an unknown or revoked key.
402
no_credits
The combined API balance and credits cannot cover this call. Nothing was charged; topUpUrl says where to buy.
413
too_large
Over 20 MB or 50 PDF pages.
415
unsupported
A file format the route does not take.
422
invalid
The file could not be read, or the written file did not validate. Not charged.
429
limit
A rate limit or the day's free calls.
503
engine_unavailable
Validation is briefly unavailable. Not charged.
Privacy
Files are processed for the request, without a document archive. Klarbon's application logs carry no file name, no content and no key. The full key is not stored, only an HMAC of it and a short display prefix.
Factur-X and ZUGFeRD are technically identical in their harmonised releases. Klarbon uses the same hybrid PDF writer for both target names. Ask your recipient which version and profile it accepts.
Which profile does the API write?
EN 16931 by default. The profile parameter selects another where the format allows it, and the report says which one was written.
Is the PDF checked as PDF/A-3?
Yes. A file is offered only when the engine checked the finished PDF and it conforms; otherwise the call answers 422 and nothing is charged.
Can I start from data instead of a file?
Yes. The make route takes invoice JSON and returns the same validated PDF.