Skip to main content

Checkbox Python SDK

Automatic-renewal-law compliance (ROSCA, California Bus. & Prof. Code § 17600, New York GBL § 527-a and ~26 other state laws) for subscription businesses, as an API. Standard library only (urllib), Python 3.9+. Free to use.

Package name. pip install checkbox-site (the name in pyproject.toml; never install the unrelated checkbox or checkbox-sdk packages). The import name is checkbox.

Quickstart

from checkbox import Checkbox
cb = Checkbox()  # reads CHECKBOX_API_KEY, then CHECKBOX_SECRET_KEY (ck_test_… written by `checkbox init`)
check = cb.checks.stripe_checkout_session(params=session_params, merchant={"merchant_name": "Acme", "price": 19.99, "interval": "month"})
print(check["verdict"], check["next_action"]["message"])
params = check["correction"]["corrected_params"] if check["verdict"] == "fail" else session_params  # engine-verified fix

No key yet? Connect the MCP server (setup_checkbox) or call POST /v1/device/authorize: one browser approval creates the account and test keys. Test keys (ck_test_…) act on an isolated sandbox and never need activation.

What you get

  • Every /v1 operation as cb.<namespace>.<method>(): sites, checks, plans, tasks, verifications, findings, fixes, scans, evaluations, evidence, certificates, notice_settings, law_updates, test_runs, test_credentials, stripe_checkout_configs, disclosures, consents, elements, domain_verifications, setup_sessions, device, webhook_endpoints, events, account. Ids are positional; parameters are keyword arguments or a dict: cb.sites.update("site_…", name="Acme") or cb.sites.update("site_…", {"name": "Acme"}).
  • Plain dict responses with TypedDict hints for every object, request and webhook event (checkbox.types, generated from the OpenAPI spec). obj.last_response holds status_code, request_id, idempotent_replayed, headers.
  • Pagination: for f in cb.findings.list(site=site_id).auto_paging_iter(): ...
  • Retries on network errors, 409 idempotency_key_in_use, 429 (honours Retry-After) and 5xx with exponential backoff (max_network_retries, default 2). Idempotency keys are generated for every POST that changes something and reused across retries; pass your own with request_options={"idempotency_key": "…"}.
  • Versioning: sends Checkbox-Version: 2026-10-30; override with Checkbox(api_version=…) or per request.
  • Mode: cb.mode is "test" or "live" from the key prefix.
  • Typed errors: InvalidRequestError, AuthenticationError, PermissionError, RateLimitError, IdempotencyError, APIError, APIConnectionError (all CheckboxError) with code, param, status_code, request_id, doc_url and next_action (what an agent should do next).
  • Webhooks: from checkbox import webhook; webhook.construct_event(raw_body, signature_header, secret) (as in the docs), or the Stripe-style alias checkbox.Webhook.construct_event(...).
  • Agents / MCP: cb.call("verifyTask", {"task": "task_…", "wait": 30}) calls any operation by its operationId with flat arguments.

Usage

from checkbox import Checkbox, CheckboxError

cb = Checkbox(max_network_retries=2, timeout=80, app_info={"name": "my-app", "version": "1.0.0"})

site = cb.sites.create(url="https://acme.example", request_options={"idempotency_key": "site:acme.example"})
plan = cb.plans.retrieve(site["id"])
for task in plan["tasks"]:
    print(task["id"], task["title"], task["next_action"]["description"])

for finding in cb.findings.list(site=site["id"], status="fail").auto_paging_iter():
    print(finding["check_id"], finding["requirements"][0]["citation"] if finding["requirements"] else "")

# Errors carry a stable code and, for agents, next_action.
try:
    cb.certificates.create(site["id"])
except CheckboxError as err:
    # resource_conflict: not eligible yet (verify the domain, keep the site compliant for 7 days);
    # account_not_activated: a live key before any domain is verified.
    print(err.code, err.message, err.next_action)

Webhooks

# Flask
@app.post("/webhooks/checkbox")
def checkbox_webhook():
    try:
        event = checkbox.Webhook.construct_event(request.get_data(), request.headers.get("Checkbox-Signature"), os.environ["CHECKBOX_WEBHOOK_SECRET"])
    except checkbox.SignatureVerificationError as err:
        return {"error": err.message}, 400
    print(event["type"], event["data"]["object"]["id"])
    return {"received": True}

Pass the raw body (Django request.body, FastAPI await request.body()). Signatures older than 5 minutes are rejected (tolerance=).

Examples

examples/: preflight a Stripe Checkout Session in a Flask app (with the webhook receiver), and register a site. The tests run them against the real API.

Development

  • checkbox/types.py and checkbox/_resources.py are generated from openapi/checkbox.v1.json in Checkbox's main codebase and mirrored here with each release; see CONTRIBUTING.md.
  • Tests: cd python && python -m pytest (a local fake HTTP server; no network). Build: python -m build.
  • Releases: RELEASING.md.

Metadata

Release files for checkbox-site 0.1.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 checkbox-site 0.1.0
File Size Uploaded Provenance Actions
checkbox_site-0.1.0.tar.gz 89.7 kB With provenance Details for checkbox_site-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for checkbox-site 0.1.0
File Interpreter ABI Platform Actions
checkbox_site-0.1.0-py3-none-any.whl Python 3 none any Details for checkbox_site-0.1.0-py3-none-any.whl

Total release size: 175.5 kB

Release files / checkbox_site-0.1.0.tar.gz

Download URL checkbox_site-0.1.0.tar.gz
Size 89.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5673282dd3bef0a0a0b3363af38e392b9f1a930e87b0a1823507ac7f324a323a
BLAKE2b-256 checksum
How to use checksums
eb48afb6fed4de89fe0585c76e1cbb9280c04cac52b6aa75736bfbc80466c241
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 Nov 1, 2026.

Transparency log

Release files / checkbox_site-0.1.0-py3-none-any.whl

Download URL checkbox_site-0.1.0-py3-none-any.whl
Size 85.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3057f98b65f22be2a2c12dc97e6baeae106e99030deafcd6445eef5da70e4cc0
BLAKE2b-256 checksum
How to use checksums
0bb475d8e5b58c54c0cae3a26d617719ea34fc3640787ab5047769dfede272a5
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 Nov 1, 2026.

Transparency log

Security for checkbox-site 0.1.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 checkbox_site-0.1.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 Nov 1, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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