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.0a1"

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.0a1

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.0a1
File Size Uploaded
timbro_invoices-0.1.0a1.tar.gz 33.2 kB Details

Built distribution (wheel)

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

Total release size: 63.6 kB

Release files / timbro_invoices-0.1.0a1.tar.gz

Download URL timbro_invoices-0.1.0a1.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1f551f53fc2edeba1c7159b6f9a0dda7a2f37859ca16493c293d5c8593e13d40
BLAKE2b-256 checksum
How to use checksums
51097d51f684b6abde3691770f1d654290903686c85baf595ec3992fcbafe3f9
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.0a1-py3-none-any.whl

Download URL timbro_invoices-0.1.0a1-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27ae3550053934f1b72c2da27d2d7bdef716202a8f60e1d871eda076324931ae
BLAKE2b-256 checksum
How to use checksums
8a783cffcaabcd668a49902cfe069732a3dd119cf92f986db3346f9ae200a60b
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