Skip to main content

tolt

Python SDK for the Tolt API (v2), with sync and async clients. Run it on your server: it needs your secret API key. Requires Python 3.10 or newer.

Install

pip install tolt

Usage

import os
from tolt import ToltApi

client = ToltApi(token=os.environ["TOLT_API_KEY"])

partner = client.partners.get(id="part_8fKq2LmZx7RtYw3nVbHc5dPj").data

for customer in client.customers.list():
    print(customer.id)

Single-item calls return the API envelope, so read .data. list returns a pager: iterate it to walk every page, or read .items for one page.

Resources: partners, customers, transactions, commissions, links, clicks, promotion_codes, programs, groups, flows, reports, embed_tokens.

Async

import asyncio
import os
from tolt import AsyncToltApi

client = AsyncToltApi(token=os.environ["TOLT_API_KEY"])


async def main() -> None:
    async for partner in await client.partners.list():
        print(partner.id)


asyncio.run(main())

Errors

import httpx
from tolt import NotFoundError
from tolt.core.api_error import ApiError

try:
    client.partners.get(id="part_8fKq2LmZx7RtYw3nVbHc5dPj")
except NotFoundError as e:
    print(e.body.code)  # "not_found"
except ApiError as e:
    print(e.status_code, e.body)
except httpx.TimeoutException:
    ...  # no response within the timeout

Every API error extends ApiError. Timeouts raise httpx's TimeoutException. Read e.status_code and e.body rather than str(e), which starts with the response headers.

Retries and timeouts

Failed requests (408, 409, 429, 5xx and dropped connections) are retried twice with backoff. Calls that create something (every create, and transactions.rerun_flows) are never retried, so a server error can't create a duplicate. Override per client or per call:

client = ToltApi(token=os.environ["TOLT_API_KEY"], max_retries=3, timeout=30)

client.partners.get(id="part_8fKq2LmZx7RtYw3nVbHc5dPj", request_options={"timeout": 5})

The client talks to https://platform.tolt.com by default. Pass base_url to point it elsewhere.

Type checking

The package ships py.typed. With mypy, annotate sub-clients you pass around (partners: PartnersClient = client.partners), since mypy reads the client's sub-client properties as untyped. Pyright infers them.

Development

src/tolt/ is generated by Fern from the API's OpenAPI spec in toltapp/tolt-sdks, which opens a pull request here when the spec changes. Don't edit it by hand.

pip install -e . pytest mypy
pytest tests
mypy src/tolt --exclude src/tolt/tests

Metadata

Release files for tolt 1.2.0

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

Source distribution (sdist)

Source distribution for tolt 1.2.0
File Size Uploaded Provenance
tolt-1.2.0.tar.gz 139.0 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tolt 1.2.0
File Interpreter ABI Platform
tolt-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 365.6 kB

Release files / tolt-1.2.0.tar.gz

Download URL tolt-1.2.0.tar.gz
Size 139.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f96beec53b452f76be211226823049babc10fe524e49478f3abe59d70a61f9ae
BLAKE2b-256 checksum
How to use checksums
3a8e658ce7968af3a857ea5a042038464b185904aa1c25103c47d69d66d54dc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / tolt-1.2.0-py3-none-any.whl

Download URL tolt-1.2.0-py3-none-any.whl
Size 226.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1bc86af436e2bd82543bbd24f7aae6de10e66a907c77e4b6379ba2caa5a34a93
BLAKE2b-256 checksum
How to use checksums
c97faf92d75004a4da565315245662772f598ee0bcdcc57b2d7db24b763e63dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for tolt 1.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tolt-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

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.

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