Skip to main content

maxio-apiroute

Build Release

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 .aio to 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 _all twin (list_subscriptions_all, list_invoices_all, list_customers_all …). It takes the same arguments and iterates every page's items, counting up page until a short or empty page (or the total_pages that some lists return). async for works through .aio, .pages() gives whole pages, and itertools.islice or break stops early. Pass per_page so that a short page ends the list without one more request. specs/advanced_billing.pagination.yaml sets which operations get one.
  • Event ingestion (subscription_components.record_event, bulk_record_events) goes to events.chargify.com/<site>, as Maxio requires.
  • Errors raise apiroute.UnexpectedResponse, whose .response carries 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:

  1. 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.
  2. 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.
  3. 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.3

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

Source distribution (sdist)

Source distribution for maxio-apiroute 0.1.3
File Size Uploaded Provenance Actions
maxio_apiroute-0.1.3.tar.gz 332.9 kB Without provenance Details for maxio_apiroute-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maxio-apiroute 0.1.3
File Interpreter ABI Platform Actions
maxio_apiroute-0.1.3-py3-none-any.whl Python 3 none any Details for maxio_apiroute-0.1.3-py3-none-any.whl

Total release size: 1.4 MB

Release files / maxio_apiroute-0.1.3.tar.gz

Download URL maxio_apiroute-0.1.3.tar.gz
Size 332.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b37731aec35d009553b65e0e0f02e53b19ed48d3811aea9aec2e30dd09d8b408
BLAKE2b-256 checksum
How to use checksums
ddf21fd328e839601e22c367b37141816324b1ed259f3c148bd56fa9de82b532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.3-py3-none-any.whl

Download URL maxio_apiroute-0.1.3-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6f9761f0081e5832f13a733ddc70133176a799f2e1f35f29e9179fbf0172ebab
BLAKE2b-256 checksum
How to use checksums
35c2b78ce48b83c98b0643f3e9a877188714b5dc37ee1f3091167742f5983346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.3

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.

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