Python SDK
Availability and bookings from your Python backend. Explicit scope, typed results and one send per mutation.
On this page
Install
Python 3.11–3.15; no runtime dependencies. Install the versioned wheel from our developer domain. availkit is version 0.2.0. These are hosted releases; registry availability is not claimed.
python3 -m venv .venv
. .venv/bin/activate
python -m pip install https://availkit.dev/downloads/availkit-0.2.0-py3-none-any.whl
python -m pip show availkitConfigure your backend
A workspace credential belongs to one workspace and one test or live environment. The credential selects the actual environment on the server; the SDK’s environment value records your intended scope. Issue a matching key in the dashboard. Changing a client label cannot move data between environments.
For these booking examples grant Read and Book.
Other permissions
Catalog writes additionally need Edit catalog; customer/webhook administration needs Manage customers and webhooks. Linking a contact to a booking requires both Book and Manage customers and webhooks. Erasure and history pruning require Privacy plus customer management; expired-receipt pruning needs Privacy.
- In API keys, select your workspace and test, grant Read and Book, then create and download the secret shown once. Save the workspace and offering IDs separately.
- Move the downloaded key into a private directory outside source control. Substitute your actual file and IDs below; all YOUR_* values are placeholders.
mkdir -m 700 private
printf 'private/\n' >> .gitignore
mv ~/Downloads/YOUR_DOWNLOADED_KEY.key private/availkit-test.key
chmod 600 private/availkit-test.key
export AVAILKIT_WORKSPACE_ID=YOUR_WORKSPACE_ID
export AVAILKIT_OFFERING_ID=YOUR_TEST_OFFERING_ID
export AVAILKIT_ENVIRONMENT=test
export AVAILKIT_CREDENTIAL_FILE="$PWD/private/availkit-test.key"Keep workspace keys and webhook secrets on a trusted server. Never put them in browser bundles, mobile applications, client storage, public repositories, URLs or command arguments. A mobile app cannot keep a workspace secret private.
Save the following as availkit_check.py and run python availkit_check.py on your server.
import os
from availkit import AvailKitClient, AvailKitError
client = AvailKitClient(
workspace_id=os.environ["AVAILKIT_WORKSPACE_ID"],
environment=os.environ["AVAILKIT_ENVIRONMENT"],
credential_file=os.environ["AVAILKIT_CREDENTIAL_FILE"],
base_url="https://api.availkit.com",
timeout=10.0,
)
resources = client.list_resources()
print("Resources:", len(resources["items"]))Create, read, move and cancel
First complete dashboard setup with a future opening window and a test offering. The installed package includes the runnable lifecycle example below. Each mutation saves an exclusive private intent file first and refuses an accidental rerun. Run each command once, in order, and inspect the confirmed result before continuing. No customer email is sent by this workspace example.
python -m availkit.examples.first_booking inspect
python -m availkit.examples.first_booking create
python -m availkit.examples.first_booking read
python -m availkit.examples.first_booking move
python -m availkit.examples.first_booking cancelOn failure, stop. Keep the private intent and use the example’s reconcile command for reads. Do not delete intent files to rerun a mutation. Learn the reconciliation rules.
Handle errors without leaking secrets
try:
resources = client.list_resources()
except AvailKitError as error:
print(error.as_dict()) # fixed safe fields; never print credentials
# For a mutation outcome "unknown", retain the saved intent and stop.Clients bound request/response sizes and the entire request with a configured deadline. Default workspace timeout is 10 seconds; the server has its own shorter admission/response budget. Redirects, cookies and automatic mutation retries are disabled. Transport or invalid-success responses can mean an unknown mutation outcome. Avoid logging exception traces, request objects, contact data or private intents.
Coverage and versioning
34 workspace operations and 7 public booking operations cover catalog, weekly hours, offerings, availability, bookings, customers, webhooks, events, usage, maintenance and page publication. Public clients accept page IDs and per-booking capabilities separately. Account enrollment, passkeys, sessions and key issuance use the dashboard, not these SDKs.
Request/response types retain API field names. Python uses TypedDict responses and snake_case methods. The package includes its operation coverage manifest, README, examples and license. Authority matrix.
During 0.x, minor versions may introduce documented breaking changes; patch versions preserve documented behavior. Pin the exact version for production and review release notes before upgrading. Supported runtimes are tested at release; runtimes outside that range are not claimed.
Keep mutation outcomes intact
Before sending a mutation, retain its exact body, method, API origin, workspace/page, test/live scope, creation time, authority fingerprint and idempotency key where supported. Guest operations additionally retain the original booking capability and contact-reuse proof privately. Save on your server before the send; do not log secrets or put them in URLs.
- Not sent
- Local validation or preparation failed before a request. Correct the input; no network effect occurred.
- Rejected
- A recognized API rejection arrived. Handle its structured code; never infer every HTTP error proves no commit.
- Confirmed success
- A validated success response arrived. Preserve the receipt and booking ID.
- Unknown
- The response was lost, timed out, malformed or otherwise insufficient. The mutation may have committed. Stop and retain the original intent.
Read current state with the original authority. A current read can confirm what exists; it cannot reconstruct a missing acknowledgment or prove a booking never existed. Never generate a fresh key or a replacement request to recover an unknown result.
| Operation | Safe handling after an unknown outcome |
|---|---|
| Workspace or public booking create, move, cancel | Retain the original body and key. The server keeps booking receipts for 24 hours. Only an explicitly authorized, identical replay within that window and original scope/authority can use that receipt. A changed body conflicts. A new key means a new intent. |
| Catalog, hours, customers, webhooks, booking-page settings and maintenance | These do not share booking replay receipts. Inspect current state and reconcile manually. Secret issuance has no secret recovery; listing cannot reveal the secret again. |
| Account/passkey/session ceremonies | Use the same-origin dashboard and the specific ceremony’s continuation rules; backend SDKs do not automate them. Use the dashboard’s Account & security controls for supported recovery; keep a spare passkey and offline recovery codes. |