SuperBooks Python SDK
Official Python client for SuperBooks — typed access to your accounting data.
The SDK talks to the SuperBooks API at api.superbooks.io over streamable
HTTP. Every one of the 45 tools is exposed as a typed method grouped by domain,
so you get autocomplete and type checking instead of stringly-typed tool calls.
- Docs: https://docs.superbooks.io
- Requires: Python 3.10+
- Dependencies:
httpx— that is the whole list.
Install
pip install superbooks
Authentication
Mint an API key in SuperBooks under Settings → Developer. Keys are
sb_-prefixed and scoped at mint time — see Scopes.
There is no separate test-mode key: every key is live and acts on real data.
export SUPERBOOKS_API_KEY="sb_your_api_key_here"
The client reads SUPERBOOKS_API_KEY automatically, or you can pass
api_key= explicitly.
Quickstart (sync)
from superbooks import SuperBooks
sb = SuperBooks() # reads SUPERBOOKS_API_KEY
# Every tool is a typed method on its domain namespace.
page = sb.transactions.list(limit=10, status="posted")
for txn in page["items"]:
print(txn["date"], txn["name"], txn["amount"], txn["currency"])
print(sb.reports.runway())
print(sb.reports.burn_rate(from_="2026-01-01", to="2026-06-30"))
invoice = sb.invoices.create_draft(
customer_id="00000000-0000-0000-0000-000000000000",
currency="USD",
issue_date="2026-08-01",
due_date="2026-08-31",
line_items=[{"name": "Consulting", "quantity": 10, "price": 150.0}],
)
sb.close() # or use `with SuperBooks() as sb:`
Note on
from_.fromis a Python keyword, so parameters namedfromin the API are exposed asfrom_. The SDK sends the correct wire name.
Quickstart (async)
AsyncSuperBooks is a mirror of SuperBooks — same namespaces, same method
names, same arguments — with every call awaited.
import asyncio
from superbooks import AsyncSuperBooks
async def main() -> None:
async with AsyncSuperBooks() as sb:
page = await sb.transactions.list(limit=10)
runway = await sb.reports.runway()
print(len(page["items"]), runway)
asyncio.run(main())
Tool surface
| Namespace | Tools | Examples |
|---|---|---|
sb.transactions |
5 | list, get, update_category, delete |
sb.invoices |
5 | list, create_draft, send, void |
sb.customers |
5 | list, create, update, delete |
sb.categories |
4 | list, create, update, delete |
sb.tags |
3 | list, create, delete |
sb.documents |
4 | list, get, search, delete |
sb.inbox |
3 | list, match, delete |
sb.tracker |
5 | list_projects, start_timer, stop_timer |
sb.bank_accounts |
1 | list |
sb.team |
1 | get |
sb.search |
1 | global_ |
sb.reports |
8 | runway, burn_rate, profit_loss, revenue |
Methods return the tool's structured content when it provides any, and the raw content blocks otherwise.
Escape hatches
New tools land on the server before they land in a release. Reach them directly:
sb.tools.list() # every tool your key can see
sb.tools.call("transactions_list", {"limit": 5}) # call anything by name
tools.list() is scope-filtered server-side, so a read-only key genuinely does
not see write or destructive tools.
Scopes and destructive tools
A key's scopes are fixed at mint time and enforced server-side — the SDK does not filter anything locally. Two forms exist:
- Meta-scopes:
apis.all(every resource, read and write) andapis.read(every resource, read only). - Fine-grained:
<resource>.<read|write>, e.g.transactions.read,invoices.write,bank-accounts.read.
The mint UI presents these as All (apis.all), Read Only
(apis.read), and Restricted (pick individual resource scopes).
What your scopes actually grant on the API
Read this before assuming a narrow key is a sandbox.
Scopes are the vocabulary for the whole SuperBooks API, not just the tools this SDK exposes. At the tool layer they collapse into three coarse tiers — read, write, and destructive — and the tier, not the resource, is what gates a tool:
| Your scopes | What you can reach |
|---|---|
any <resource>.read (or apis.read) |
every read tool |
any <resource>.write |
every read and write tool |
apis.all + team setting enabled |
every tool, including destructive |
So a key scoped only tags.write can still call invoices_send and
customers_update — the tags part narrows nothing once the write tier is
unlocked. If you want a key that genuinely cannot write, give it only .read
scopes (or apis.read).
Two consequences of scopes being the full-API vocabulary:
usersandnotificationsscopes exist but have no tools behind them.- There is no
categoriesscope at all, yet the fourcategories_*tools are reachable — they ride the coarse read/write/destructive tier like everything else.
Destructive tools
transactions.delete, invoices.void, customers.delete,
categories.delete, tags.delete, documents.delete, inbox.delete, and
tracker.delete_entry sit behind two gates that must both be open:
- the credential carries the full-access
apis.allscope, and - the team has destructive AI tools enabled in its settings.
This is the one place the coarse tiering is deliberately tightened: a
fine-grained <resource>.write scope is not enough, so a leaked narrow key
can never delete. Missing either gate means the tool is absent from
tools.list() and calling it raises AuthorizationError.
Errors
from superbooks import (
SuperBooksError, # base class — catch this to catch everything
APIError, # non-2xx response
AuthenticationError, # 401 — bad or revoked key
AuthorizationError, # 403 — valid key, insufficient scope / no team
RateLimitError, # 429 — carries .retry_after
ConnectionError, # never reached the API
ProtocolError, # reply was not valid MCP/JSON-RPC
ToolError, # tool ran and reported failure
)
try:
sb.transactions.list()
except RateLimitError as exc:
print(f"slow down for {exc.retry_after}s")
except SuperBooksError as exc:
print(f"request failed: {exc}")
Retries
Automatic retry on 429 is off by default (max_retries=0). The API's
Retry-After is a full 60 seconds, and silently parking a caller for minutes is
worse than raising. Opt in when you want it:
sb = SuperBooks(max_retries=2) # each sleep honours Retry-After, capped at 60s
Nothing else is retried automatically — a failed write stays failed rather than being replayed.
Connecting an agent client
SuperBooks hosts a remote tool server at https://api.superbooks.io/mcp. Any
agent client that can call a remote server with a custom header can connect to
it directly with your API key — the SDK is not involved, and nothing needs to
run locally. For example, with Claude Code:
claude mcp add --transport http superbooks https://api.superbooks.io/mcp \
--header "Authorization: Bearer sb_your_api_key_here"
The same scopes and tiers described above apply. See https://docs.superbooks.io for the full setup guide.
Configuration
| Argument | Env var | Default |
|---|---|---|
api_key |
SUPERBOOKS_API_KEY |
— (required) |
base_url |
SUPERBOOKS_BASE_URL |
https://api.superbooks.io |
timeout |
— | 60.0 seconds |
max_retries |
— | 0 |
http_client |
— | a client the SDK owns |
Passing your own httpx.Client / httpx.AsyncClient (for proxies or custom
transports) leaves ownership with you — close() won't close it.
Development
pip install -e ".[dev]"
python scripts/codegen.py # regenerate namespaces from sdk-manifest.json
python scripts/codegen.py --check # CI gate: fails if they are out of date
ruff check . && ruff format --check .
mypy
pytest
src/superbooks/_generated/ is machine-written from sdk-manifest.json — edit
the manifest and regenerate rather than editing those files. Tests never make
network calls; they run against httpx.MockTransport.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superbooks-0.1.0.tar.gz.
File metadata
- Download URL: superbooks-0.1.0.tar.gz
- Upload date:
- Size: 68.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f93b4ba896a9ebd480dc1766a9c2ff112231ced4369f99cc9277b56e3d4d5e3
|
|
| MD5 |
9a321b44eb7ecaafeb486b9f750c64bb
|
|
| BLAKE2b-256 |
8fb4628b2b3c5f2051bd0ab8c111ee0e71753ce9c02d3a063c2003214ea23a87
|
Provenance
The following attestation bundles were made for superbooks-0.1.0.tar.gz:
Publisher:
release.yml on DevinoSolutions/superbooks-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superbooks-0.1.0.tar.gz -
Subject digest:
5f93b4ba896a9ebd480dc1766a9c2ff112231ced4369f99cc9277b56e3d4d5e3 - Sigstore transparency entry: 2361621638
- Sigstore integration time:
-
Permalink:
DevinoSolutions/superbooks-python@7aa932f931030482d0d44a2b283a105441164de0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DevinoSolutions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7aa932f931030482d0d44a2b283a105441164de0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file superbooks-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superbooks-0.1.0-py3-none-any.whl
- Upload date:
- Size: 41.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d209a92124807d533a7ae00640898cfd99c744c181ddbc775c572ebc4e9ee4a
|
|
| MD5 |
0c60a7951b432c7a8f43269d095b7d4d
|
|
| BLAKE2b-256 |
37a6c7b7d7c0b47196db3b4cdf64f72bd03106397b8a43d01ae389fef2786ad4
|
Provenance
The following attestation bundles were made for superbooks-0.1.0-py3-none-any.whl:
Publisher:
release.yml on DevinoSolutions/superbooks-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superbooks-0.1.0-py3-none-any.whl -
Subject digest:
7d209a92124807d533a7ae00640898cfd99c744c181ddbc775c572ebc4e9ee4a - Sigstore transparency entry: 2361621645
- Sigstore integration time:
-
Permalink:
DevinoSolutions/superbooks-python@7aa932f931030482d0d44a2b283a105441164de0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/DevinoSolutions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7aa932f931030482d0d44a2b283a105441164de0 -
Trigger Event:
push
-
Statement type: