This guide is for developers who need to install the library, configure the client, and use its sync or async APIs in their own code.
Install the package with pip or uv:
pip install mpt-api-client
uv add mpt-api-client- Python 3.12+
- Access to an MPT API base URL
- An MPT API token
The client reads configuration from constructor arguments or the environment.
Environment variables:
| Variable | Required | Description |
|---|---|---|
MPT_API_BASE_URL |
yes | SoftwareONE Marketplace API URL |
MPT_API_TOKEN |
yes | SoftwareONE Marketplace API token |
Example .env snippet:
MPT_API_BASE_URL=<YOUR_MPT_API_BASE_URL>
MPT_API_TOKEN=<YOUR_API_TOKEN>You can rely on environment variables:
from mpt_api_client import MPTClient
client = MPTClient()Or pass configuration explicitly:
from mpt_api_client import MPTClient
client = MPTClient.from_config(
api_token="token",
base_url="https://api.s1.show/public",
)Read a single resource:
from mpt_api_client import MPTClient
client = MPTClient()
product = client.catalog.products.get("PRD-123-456")
print(product.name)Iterate through a collection:
from mpt_api_client import MPTClient
client = MPTClient()
for invoice in client.billing.invoices.iterate():
print(invoice.id)import asyncio
from mpt_api_client import AsyncMPTClient
async def main():
client = AsyncMPTClient()
product = await client.catalog.products.get("PRD-123-456")
print(product.name)
async for item in client.catalog.products.iterate():
print(item.id, item.name)
asyncio.run(main())The client exposes resource groups such as:
client.accountsclient.auditclient.billingclient.catalogclient.commerceclient.exchangeclient.helpdeskclient.integrationclient.notifications
See architecture.md for the repository structure and the MPT OpenAPI spec for the upstream endpoint contract.
Use filter(), order_by(), and select() on queryable resources.
The full RQL syntax and builder usage are documented in rql.md. Treat that file as the source of truth for query composition.
Typical example:
from mpt_api_client import MPTClient, RQLQuery
client = MPTClient()
target_ids = RQLQuery("id").in_(["PRD-123-456", "PRD-789-012"])
active = RQLQuery(status="active")
vendor = RQLQuery("vendor.name").eq("Microsoft")
query = target_ids & active & vendor
for product in (
client.catalog.products
.filter(query)
.order_by("-audit.updated.at")
.select("id", "name")
.iterate()
):
print(product.id, product.name)- testing.md: validation and test command behavior
- rql.md: RQL builder guide
- architecture.md: repository structure and abstractions
- local-development.md: repository-local Docker workflow for contributors