Quickstart
Go from zero to a working Python integration in five minutes.
This guide walks through the smallest end-to-end happy path: install the
SDK, create a customer, then charge them. Every snippet is copy-pasteable
into a python REPL or a script.
1. Get your API keys
Sign in to the Easy Labs dashboard and copy a secret key from Developers → API keys.
- Keys prefixed
sk_test_route to sandbox automatically. - Keys prefixed
sk_live_route to production automatically.
Store the key in an environment variable. Never commit it to source control.
export EASY_API_KEY="sk_test_..."2. Initialize the SDK
import os
from easylabs import Client
client = Client(api_key=os.environ["EASY_API_KEY"])Client(...) calls GET /validate-key on construction, so an invalid
key fails fast right here with AuthenticationError. The publishable
Basis Theory key returned by /validate-key is exposed as
client.basis_theory_public_api_key if you need it for tokenization.
3. Make your first call
customer = client.customers.create(
first_name="Ada",
last_name="Lovelace",
email="ada@example.com",
)
print(customer.id) # → "cus_..."
print(customer.created_at)Resources are namespaced on the client (client.customers,
client.payment_links, client.subscriptions, ...) and every method
returns a typed pydantic model (or a list of them) with attribute
access.
4. Handle the response
The full success / failure shape:
from easylabs import (
Client,
EasyError,
InvalidRequestError,
RateLimitError,
)
try:
link = client.payment_links.create(
items=[{"price_id": "price_123", "quantity": 1}],
)
print(link.id)
except InvalidRequestError as e:
# 400 / 422 — bad input. `details` carries field-level errors.
print("validation failed:", e.code, e.details)
except RateLimitError as e:
# 429 — back off; `retry_after_seconds` reflects the Retry-After header.
print("rate limited; retry in", e.retry_after_seconds, "s")
except EasyError as e:
# Catch-all for any other 4xx / 5xx response.
print(e.status, e.code, e.message)See Error handling for the full hierarchy and
Pagination for working with list(...) endpoints.
What's next
- Resources → Customers
- Resources → Subscriptions
- Webhooks — verify deliveries and react to events.