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).

fingerprint(source, alg=None, *, blind=None, blinding=None)

fingerprint() blinds by default: it mixes a random 32-byte value into the fingerprint, so the fingerprint cannot be matched to a guessed file without the file's blinding file.

It returns a Fingerprint with ref and blinding. Send ref as the payload. Save blinding beside the file with write_blinding_file(path, blinding); anyone checking the file later needs it.

To check a file later, pass it with its blinding file: in records.check, expect=[{"entry": 1, "files": [{"source": f, "blinding": b}]}], or fingerprint(f, blinding=b). A blinding belongs to one file; another file is refused.

The blinding file is as private as the file: whoever holds both can confirm the file is in the record. The file's size is stored as before.

blind=False, or fingerprint(source, "sha-256"), gives today's plain sha-256 fingerprint as a Fingerprint with blinding None. It is not blinded.

On Windows the blinding file's permissions are not restricted to you; keep it somewhere only you can read.

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.5.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.5.0
File Size Uploaded Provenance Actions
pacspace_sdk-0.5.0.tar.gz 51.6 kB With provenance Details for pacspace_sdk-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 90.2 kB

Release files / pacspace_sdk-0.5.0.tar.gz

Download URL pacspace_sdk-0.5.0.tar.gz
Size 51.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bfc436088f36a8bcb20c5e452f6feb1856adc07abdb84de365fee9bec284ddc7
BLAKE2b-256 checksum
How to use checksums
e9c29dcede1610fd221969ca4f42b6cbd3dedafd3a6f586f37055c6294955259
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 Oct 2, 2026.

Transparency log

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

Download URL pacspace_sdk-0.5.0-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4be4cb44c4b3c6d80af3a0c8490e06fc45cc01902258b3f14d0d064ac7ad7c14
BLAKE2b-256 checksum
How to use checksums
b512a74f840883e01a7ceceb66fd4aa46e0dc3c8a3e83d7d651d718b8b418f3f
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 Oct 2, 2026.

Transparency log

Security for pacspace-sdk 0.5.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.5.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 2, 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