skillfed

modern-treasury

The official Python library for the Modern Treasury API

modern-treasury v1.79.0 635.8K downloads/30d#5,633 on PyPI49
Permissive license MIT Active released

What it is and what it does

Modern Treasury is the official Python SDK for the Modern Treasury REST API, a financial operations platform. It wraps HTTP calls to manage counterparties, external accounts, payments, and other treasury functions, offering both sync and async clients powered by httpx. The library includes full type hints (TypedDict for requests, Pydantic models for responses) and auto-paginating iterators for list endpoints, so you can work with typed data and let the SDK handle pagination automatically.

The package is designed for Python 3.9+ applications that need to integrate with Modern Treasury's API. It requires credentials (organization_id and api_key) passed as environment variables or constructor arguments. Dependencies are lightweight and standard (httpx for HTTP, pydantic for validation, anyio and sniffio for async support). The library handles error cases with specific exception types (APIConnectionError, RateLimitError, APIStatusError) and supports file uploads via bytes or PathLike objects.

Use it for:

  • Create and manage counterparties (vendors, customers) in a financial system programmatically.
  • Build async payment processing workflows that fetch and process paginated lists of transactions.
  • Integrate treasury operations (external accounts, payments) into a Python web application or backend service.
  • Automate document uploads associated with financial entities using the file upload interface.
  • Handle API errors gracefully with typed exception classes for connection, rate limit, and status errors.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a typed Python client library for the Modern Treasury REST API, with both synchronous and asynchronous interfaces for managing financial operations like counterparties and external accounts.

Yes. This is the official SDK for Modern Treasury's API, actively maintained with no known vulnerabilities, low install friction, and permissive licensing. Install it if you need to integrate with Modern Treasury in Python 3.9+. The typed interface and async support make it suitable for both simple scripts and production services.

Install

modern-treasury on PyPI

pip

pip install modern-treasury

uv

uv add modern-treasury

poetry

poetry add modern-treasury

Installing modern-treasury

Before you install

Low friction: pure Python wheel with six common dependencies (httpx, pydantic, anyio, distro, sniffio, typing-extensions). Actively maintained—last commit 2026-08-13, released 2026-07-27, no known vulnerabilities.

License in practice

MIT license (permissive): you can use, modify, and distribute this library freely in commercial and private projects, with minimal restrictions.

Quickstart

pip install modern-treasury

import os
from modern_treasury import ModernTreasury

client = ModernTreasury(
    organization_id=os.environ.get("MODERN_TREASURY_ORGANIZATION_ID"),
    api_key=os.environ.get("MODERN_TREASURY_API_KEY"),
)
counterparty = client.counterparties.create(name="my first counterparty")
print(counterparty.id)

Requires Python 3.9 or later; API credentials (organization_id and api_key) must be set via environment variables.

Verify before relying

  • Whether aiohttp backend option (mentioned in docs) is included in the base install or requires a separate extra.
  • Rate limiting and retry behavior specifics beyond the error types documented.
  • File upload streaming behavior and memory footprint for large files.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 6 — anyio, distro, httpx, pydantic, sniffio, typing-extensions
Maintenance actively maintained — 18 days since the last release
Last repo commit
First released
Downloads 635,814/month — #5,633 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: modern_treasury-1.79.0-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

modern treasury api clientpython financial api librarytreasury management sdkasync rest api clienttyped api wrapperpayment operations apicounterparty management
api-clientasync-supporttyped

More Python Modules packages