Skip to main content

Python SDK

The Orbit Python SDK wraps the platform’s core API resources — messaging (SMS, WhatsApp, email), voice, contacts, campaigns, verify (OTP), numbers, and HLR lookup — with typed methods. It targets Python 3.9+ and is fully hand-written on the standard library, so it has zero runtime dependencies.
Pre-publish — source-only. This SDK is not yet on PyPI. The install commands below describe the future registry shape; until first publish, vendor the source from the monorepo (packages/sdk-python/) or call the REST API directly from your client. See the Python: core-scope, not full parity section on the SDK index for exactly what is and isn’t wrapped, and the low-level client.request(method, path, ...) escape hatch for uncovered routes (worked example below).

Installation

Not installable from PyPI yet. Vendor the SDK source from the monorepo (packages/sdk-python/ — a pure-standard-library package you can drop onto your path), or call the REST API directly with any HTTP client until the first release ships (install coordinates change). Requires Python 3.9+.

Client initialization

Or read the key from an environment variable (ORBIT_API_KEY):
Tune timeouts and retries with the direct constructor:

Quickstart: send your first SMS

A runnable end-to-end — the key comes from ORBIT_API_KEY, never from source. Copy it into first_send.py and run it:
Point ORBIT_API_KEY at a sandbox key prefixed dv_test_sk_ first — sandbox sends are simulated, free, and never reach a carrier. Swap in your live key (dv_live_sk_...) when you’re ready to send for real; the code does not change. The WhatsApp and email helpers below follow the same shape, and the full request/response contract with per-language examples lives on the Messages API reference.

Messaging

Voice

Second example: verify OTP

The send-and-check round trip is the most common first integration on the platform. Three lines — the key is still just ORBIT_API_KEY read by OrbitClient.from_env():
A wrongly-typed or expired code reports valid: False — it never raises for a bad guess (only for transport/auth failures), so check the flag. The Verify API reference covers the full contract, and Starter examples includes a complete OTP sign-in starter repo (orbit-otp-nextjs).

Verify (OTP)

Contacts

Campaigns

Numbers and HLR lookup

Paginate a list

List endpoints are cursor-paginated — read meta.pagination.cursor and meta.pagination.has_more off each response and pass the cursor back until has_more is False. Page through SMS messages:
The full pagination model (cursor vs. offset endpoints, page-size caps, and why cursors are not bookmarkable) is in the Pagination guide.

Error handling

All Orbit-originated errors inherit from OrbitError:
Every non-GET request automatically carries an Idempotency-Key header, so a retry never produces a duplicate charge on billable paths. Override per call with your own stable key (idempotency_key="job-7a3b9d-attempt-1").

Covered route missing? Use the escape hatch

The typed clients wrap 8 core resources; the rest of the API — contact segments, event sinks, frequency caps, and everything else listed as out of scope on the SDK index — is reachable through client.request(method, path, ...). It returns the raw JSON body as a dict. Fetch a segment by id:
The escape hatch carries the same auth, retry, and error model as the typed clients — treat it as a first-class client, not a fallback urllib call.

Webhook signature verification

Signatures use the t=<unix_ts>,v1=<hex_hmac> format (same as Stripe) with a 5-minute replay window enforced by default.