Python client for the Fakturownia (InvoiceOcean) REST API
Project description
fakturownia-client
Python client for the Fakturownia (InvoiceOcean) REST API. Covers invoices (list/search, create/update, status changes, PDF download), clients (CRUD) and products.
Security note: token in header, never in URL
The official Fakturownia docs mostly show ?api_token=... in URLs, which leaks
tokens into server and proxy logs. This client sends the token only in the
Authorization: Bearer header. Header auth was verified against the live API
for every endpoint used here (see scripts/verify_auth.py — a no-side-effects
check you can run against your own account).
Install
uv add fakturownia-client # or: pip install fakturownia-client
Usage
from fakturownia_client import FakturowniaClient, InvoiceCreate, InvoicePositionCreate
with FakturowniaClient("mycompany", api_token="...") as fk:
# list & search
invoices = fk.list_invoices(period="this_month", include_positions=True)
for inv in fk.iter_invoices(period="this_year"): # auto-pagination
print(inv.number, inv.price_gross)
# create
created = fk.create_invoice(
InvoiceCreate(
buyer_name="ACME Sp. z o.o.",
buyer_tax_no="1234567890",
positions=[InvoicePositionCreate(name="Usługa", total_price_gross=123.00, tax=23)],
)
)
# status & PDF
fk.change_invoice_status(created.id, "paid")
pdf = fk.download_invoice_pdf(created.id)
# clients / products
clients = fk.list_clients(tax_no="1234567890")
products = fk.list_products()
Async
AsyncFakturowniaClient mirrors the sync API 1:1 on httpx.AsyncClient:
from fakturownia_client import AsyncFakturowniaClient
async with AsyncFakturowniaClient("mycompany", api_token="...") as fk:
invoices = await fk.list_invoices(period="this_month")
async for inv in fk.iter_invoices(period="this_year"):
print(inv.number)
domain accepts "mycompany", "mycompany.fakturownia.pl" or a full URL.
Errors raise typed exceptions: AuthenticationError, NotFoundError,
ValidationError, RateLimitError, ServerError (all subclass FakturowniaError).
Caveat: delete_product() calls an endpoint absent from the official API docs —
it may not work on all accounts.
Development
uv sync --extra dev
uv run ruff check . && uv run mypy && uv run pytest -m "not live"
# optional read-only smoke test against the real API:
FAKTUROWNIA_DOMAIN=mycompany FAKTUROWNIA_API_TOKEN=... uv run pytest -m live
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fakturownia_client-0.1.0.tar.gz.
File metadata
- Download URL: fakturownia_client-0.1.0.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ced1a69046a2e57b2da531b7220a4168ba4ea596479859a5171590964e93b17
|
|
| MD5 |
5fbd8d8bd756a590b7608116d8b8aa27
|
|
| BLAKE2b-256 |
75af2a7f91665f8ec0dbfcbdc5fe4dc04e8e09eee902367ede89f76a1fd226f5
|
File details
Details for the file fakturownia_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fakturownia_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6b56c832241951bd021b9604e3935da610cea0fe63e7d11b0b5e6ee56a775fe
|
|
| MD5 |
d1ba4d406b65afb6b7667ff3fc87b97e
|
|
| BLAKE2b-256 |
a0b06ebf5595ba122d79dd7467f379d79ef187c1e2d6213d46074bd65f1c8dc0
|