Python: Billing, usage and health
Read plans, subscriptions, usage, compute and invoices, and check platform health and error traces with the Python SDK.
Read your organization's plan, usage and invoices from code — for dashboards, alerts and internal tools. Payment calls (billing_checkout, billing_pay_invoice, billing_razorpay_*) are what the console's checkout uses.
Methods
sovaria.billing_build_invoice
Billing build invoice.
await sovaria.billing_build_invoice(
org_id: str,
*, period: str | None = None,
) -> dict[str, Any]Parameters
org_idstrrequiredperiodstr | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.billing_cancel_account
Billing cancel account.
await sovaria.billing_cancel_account(account_id: str) -> dict[str, Any]Parameters
account_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_cancel_subscription
Cancel an organisation subscription.
await sovaria.billing_cancel_subscription(
org_id: str,
*, immediate: bool = False,
) -> dict[str, Any]Parameters
org_idstrrequiredimmediatebooloptionaldefaultFalse
- Returns
dict[str, Any]
sovaria.billing_checkout
Billing checkout.
await sovaria.billing_checkout(
body: dict[str, Any],
*, org_id: str | None = None,
) -> dict[str, Any]Parameters
bodydict[str, Any]requiredorg_idstr | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.billing_get_account
Billing get account.
await sovaria.billing_get_account(account_id: str) -> dict[str, Any]Parameters
account_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_get_account_overage
Billing get account overage.
await sovaria.billing_get_account_overage(
account_id: str,
) -> dict[str, Any]Parameters
account_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_get_account_overage_prefs
Billing get account overage prefs.
await sovaria.billing_get_account_overage_prefs(
account_id: str,
) -> dict[str, Any]Parameters
account_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_get_compute
Billing get compute.
await sovaria.billing_get_compute(
org_id: str,
*, period: str | None = None,
) -> dict[str, Any]Parameters
org_idstrrequiredperiodstr | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.billing_get_fx
Billing get fx.
await sovaria.billing_get_fx() -> dict[str, Any]- Returns
dict[str, Any]
sovaria.billing_get_open_invoice
Billing get open invoice.
await sovaria.billing_get_open_invoice() -> dict[str, Any]- Returns
dict[str, Any]
sovaria.billing_get_org_overage_prefs
The org's overage switches — one setting for the whole org, whoever changes it.
await sovaria.billing_get_org_overage_prefs(
org_id: str,
) -> dict[str, Any]Parameters
org_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_get_overage
Billing get overage.
await sovaria.billing_get_overage(org_id: str) -> dict[str, Any]Parameters
org_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_get_plan
Fetch a billing plan by name.
await sovaria.billing_get_plan(name: str) -> dict[str, Any]Parameters
namestrrequired
- Returns
dict[str, Any]
sovaria.billing_get_provider
Billing get provider.
await sovaria.billing_get_provider() -> dict[str, Any]- Returns
dict[str, Any]
sovaria.billing_get_subscription
Fetch the active subscription for an organisation.
await sovaria.billing_get_subscription(org_id: str) -> dict[str, Any]Parameters
org_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_get_usage
Fetch usage counters for an organisation.
await sovaria.billing_get_usage(
org_id: str,
*, period: str | None = None,
) -> dict[str, Any]Parameters
org_idstrrequiredperiodstr | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.billing_get_usage_history
Fetch historical usage for an organisation.
await sovaria.billing_get_usage_history(
org_id: str,
*, months: int = 6,
) -> AnyParameters
org_idstrrequiredmonthsintoptionaldefault6
- Returns
Any
sovaria.billing_list_invoices
Billing list invoices.
await sovaria.billing_list_invoices(org_id: str) -> list[dict[str, Any]]Parameters
org_idstrrequired
- Returns
list[dict[str, Any]]
sovaria.billing_list_plans
List public billing plans.
await sovaria.billing_list_plans() -> Any- Returns
Any
sovaria.billing_list_subscriptions
List subscriptions visible to the authenticated caller.
await sovaria.billing_list_subscriptions() -> Any- Returns
Any
sovaria.billing_pay_invoice
Billing pay invoice.
await sovaria.billing_pay_invoice(
org_id: str,
period: str,
) -> dict[str, Any]Parameters
org_idstrrequiredperiodstrrequired
- Returns
dict[str, Any]
sovaria.billing_razorpay_create_order
Billing razorpay create order.
await sovaria.billing_razorpay_create_order(
body: dict[str, Any],
*, org_id: str | None = None,
) -> dict[str, Any]Parameters
bodydict[str, Any]requiredorg_idstr | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.billing_razorpay_verify_payment
Billing razorpay verify payment.
await sovaria.billing_razorpay_verify_payment(
body: dict[str, Any],
*, org_id: str | None = None,
) -> dict[str, Any]Parameters
bodydict[str, Any]requiredorg_idstr | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.billing_resume_account
Billing resume account.
await sovaria.billing_resume_account(account_id: str) -> dict[str, Any]Parameters
account_idstrrequired
- Returns
dict[str, Any]
sovaria.billing_set_account_overage_prefs
Billing set account overage prefs.
await sovaria.billing_set_account_overage_prefs(
account_id: str,
services: dict[str, bool],
) -> dict[str, Any]Parameters
account_idstrrequiredservicesdict[str, bool]required
- Returns
dict[str, Any]
sovaria.billing_set_org_overage_prefs
Change the org's overage switches (org owners and admins).
await sovaria.billing_set_org_overage_prefs(
org_id: str,
services: dict[str, bool],
) -> dict[str, Any]Parameters
org_idstrrequiredservicesdict[str, bool]required
- Returns
dict[str, Any]
sovaria.billing_set_subscription
Create or update an organisation subscription.
await sovaria.billing_set_subscription(
org_id: str,
*, plan: str,
billing_cycle: str = 'monthly',
stripe_customer_id: str | None = None,
metadata: dict[str, Any] | None = None,
) -> dict[str, Any]Parameters
org_idstrrequiredplanstrrequiredbilling_cyclestroptionaldefault'monthly'stripe_customer_idstr | NoneoptionaldefaultNonemetadatadict[str, Any] | NoneoptionaldefaultNone
- Returns
dict[str, Any]
sovaria.gateway_health
Gateway health.
await sovaria.gateway_health() -> dict[str, Any]- Returns
dict[str, Any]
sovaria.get_engines_health
Return aggregate gateway health for downstream engines.
await sovaria.get_engines_health() -> list[dict[str, Any]]- Returns
list[dict[str, Any]]
sovaria.get_error_trace
Get error trace.
await sovaria.get_error_trace(trace_id: str) -> dict[str, Any]Parameters
trace_idstrrequired
- Returns
dict[str, Any]
sovaria.list_error_traces
List error traces.
await sovaria.list_error_traces(
*, service: str | None = None,
project_id: str | None = None,
error_class: str | None = None,
severity: str | None = None,
resolved: bool | None = None,
since: str | None = None,
limit: int | None = None,
) -> list[dict[str, Any]]Parameters
servicestr | NoneoptionaldefaultNoneproject_idstr | NoneoptionaldefaultNoneerror_classstr | NoneoptionaldefaultNoneseveritystr | NoneoptionaldefaultNoneresolvedbool | NoneoptionaldefaultNonesincestr | NoneoptionaldefaultNonelimitint | NoneoptionaldefaultNone
- Returns
list[dict[str, Any]]
sovaria.resolve_error_trace
Resolve error trace.
await sovaria.resolve_error_trace(
trace_id: str,
resolved: bool,
) -> dict[str, Any]Parameters
trace_idstrrequiredresolvedboolrequired
- Returns
dict[str, Any]