Skip to main content

Billing API

Orbit is pay-as-you-go. There are no plan tiers or recurring subscriptions. Each organization has a single prepaid USD wallet; top it up via one-time Stripe Checkout sessions, and per-send / per-call / per-token charges are deducted in real time from the wallet against an append-only credit_transactions ledger. For the full endpoint reference (status, balance, top-up, auto-top-up, transactions, usage analytics, invoices, refunds) see Billing API. This page is the multi-language code-sample companion for the most common operations. Base path: /api/v1/billing

Get Wallet Balance

GET /api/v1/billing/balance (alias: GET /api/v1/billing/credits) Returns the current wallet balance in USD cents plus the outbound-pause flag.

Create Top-Up Session

POST /api/v1/billing/balance/top-up (alias: POST /api/v1/billing/credits/purchase) Creates a Stripe Checkout session (mode: payment — one-time charge) for adding USD credits to the wallet. The Idempotency-Key header is required (8-255 chars); re-submitting the same key returns the original Checkout URL.

Configure Auto-Top-Up

PUT /api/v1/billing/auto-topup Keep the wallet funded automatically: when the balance falls below a threshold you set, Orbit charges the org’s saved off-session payment method to lift it back above the trigger — no manual recharge needed. Read the current config with GET /api/v1/billing/auto-topup and disable it with DELETE /api/v1/billing/auto-topup.
The enabled, threshold_minor, and recharge_amount_minor parameters — plus a full request example — are documented in the Billing API reference.

List Transactions

GET /api/v1/billing/transactions?limit=30 Cursor-paginated read of public.credit_transactions. Negative amount_minor values are spends; positive values are top-ups and refunds.

Get Per-Channel Usage

GET /api/v1/billing/usage-by-channel?days=30 Per-channel spend + volume breakdown sourced from credit_transactions. Powers the dashboard usage card.

Get Budget Cap

GET /api/v1/billing/budget-cap Returns the organization’s monthly budget cap (when configured), the current calendar-month period boundaries in UTC, and month-to-date spend — so you can warn a user before an action pushes spend past the cap. All monetary fields are in minor units (cents).
cap_cents is null when no monthly cap is configured. period_end is exclusive (the first instant of next month).

Detect Spend Anomalies

GET /api/v1/billing/spend-anomaly Flags channels whose current spend velocity has surged past the organization’s trailing baseline — catching a compromised account before the hard daily caps are exhausted. All monetary fields are in minor units (cents).
surge_ratio is projected_daily_minor ÷ baseline_daily_minor, or null for a channel with no prior spend (a cold-start surge). severity is high or critical. See the full Billing API reference for every field.

List Invoices

GET /api/v1/billing/invoices Retrieve the org’s invoices, newest first. Results are cursor-paginated.
string
Filter by lifecycle status. One of draft, issued, paid, void, synced.
string
Opaque pagination cursor. Pass the next_cursor value from the previous page to fetch the next one.
integer
default:"25"
Maximum number of invoices to return. Minimum 1, maximum 100.
Monetary fields (amount_due, total, subtotal) are decimal strings in the major currency unit (e.g. "100.00" is $100.00) — no division required. next_cursor is null and has_more is false on the final page.

Refunds (owner only)

POST /api/v1/billing/refunds Issue a Stripe refund against a specific top-up credit_transaction lot, within 30 days of the original purchase. GET /api/v1/billing/refunds lists the org’s refund history. Both endpoints are restricted to the org owner role — unexpected refunds against a prepaid wallet are high-impact and hard to reverse.
See Refunds in the full Billing API reference for the complete description.