maxio-apiroute
A Python client for Maxio Advanced Billing, the subscription billing API formerly known as Chargify. It's generated with apiroute from the OpenAPI spec that Maxio's developer portal publishes, and a weekly build keeps it current. Sections and methods carry the spec's names, the same ones Maxio's own SDKs use: maxio.subscriptions.list_subscriptions(), maxio.customers.create_customer(...), maxio.invoices.read_invoice(uid).
- Two layers: every call works with plain dicts (
maxio.customers.read_customer(123)). Under.models, calls take and return typed pydantic models (maxio.customers.models.read_customer(123)). - Sync and async: add
.aioto any call for the async version. - Lazy loading: only the sections and models you use get imported. The client covers all 285 operations and about 1,100 models, and importing it takes about a seventh of a second.
- Typed: the package ships
py.typed.
Installation
pip install maxio-apiroute # or: uv add maxio-apiroute
It needs Python 3.10 or newer.
Usage
import os
from maxio_apiroute.advanced_billing import AdvancedBillingApi
maxio = AdvancedBillingApi(api_key=os.environ["MAXIO_API_KEY"], site="acme") # acme.chargify.com
customer = maxio.customers.create_customer( # a dict
body={"customer": {"first_name": "Ada", "last_name": "Lovelace", "email": "ada@example.com"}}
)
found = maxio.customers.models.read_customer(customer["customer"]["id"]) # CustomerResponse
print(found.customer.email)
subscription = maxio.subscriptions.models.create_subscription(
body={"subscription": {"product_handle": "pro", "customer_id": found.customer.id}}
)
page = maxio.subscriptions.list_subscriptions(state="active", per_page=50)
for item in maxio.subscriptions.models.list_subscriptions_all(per_page=200): # every page
print(item.subscription.id, item.subscription.state)
invoice = await maxio.invoices.models.aio.read_invoice("inv_8gk5bwkct3gqt")
- Request and response bodies are JSON, wrapped the way Maxio wraps them:
{"customer": {...}}in and out, and a list of[{"subscription": {...}}, ...]from most list calls. - Sections follow the API reference:
maxio.subscriptions,maxio.subscription_components,maxio.customers,maxio.products,maxio.product_price_points,maxio.invoices,maxio.coupons,maxio.payment_profiles,maxio.webhooks, and so on: 43 sections. - Pagination: list operations have a
_alltwin (list_subscriptions_all,list_invoices_all,list_customers_all…). It takes the same arguments and iterates every page's items, counting uppageuntil a short or empty page (or thetotal_pagesthat some lists return).async forworks through.aio,.pages()gives whole pages, anditertools.isliceorbreakstops early. Passper_pageso that a short page ends the list without one more request.specs/advanced_billing.pagination.yamlsets which operations get one. - Event ingestion (
subscription_components.record_event,bulk_record_events) goes toevents.chargify.com/<site>, as Maxio requires. - Errors raise
apiroute.UnexpectedResponse, whose.responsecarries Maxio's error body.
Keys and sites
| Argument | |
|---|---|
api_key |
A site's API key, or a function returning the current one. It's sent as the Basic auth username, with x as the password. See Maxio's API keys guide and authentication. |
site |
The site's subdomain: acme for acme.chargify.com. Use a test site for development. |
region |
"us" (the default) or "eu" for sites hosted in the EU (acme.ebilling.maxio.com). |
base_url |
Another host, such as a proxy or a mock server. Every operation then goes there, event ingestion included. |
Retries
Retries are off unless you turn them on, for example with maxio.with_options(retries=3), or with retries = Retries(...) in a subclass. Once on, they cover connection failures and 429 rate limiting for every call, waiting at least as long as a Retry-After header asks. A read timeout is retried only for GETs, because a repeated POST could create a second subscription or charge.
For transports, timeouts and other client options, see apiroute's README.
APIs
| API | Import | Docs |
|---|---|---|
| Maxio Advanced Billing API (formerly Chargify) | from maxio_apiroute.advanced_billing import AdvancedBillingApi |
docs |
How this repository stays up to date
Nothing under src/maxio_apiroute/ is written by hand except auth.py and __init__.py. Everything else is generated from the spec listed in apis.yaml:
- Every Monday, the Build workflow:
- Upgrades apiroute to its newest release.
- Downloads Maxio's OpenAPI 3.1 export into
specs/. - Regenerates the client with
apiroute generate --pagination. - Runs the lint and tests, then the live tests against a Maxio test site.
- If anything changed, it commits the result to
main:feat(specs): ...when Maxio changed its spec, which produces a minor release.fix(codegen): ...when only a newer apiroute changed the generated code, which produces a patch release.
- Release then tests the commit, adds it to CHANGELOG.md, tags it, publishes the new version to PyPI and creates a GitHub release. No one has to do anything, and every merge to main releases the same way.
CI checks every pull request and every release. It lints, runs the tests on Python 3.10 to 3.14, and regenerates from the committed spec to confirm that the committed code matches it exactly.
Because specs/ is committed, git log -p specs/ shows exactly what Maxio changed and when.
Development
uv sync
uv run python scripts/generate.py --fetch # download the latest spec, regenerate
uv run python scripts/generate.py # regenerate from the committed spec
uv run pytest
MAXIO_API_KEY=... MAXIO_SITE=acme-test uv run pytest tests/live # against a test site
uv run ruff check . && uv run ruff format --check .
The live tests create a few customers and delete them. They refuse to run against a site whose test flag isn't set.
License
MIT
Metadata
Release files for maxio-apiroute 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maxio_apiroute-0.1.0.tar.gz | 332.7 kB | Without provenance | Details for maxio_apiroute-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maxio_apiroute-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for maxio_apiroute-0.1.0-py3-none-any.whl |
Total release size: 1.4 MB
Release files / maxio_apiroute-0.1.0.tar.gz
| Download URL | maxio_apiroute-0.1.0.tar.gz |
|---|---|
| Size | 332.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc8cfbbd8d8b22c7b731ac36524ec11f6b1430030345d9d7b7bd05ef30c37ae9
|
|
BLAKE2b-256 checksum How to use checksums |
4916c34bebcee34d9e29244f31de9e3e5e4ea728d7072604a6ed59fd8b030d53
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / maxio_apiroute-0.1.0-py3-none-any.whl
| Download URL | maxio_apiroute-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3a4b68b5bcfd8b785d3149fdbf4755b7ece0bf3c38a8be5fbe9d514aca8bdaa
|
|
BLAKE2b-256 checksum How to use checksums |
178d35f05b86a96cd4c56ceacf93d56f6e240a9f97a6366d9063d4138cba9604
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for maxio-apiroute 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.