Skip to main content

shepherd-sdk (Python)

Python client for the Shepherd API: connect wallets, classify every transaction, and pull audit-ready financial statements.

pip install shepherd-sdk
from shepherd import Shepherd

shep = Shepherd("shep_live_...")          # or Shepherd.create_sandbox() for an instant test key

wallet = shep.wallets.connect("0x...", "base", end_user_id="cust_4821")
pnl = shep.statements.income(start_date="2026-09-01", end_date="2026-09-30", end_user_id="cust_4821")
print(pnl["net_income"])

Sandbox

shep = Shepherd.create_sandbox(email="you@company.com")
print(shep.sandbox_info)    # seeded wallet + customer

Sandbox keys start with shep_test_. Data is synthetic; connecting any address returns generated activity.

Webhooks

from shepherd import construct_event, SignatureVerificationError

# Flask example
@app.post("/shepherd/webhook")
def hook():
    try:
        event = construct_event(request.get_data(), request.headers["Shepherd-Signature"], WEBHOOK_SECRET)
    except SignatureVerificationError:
        return "", 400
    if event["type"] == "wallet.scan_completed":
        ...
    return "", 200

Push your own transactions

acct = shep.accounts.create("acct_123", type="bank", currency="USD", end_user_id="cust_4821")
r = shep.accounts.push_transactions(acct["id"], [
    {"external_id": "tx_1", "date": "2026-09-03", "amount": 1250.00, "direction": "inflow", "counterparty": "Acme Corp"},
])
print(r["created"], r["duplicates"], r["rejected"])
shep.jobs.wait(r["classification"]["job_id"])      # classification runs in the background

Sending the same external_id again changes nothing, so it is safe to retry.

Pagination

for tx in shep.transactions.iterate(status="unclassified"):   # follows pages for you
    ...
changed = shep.transactions.iterate(updated_since="2026-10-01T00:00:00Z")   # keep a copy in sync

One set of books per customer (platform accounts)

shep.workspaces.create("cust_4821", "Acme Corp")
acme = shep.with_workspace("cust_4821")        # every call on `acme` reads and writes that customer only
acme.statements.income(start_date="2026-09-01")

Keys and safe retries

key = shep.api_keys.create(label="reporting", scope="read", expires_in_days=90)   # admin key needed
shep.api_keys.rotate(key["id"], grace_hours=24)
shep.accounts.create("acct_123", idempotency_key="create-acct_123")   # POSTs with a key retry safely

Errors

Every failure raises a ShepherdError subclass with .status, .message, .code, .request_id, .body: InvalidRequestError (400), AuthenticationError (401), PermissionDeniedError (403), NotFoundError (404), ConflictError (409), RateLimitError (429, with .retry_after), ServerError (5xx). GET requests, and POSTs sent with an idempotency_key, retry automatically on 429/502/503 and honour Retry-After.

Resources

wallets, transactions, accounts, jobs, statements, entities, opening_balances, accruals, classification_rules, chart_of_accounts, periods, reconciliation, audit_log, api_keys, workspaces, webhooks, sandbox. See the API reference.

Metadata

Release files for shepherd-sdk 0.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 shepherd-sdk 0.2.0
File Size Uploaded Provenance
shepherd_sdk-0.2.0.tar.gz 9.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for shepherd-sdk 0.2.0
File Interpreter ABI Platform
shepherd_sdk-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.9 kB

Release files / shepherd_sdk-0.2.0.tar.gz

Download URL shepherd_sdk-0.2.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6dab87f8d9c5d268a3bcb4f319e8c054c82999fd8a40a49241c62c04dbb4c548
BLAKE2b-256 checksum
How to use checksums
f02d35b4885fb11283540052595109a44b8dff75dfce0ce694defec17dbb6d31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / shepherd_sdk-0.2.0-py3-none-any.whl

Download URL shepherd_sdk-0.2.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afb36b6c1a9fd495e7c3800a0aa6a4cf483b6218f283e24b89591eb1e93033e1
BLAKE2b-256 checksum
How to use checksums
56dc5e6b68a4884585fb774ffea1637753cf8f20869e396a67e82fcba0e6089d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for shepherd-sdk 0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.2.0 This release

2 release files No 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