Skip to main content

Per-language recipes

The Quickstart and each SDK page show you a first send. This guide collects the three recipes that complete the core integration loop — originate an outbound voice call, run the OTP send/check round trip, and read paginated delivery analytics — with a per-language tab for Python, Go, Ruby, PHP, Java, and C#. Each snippet ends by accessing the response fields idiomatically (dict access in Python, map access in Go, hash dig in Ruby, array access in PHP, result.get(...) in Java, TryGetProperty in C#); the cURL blocks mirror the ones the guide pages already ship.
Typed helpers exist on every SDK for voice create and verify send/check; escape hatches (client.request / client.Request / $client->request / client.request / client.RequestAsync) are used here where a route has no typed wrapper — the analytics read below is an example. Scope per language is on the SDK index.

1. Voice — originate an outbound call

POST /api/v1/voice/calls places the call. The typed client.voice helper covers this on every SDK; where a voice surface is outside the SDK’s typed scope (recordings, conferences, IVR, dialer), use the language’s escape hatch, shown in the second snippet of each tab. Response fields: data.id (the call_... handle) and data.status.
Every outbound call dispatches through the Orbit API itself — the SDK never selects a carrier. The full endpoint contract (webhooks, answer_url callbacks, hangup, transfer) is in the Voice API reference.

2. Verify — OTP round trip

Send the code with POST /api/v1/verify/send, keep the returned verification id, and check the code the user typed in with POST /api/v1/verify/check. Every SDK wraps both calls typed. Response fields: data.valid and data.status (approved when the code matches).
A wrongly-typed or expired code reports valid: false — it never raises for a bad guess (only for transport/auth failures), so branch on the flag. The full contract — resend, detail, expiry — is in the Verify API reference.

3. Analytics — paginated delivery read

GET /api/v1/analytics/messages returns aggregate delivery metrics (totals + time-series). It has no typed helper in any SDK, so each language reads it through its escape hatch — the same low-level call the languages already use for other uncovered routes. Response fields: data.totals.delivery_rate, data.totals.total_sent, data.time_series. The Analytics page ships the same call for cURL, Node, Python, and Go — the tabs below complete the set for the other four languages.
All analytics calls share a 60-request/minute budget per tenant and require the analytics:read scope; queries run against a read replica, so reporting traffic never contends with the live send path. Bucket the series with group_by (hour, day, week, month) and page large ranges by splitting the date window — cursor pagination (meta.pagination) applies to list endpoints, not to the analytics rollups. The full parameter and endpoint matrix is on the Analytics page.