Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Timbro Invoices for Python

timbro-invoices is the Python client for the canonical /v1/invoices API. Invoice request and response wire shapes are defined by the Timbro API; the installed package carries a generated projection of that contract.

Requires Python 3.10 or later. Install the current prerelease from PyPI:

python -m pip install "timbro-invoices==0.1.0a2"

This alpha targets the redesigned Invoice API, which is still awaiting coordinated hosted qualification. Its API contract may change before the stable release.

from timbro_invoices import TimbroInvoices

client = TimbroInvoices(api_key="your-invoice-api-key")
preview = client.preview_invoice(invoice_request)
invoice = client.create_invoice(invoice_request)
current = client.retrieve_invoice(invoice["id"])
page = client.list_invoices(invoice_reference="odoo:2026:1042")
xml = client.download_xml(invoice["id"])
pdf = client.download_pdf(invoice["id"])

# Replace a retained, replaceable Invoice with a new canonical request.
replacement = client.replace_invoice(
    rejected_invoice["id"],
    {**invoice_request, "invoiceReference": "odoo:2026:1042-r1"},
)

# Share an accepted receipt with a payment service.
receipt_access = client.share_receipt(invoice["id"])
receipt = client.retrieve_receipt(receipt_access)
receipt_pdf = client.download_receipt_pdf(receipt_access)

Keep the receipt access grant on your server and pass it to the receiving service over an authenticated channel. Restricted reads use its accessToken; the token is never sent in the URL and grants access only to receipt data and its PDF. Receipt PDF downloads verify the Invoice identity, media type, and SHA-256 headers. Other file downloads also verify Timbro's security metadata. HTTP problems preserve Timbro's status and machine-readable code. Webhook helpers verify Standard Webhooks signatures over the original bytes and parse only the canonical Invoice event envelope. The distribution uses jsonschema and regex to validate data against the generated OpenAPI contract.

A 422 admission refusal has no retained Invoice ID. Correct the request and call create_invoice; replace_invoice applies to a retained replaceable Invoice. Authority-rejected numbering gaps still require the existing administrator authorization. A replacement retains the predecessor's Source ID, uses a new Source version and invoiceReference, and exposes its predecessor in replacesInvoiceId.

Regenerate the contract projection with python python-sdk/scripts/generate_contract.py. Run the package tests with python -m unittest discover -s python-sdk/tests.

Metadata

Release files for timbro-invoices 0.1.0a2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timbro-invoices 0.1.0a2
File Size Uploaded
timbro_invoices-0.1.0a2.tar.gz 33.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for timbro-invoices 0.1.0a2
File Interpreter ABI Platform
timbro_invoices-0.1.0a2-py3-none-any.whl Python 3 none any Details

Total release size: 63.7 kB

Release files / timbro_invoices-0.1.0a2.tar.gz

Download URL timbro_invoices-0.1.0a2.tar.gz
Size 33.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3282988b325a9b0f76ce248c4449c425be4f178a1e2e03a09bac54590998f875
BLAKE2b-256 checksum
How to use checksums
f81f6bdce97426db7cbf87b23df01d846c7c847b4251038d13100232d7e07727
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / timbro_invoices-0.1.0a2-py3-none-any.whl

Download URL timbro_invoices-0.1.0a2-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d15c1ba0fe226464413ff010b97a2064c55750df932c8ae161d071b7df54b736
BLAKE2b-256 checksum
How to use checksums
04a368c142fed7ceacbd0d8a4ad21340df46d8cf933152ebe482290497c6db86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page