Integrations
Python SDK
The official Beliq SDK for Python. Generate, validate, parse, and convert EN 16931 e-invoices, with sync and async clients.
Available
The official Python SDK for Beliq. Same API surface as the Node SDK, with sync (Beliq) and async (AsyncBeliq) clients. JSON responses are Pydantic models that preserve fields not explicitly typed (such as per-country authority versions on a validation result).
- Package:
beliqon PyPI - Source: github.com/beliq-eu/beliq-sdk-python
Install
pip install beliq
Requires Python 3.10 or newer.
Authentication
Create an API key in the Beliq dashboard under Integration → API Keys:
from beliq import Beliq
Beliq(api_key="blq_...") # sends X-API-Key (default)
Beliq(api_key="blq_...", auth="bearer") # sends Authorization: Bearer
Beliq(api_key="blq_...", base_url="https://api.beliq.eu") # default; set only for a self-hosted endpointQuick start
from beliq import Beliq
beliq = Beliq(api_key="blq_...")
# Account, plan, and quota context (no quota cost).
account = beliq.me()
# Generate an XRechnung document from an EN 16931 invoice.
generated = beliq.generate(
standard="xrechnung",
verify=True,
invoice={
"number": "INV-2026-001",
"issueDate": "2026-01-15",
"currencyCode": "EUR",
"seller": {"name": "Seller GmbH", "address": {"city": "Berlin", "postalCode": "10115", "countryCode": "DE"}},
"buyer": {"name": "Buyer GmbH", "address": {"city": "Munich", "postalCode": "80331", "countryCode": "DE"}},
"lines": [
{"description": "Consulting", "quantity": 10, "unitCode": "HUR", "unitPrice": 100, "lineTotal": 1000, "vatRate": 19, "vatCategoryCode": "S"}
],
"totalNetAmount": 1000,
"totalTaxAmount": 190,
"totalGrossAmount": 1190,
},
)
print(generated.xml, generated.meta.schematron_version)
# Validate any document against authority-pinned rules.
result = beliq.validate(generated.xml, format="auto")
if not result.valid:
for issue in result.errors:
print(issue.rule_id, issue.message)Async
AsyncBeliq mirrors the sync client with await:
import asyncio
from beliq import AsyncBeliq
async def main():
async with AsyncBeliq(api_key="blq_...") as beliq:
result = await beliq.validate(open("invoice.xml", "rb").read(), format="auto")
print(result.valid)
asyncio.run(main())Methods
| Method | Endpoint | Returns |
|---|---|---|
me() |
GET /v1/me |
AccountInfo (no quota cost) |
generate(...) |
POST /v1/generate |
GenerateResult |
validate(document, ...) |
POST /v1/validate |
ValidationResult |
parse(document, ...) |
POST /v1/parse |
ParseResult |
convert(document, ...) |
POST /v1/convert |
ConvertResult |
document accepts a str, bytes, or bytearray. Errors raise BeliqApiError with a typed .code, HTTP .status, and any .details.
See also
- Quickstart: the underlying API in five minutes.
- Authentication: keys, quotas, and rate limits.
- API reference: full request and response schemas.