REST API for developers
Implementation details
Everything you need for a robust integration, each with an example request and response.
Contents
Authentication
Every request to /api/v1/ sends an API key in the header Authorization: Api-Key <key>. The key belongs to your account; requests with it read and change the data of this account.
- Create: in your account under API keys, with a name and a validity. The key is shown only once, right after creating it; copy it then.
- Validity: Unlimited, 30 days, 90 days, 1 year, Custom date. A key with a limited validity is valid until the end of its last day, German time. After that, requests with it are rejected with HTTP 401.
- Revoke: on the same page. Requests with a revoked key are rejected with HTTP 401. Expired keys stay in the list, marked as expired, until you revoke them.
- Store safely: keep the key out of source code and repositories, for example in an environment variable or a secret store, and send it only via HTTPS. If a key may have become known, revoke it and create a new one.
Without the header, with another scheme (e.g. Bearer) or with an unknown key, the response is HTTP 401:
curl "https://www.e-rechnungsfreund.de/api/v1/account/" \
-H "Authorization: Api-Key $API_KEY"
Example response: GET /api/v1/account/ → 401 Unauthorized
{
"type": "https://www.e-rechnungsfreund.de/api/errors/authenticationfailed",
"title": "AuthenticationFailed",
"status": 401,
"detail": "Invalid API key."
}
Errors
Error format (RFC 7807)
All error responses of /api/v1/ are JSON in the format “Problem Details for HTTP APIs” (RFC 7807) with these fields:
type: URL that identifies the kind of error; it ends withtitlein lower case.title: short name of the error, e.g.ValidationError,NotFoundorThrottled.status: the HTTP status code, the same as the status of the response.detail: readable message. Show it or log it, but do not evaluate its text; it may change.
Depending on the error, there are further fields:
code: fixed code of the reason, e.g.confirmation_required(409) orxml_too_large(413). Evaluatecoderather thandetail.errorsandvalidation_errorsfor invalid fields (titleValidationError):errorscontains the messages per field, nested like the request body (list entries as an object with the index as key);validation_errorsis a flat list withfield(path with dots, e.g.items.0.net_price) andmessage.details: the validator messages if a created ZUGFeRD PDF or XRechnung does not pass the check.
Example: invoice.json from the quickstart, but with the issue date in German notation and without the net price of the first line:
{
"issue_date": "01.10.2026",
"items": [
{
"line_id": "1",
"name": "Beratungsleistung",
"quantity": "8",
"unit_code": "HUR",
"tax_category": "S",
"tax_rate": "19.00"
}
]
}
curl -X POST "https://www.e-rechnungsfreund.de/api/v1/invoices/" \
-H "Authorization: Api-Key $API_KEY" \
-H "Content-Type: application/json" \
-d @invoice.json
Example response: POST /api/v1/invoices/ → 400 Bad Request
{
"type": "https://www.e-rechnungsfreund.de/api/errors/validationerror",
"title": "ValidationError",
"status": 400,
"detail": "Invalid input.",
"errors": {
"issue_date": [
"Date has wrong format. Use one of these formats instead: YYYY-MM-DD."
],
"items": {
"0": {
"net_price": [
"This field is required."
]
}
}
},
"validation_errors": [
{
"field": "issue_date",
"message": "Date has wrong format. Use one of these formats instead: YYYY-MM-DD."
},
{
"field": "items.0.net_price",
"message": "This field is required."
}
]
}
Field errors and broken business rules step by step, with rule IDs and the corrected request: Guide: fix errors.
HTTP status codes
Successful requests answer with 200, with 201 when something was created, and with 204 without a body after deleting. The endpoints of the API documentation list the status codes they can return. Meaning and recommended reaction:
| Status | Meaning | Recommended reaction |
|---|---|---|
| 400 Bad Request |
The request is invalid. Invalid fields come with title ValidationError, errors and validation_errors. If a created ZUGFeRD PDF or XRechnung does not pass the check, details contains the validator messages. Other cases have a message in detail. |
Do not repeat the request unchanged. Correct the fields named in validation_errors or the invoice data, then send it again. |
| 401 Unauthorized |
The API key is missing, invalid, expired or revoked, or the header does not have the form Authorization: Api-Key <key>. |
Check the header. Create a new key if the key has expired or was revoked. Do not repeat automatically. |
| 402 Payment Required |
A monthly quota of your plan is used up: invoices or validations. | Do not repeat before the quota resets. GET /api/v1/account/ shows the remaining quotas and the day they reset; a larger plan includes more. |
| 403 Forbidden |
Not allowed: your plan does not include the function (e.g. the export for the tax advisor), the account is limited to checking and reading, the invoice belongs to another account, or a download link is invalid, has expired or was already used. | Do not repeat unchanged. Check the permissions in GET /api/v1/account/ and the message in detail or code; request a new download link. |
| 404 Not Found |
The object does not exist in your account (also for objects of other accounts), the code list is unknown, or a stored file is no longer available. | Check the ID or the path. Do not repeat unchanged. |
| 409 Conflict |
The request conflicts with the state of the invoice, e.g. deleting an invoice that is no longer a draft (code confirmation_required) or creating files for an incoming invoice. code names the reason. |
Evaluate code. To delete an invoice that is no longer a draft, repeat the request with confirm=true only if you really want to delete it. |
| 413 Request Entity Too Large |
The file or the XML exceeds a size limit; code names the limit, e.g. file_too_large or xml_too_large. |
Send a smaller file. Do not repeat unchanged. |
| 422 Unprocessable Entity |
Reading an e-invoice: the XML is not well-formed, is not an invoice in CII or UBL syntax or could not be read (code). |
Check the file. Do not repeat unchanged. |
| 429 Too Many Requests |
A rate limit is exceeded, or an export of the same kind was started too recently. | Wait the number of seconds in the header Retry-After, then repeat the request. |
| 500 Internal Server Error |
Internal error; the response contains no internal details. | Repeat later a few times at most. Before repeating a request that creates something, check whether it was created. If the error persists, contact us. |
| 503 Service Unavailable |
The server or a validator or converter is busy or unavailable right now (code). |
Wait the number of seconds in Retry-After if the header is present, otherwise a few seconds with increasing intervals, then repeat. |
| 504 Gateway Timeout |
A validator or converter took too long (code). |
Repeat later with increasing intervals; for very large files, try a smaller file. |
Rate limits and quotas
Rate limits apply per account; all API keys of an account share them:
- All requests: 120 requests per minute.
-
Checking and creating files: additionally the limit of your plan (without a plan 6 requests per minute, at most 30 requests per minute). This applies to:
POST /api/v1/validate/,POST /api/v1/invoices/{id}/generate_xrechnung/,POST /api/v1/invoices/{id}/generate_zugferd_pdf/,POST /api/v1/invoices/{id}/upload_visual_pdf/,POST /api/v1/invoices/validate_draft/. - Reading e-invoices without validation (
POST /api/v1/extract/): a separate limit of 30 requests per minute.
Limits per plan
| Plan | Checking and creating files | Invoices per month | Validations per month |
|---|---|---|---|
| Free | 6 requests per minute | 5 | 30 |
| Starter | 6 requests per minute | 50 | 200 |
| Pro | 15 requests per minute | 250 | 1000 |
| Business | 30 requests per minute | 1500 | 7500 |
All plans and their prices are on the pricing page.
If a rate limit is exceeded, the response is HTTP 429. The header Retry-After contains the number of seconds after which the next request is accepted. If all slots for checks on the server are busy, the response is HTTP 503, also with Retry-After.
HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 42
{
"type": "https://www.e-rechnungsfreund.de/api/errors/throttled",
"title": "Throttled",
"status": 429,
"detail": "Request was throttled. Expected available in 42 seconds."
}
Retries
- Repeat automatically only for 429, 503 and 504. Wait the number of seconds in
Retry-Afterif the header is present, otherwise increasing intervals (exponential backoff) with a small random addition (jitter). - Limit the number of attempts and then report the error. Repeat other 4xx errors only after correcting the request.
- There is no idempotency key. If a request that creates something fails without a response (e.g. a network timeout), check before repeating whether it was created. A second
POST /api/v1/invoices/with the same invoice number saves a second invoice; the response then contains a warning withcodeduplicate_invoice_number.
import random
import time
import requests
BASE_URL = "https://www.e-rechnungsfreund.de"
HEADERS = {"Authorization": "Api-Key YOUR_API_KEY"}
RETRY_STATUSES = {429, 503, 504}
def call(method, path, max_attempts=5, **kwargs):
for attempt in range(1, max_attempts + 1):
response = requests.request(method, BASE_URL + path, headers=HEADERS, timeout=120, **kwargs)
if response.status_code not in RETRY_STATUSES or attempt == max_attempts:
return response
retry_after = response.headers.get("Retry-After", "")
delay = int(retry_after) if retry_after.isdigit() else min(2 ** attempt, 60)
time.sleep(delay + random.uniform(0, 1)) # jitter: clients do not retry at the same moment
response = call("POST", "/api/v1/invoices/INVOICE_ID/generate_zugferd_pdf/")
GET /api/v1/invoices/next-number/ suggests the next invoice number of your account, as the invoice form does: the last sequence of digits of the most recently created outgoing invoice, plus 1 ({"invoice_number": "RE-2026-0043"}; null without such an invoice or without digits). It is only a suggestion and reserves nothing: clients calling at the same time can receive the same number. If a second invoice is saved with it, the response of POST /api/v1/invoices/ contains the warning duplicate_invoice_number. Available in all plans, also with checking-only access; does not count towards any quota.
Quotas and GET /api/v1/account/
The monthly quotas of your plan apply to the whole account, in the web application and via the API. Creating an invoice (POST /api/v1/invoices/, also as a copy) counts towards the invoices, POST /api/v1/validate/ towards the validations. When a quota is used up, the response is HTTP 402:
Example response: POST /api/v1/invoices/ → 402 Payment Required
{
"type": "https://www.e-rechnungsfreund.de/api/errors/paymentrequired",
"title": "PaymentRequired",
"status": 402,
"detail": "Monthly invoice limit reached."
}
GET /api/v1/account/ returns your plan, its permissions and the remaining quotas with the day they reset (reset_date). It does not count towards any quota, so you can call it before a series of requests.
curl "https://www.e-rechnungsfreund.de/api/v1/account/" \
-H "Authorization: Api-Key $API_KEY"
Example response: GET /api/v1/account/ → 200 OK
Example with the values of the free plan.
{
"plan": {
"code": "free",
"name": "Free"
},
"permissions": {
"api_access": true,
"api_validation_access": true,
"tax_advisor_export": false,
"invoice_emails": true
},
"quotas": {
"invoices": {
"used": 1,
"limit": 5,
"remaining": 4,
"reset_date": "2027-01-01"
},
"validations": {
"used": 3,
"limit": 30,
"remaining": 27,
"reset_date": "2027-01-01"
},
"party_templates": {
"used": 1,
"limit": 3,
"remaining": 2,
"reset_date": null
}
},
"party_templates": {
"seller": 1,
"buyer": 0,
"has_seller_template": true
}
}
Data formats
Requests and responses are JSON in UTF-8, except for file uploads (form field invoice_file) and file downloads.
Amounts and decimal places
Send amounts, prices, quantities and rates as strings with a dot as decimal separator, e.g. "95.00"; this avoids rounding errors of floating-point numbers. Responses return them as strings with the stored decimal places. Totals and tax amounts are recalculated from the lines.
| Values | Fields (examples) | Decimal places (max.) |
|---|---|---|
| Amounts | line_total_amount, grand_total_amount, due_payable_amount | 4 |
| Unit prices | items[].net_price, items[].gross_price | 10 |
| Quantities | items[].quantity | 4 |
| VAT rates in percent | items[].tax_rate, tax_breakdowns[].tax_rate | 2 |
Example response: POST /api/v1/invoices/ → 201 Created
Excerpt of the response for the invoice from the quickstart.
{
"line_total_amount": "760.0000",
"tax_total_amount": "144.4000",
"grand_total_amount": "904.4000"
}
Dates and times
- Dates without time as
YYYY-MM-DD(ISO 8601), e.g.issue_date,payment_due_dateand the date filters of the lists. - Points in time such as
created_atandpaid_atin ISO 8601 in UTC, e.g.2026-10-01T09:30:00.000000Z. reset_dateof the quotas is the first day of the next monthly cycle (UTC).- Exception: in the field
infoof reading and validation, dates are given as in the XML of the invoice, e.g.20261001.
Code lists
Codes such as currency, country, unit or tax category follow the code lists of EN 16931. GET /api/v1/code-list/{model_key}/ returns the active codes of a list with code and label. Available lists:
document-type, payment-means, vatex, allowance, charge, tax-category, currency, date-code, time-code, icd, country, unit, reference, eas, item.
curl "https://www.e-rechnungsfreund.de/api/v1/code-list/currency/" \
-H "Authorization: Api-Key $API_KEY"
Example response: GET /api/v1/code-list/currency/ → 200 OK
Excerpt: the response is a list of all active codes.
[
{
"code": "EUR",
"label": "Euro (EUR)"
}
]
Required fields
POST /api/v1/invoices/ requires these fields; the BT number is the business term of EN 16931:
| Field | BT number | Meaning |
|---|---|---|
invoice_number | BT-1 | Invoice number |
issue_date | BT-2 | Invoice issue date |
seller.name | BT-27 | Seller name |
seller.country_code | BT-40 | Seller country code (ISO 3166-1) |
buyer.name | BT-44 | Buyer name |
buyer.country_code | BT-55 | Buyer country code (ISO 3166-1) |
items[].line_id | BT-126 | Invoice line identifier |
items[].name | BT-153 | Item name |
items[].quantity | BT-129 | Invoiced quantity |
items[].net_price | BT-146 | Item net price |
Without type_code (BT-3), the invoice type is 380 (commercial invoice); without currency_code (BT-5), the currency is EUR. Which further information an invoice needs depends on the case, e.g. buyer_reference (BT-10) with the Leitweg-ID for an XRechnung. The check when creating the ZUGFeRD PDF or the XRechnung reports missing information with the validator messages. All fields with their BT numbers are described in the API documentation.
Lists and downloads
GET /api/v1/managed-invoices/ returns pages with limit (1 to 500) and offset (number of entries to skip). The header X-Total-Count always contains the number of all matching invoices before limit and offset. Without limit, the response contains all matching invoices. The other lists, e.g. GET /api/v1/invoices/, return all entries without pages.
curl -i "https://www.e-rechnungsfreund.de/api/v1/managed-invoices/?direction=outgoing&limit=50&offset=0" \
-H "Authorization: Api-Key $API_KEY"
HTTP/1.1 200 OK
Content-Type: application/json
X-Total-Count: 137
[{"id": 1234, "invoice_number": "RE-2026-001", "status": "paid", ...}, ...]
GET /api/v1/managed-invoices/{id}/ also returns validation_checks, the validation history of the invoice (export, import, re-check), newest first: per check id, checked_at, source, is_valid, format, profile and rule_sets (rule set version per validator), without the messages of the report. The validation history is available from the Starter plan, as in the web app; in other plans the field is an empty list. The list of invoices and the responses of the write endpoints do not contain it.
Files are returned directly in the response, with Content-Type application/pdf (ZUGFeRD) or application/xml (XRechnung) and Content-Disposition: attachment with a file name that contains the invoice number: POST /api/v1/invoices/{invoice_id}/generate_zugferd_pdf/ and POST /api/v1/invoices/{invoice_id}/generate_xrechnung/ create the file, GET /api/v1/invoices/{invoice_id}/download/ returns the last created file again.
curl -OJ "https://www.e-rechnungsfreund.de/api/v1/invoices/$INVOICE_ID/download/" \
-H "Authorization: Api-Key $API_KEY"
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: attachment; filename="ZUGFeRD_RE-2026-001.pdf"
The exports (POST /api/v1/exports/…) return no file but a signed download_url. It works without an API key, is valid for 5 minutes and can be used once.
Versions
The version of the API is part of the path: /api/v1/. The API documentation and the OpenAPI schema always describe the current state of /api/v1/; the OpenAPI description currently has the version 1.0.0. Changes to the API are reflected there.
Ignore fields in responses that your client does not know, and generate clients from the current schema.
curl -o schema.yml "https://www.e-rechnungsfreund.de/api/v1/schema/"
Testing
- With a free account, you can test all endpoints. Included per month: 5 invoices and 30 validations. Invoices created for testing count towards the invoices like all others.
-
POST /api/v1/invoices/validate_draft/checks invoice data with the validators without saving the invoice. It counts towards neither the invoices nor the validations of the month, but towards the rate limit for checking. -
Without counting towards a quota:
GET /api/v1/account/,GET /api/v1/validation-rules/{rule_id}/and reading e-invoices without validation withPOST /api/v1/extract/. - Test data: the example invoice of the quickstart. Webhooks can be tested with a test event.
curl -X POST "https://www.e-rechnungsfreund.de/api/v1/invoices/validate_draft/" \
-H "Authorization: Api-Key $API_KEY" \
-H "Content-Type: application/json" \
-d @invoice.json
Example response: POST /api/v1/invoices/validate_draft/ → 200 OK
Excerpt: one result per validator; warnings lists fields the profile does not allow.
{
"kosit": {
"is_valid": true,
"errors": [],
"warnings": [],
"method": "daemon",
"applicable": true
},
"saxon": {
"is_valid": true,
"errors": [],
"warnings": [],
"method": "saxon (xslt 2.0)"
}
}