Skip to main content

pacspace-sdk (Python)

Official Python SDK for the PacSpace Balance API.

Install

pip install pacspace-sdk

Quick Start

from pacspace_sdk import PacSpace

pac = PacSpace.init("pk_test_xxx")
# Every request goes to https://app.pacspace.io; the key selects the environment
# (pk_test_ sandbox, pk_live_ production). Pass sandbox_url= for a private sandbox host.

emit = pac.balance.emit("cust_123", -42, "usage")
status = pac.balance.wait_for_verified(emit["recordId"])
usage = pac.balance.usage()

adjustment = pac.balance.emit(
    "cust_123",
    -10,
    "adjustment",
    {"adjusts": {"referenceId": "inv_001"}},
)
entry = pac.records.emit(
    record="build-1",
    title="Handoff restated",
    occurred_at="2026-09-14T10:02:00Z",
    actor_id="ci",
    payloads=[{"alg": "sha-256", "digest": "bb" * 32, "byteLength": "1"}],
    amends={"recordKey": "0xab", "entry": 1},
    note="handoff restated",
    lifecycle="amended",
)

adjusts names the committed Balance entry this delta adjusts. amends names a committed records entry by recordKey and entry. The SDK counts entries from 1, as every PacSpace page does: "entry": 1 is the first entry of the record, the one the record page calls "Entry 1". The HTTP API and the history file carry the same position as seq, counted from 0; the SDK converts at its boundary (seq = entry - 1), so you never send a seq. An entry below 1 raises ValidationError before anything is sent. receipt(record, entry), history(record, from_entry=, to_entry=), and check's expect[]["entry"] count the same way; a "seq" read straight off a history or a webhook may be given in place of "entry" and goes on the wire as it is. The history file keeps the wire's seq; check reports each result as entry (seq + 1).

Verify source selection

verification = pac.verify(
    "0xproof_root_here",
    source="both",  # "db" (default), "chain", or "both"
)

Webhook Verification

from pacspace_sdk import Webhooks

webhooks = Webhooks("whsec_xxx")
event = webhooks.verify(signature, timestamp, raw_body)

Metadata

Release files for pacspace-sdk 0.4.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 pacspace-sdk 0.4.0
File Size Uploaded Provenance Actions
pacspace_sdk-0.4.0.tar.gz 26.1 kB With provenance Details for pacspace_sdk-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pacspace-sdk 0.4.0
File Interpreter ABI Platform Actions
pacspace_sdk-0.4.0-py3-none-any.whl Python 3 none any Details for pacspace_sdk-0.4.0-py3-none-any.whl

Total release size: 51.2 kB

Release files / pacspace_sdk-0.4.0.tar.gz

Download URL pacspace_sdk-0.4.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
259c20f787de950e2e480da4687baf027a3cf24821dd23107525a71def434ade
BLAKE2b-256 checksum
How to use checksums
0dc4ea473be35d983dc36b20ad031fb489840e668a5bee475a19d07a3e0f5c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Release files / pacspace_sdk-0.4.0-py3-none-any.whl

Download URL pacspace_sdk-0.4.0-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a98fe809a39feeffb42d2c20400caf742ef5358ebf35f9d53ed963224c8496c
BLAKE2b-256 checksum
How to use checksums
cb9a01c02f57ef4348d6c4f0e1e0e104ab2fa4efc301aa0584f9a8ab66d26121
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 23, 2026.

Transparency log

Security for pacspace-sdk 0.4.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pacspace_sdk-0.4.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 Sep 23, 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.

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