Pagination
List results include Pagination. Resource .all() helpers follow opaque cursors, detect loops, enforce max_pages, and optionally deduplicate by id.
Python SDK · v1.0.0
The official server-side SDK for PsyMind API v1. It requires Python 3.11 or newer and has no runtime dependencies.
Quickstart
Keep service credentials on your backend. The Python client exposes typed resource dictionaries, pagination helpers, retries, idempotency, and webhook verification.
python -m pip install psymindimport os
from datetime import UTC, datetime
from psymind import PsyMind, create_idempotency_key
psymind = PsyMind(api_key=os.environ["PSYMIND_API_KEY"])
client = psymind.clients.create({
"external_id": create_idempotency_key("quickstart-client"),
"preferred_language": "en",
"timezone": "UTC",
"consent_status": "granted",
"consent_version": "your-valid-consent-version",
"consent_at": datetime.now(UTC).isoformat(),
})
created = psymind.practices.create(
{"client_id": client.data["id"], "goal": "Sleep calmly and wake rested", "language": "en", "generate_audio": True},
idempotency_key=create_idempotency_key("practice"),
)
result = psymind.practices.wait_until_ready(created.data["id"])
print(result.data["status"], result.request_id)Resources
The Pythonic client exposes organizations, practitioners, clients and context, practices, voices, methods, assignments, outcomes, and usage. PsyMind.request() provides low-level access to all 75 API v1 operations, including organization-scoped usage and webhook endpoint management, test, history, and retry.
List results include Pagination. Resource .all() helpers follow opaque cursors, detect loops, enforce max_pages, and optionally deduplicate by id.
POST retries are enabled only for OpenAPI operations that declare Idempotency-Key and only when a stable key is supplied. HTTP 409 is never retried.
PsyMindError exposes code, status, request_id, retry_after, and available details.
Pass the exact raw body to verify_webhook; validate PsyMind-Signature and atomically persist processed PsyMind-Event-Id values to deduplicate retries.
Contract
The SDK follows API v1. Usage readback and webhook-management routes are part of the current public contract; access remains organization-scoped and permission-gated.