Skip to content
Join our SlackContact usGet started

Get Billing State

customer_access.retrieve_billing_state(strsubject_id) -> CustomerAccessRetrieveBillingStateResponse
get/customer-access/{subject_id}/billing-state

Get Billing State

ParametersExpand Collapse
subject_id: str

The ID or external ID of the subject to get billing state for.

ReturnsExpand Collapse
class CustomerAccessRetrieveBillingStateResponse:
active_subscriptions: List[ActiveSubscription]

List of active subscriptions the subject is subscribed to.

rate_card_id: str
subscription_id: str
has_active_subscription: bool

Whether the subject has an active subscription.

has_overage_for_usage: bool

Whether the subject has exceeded the included usage (if any) on a usage-based rate they are subscribed to.

usage_data: List[UsageData]

The usage data for the usage-based rates the subject is subscribed to.

included_units: int
pricing_metric_id: str
rate_name: str
used_units: str
Get Billing State
from lark import Lark

client = Lark(
    api_key="My API Key",
)
response = client.customer_access.retrieve_billing_state(
    "user_1234567890",
)
print(response.active_subscriptions)
{
  "active_subscriptions": [
    {
      "rate_card_id": "rc_jQK2n0wutCj6bBcAIrL6o07g",
      "subscription_id": "sub_PuLvkNSP3IBCvjayBD3TXNQ6"
    }
  ],
  "has_active_subscription": true,
  "has_overage_for_usage": false,
  "usage_data": [
    {
      "included_units": 300,
      "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
      "rate_name": "Compute Hours",
      "used_units": "100"
    }
  ]
}
Returns Examples
{
  "active_subscriptions": [
    {
      "rate_card_id": "rc_jQK2n0wutCj6bBcAIrL6o07g",
      "subscription_id": "sub_PuLvkNSP3IBCvjayBD3TXNQ6"
    }
  ],
  "has_active_subscription": true,
  "has_overage_for_usage": false,
  "usage_data": [
    {
      "included_units": 300,
      "pricing_metric_id": "pmtr_GlX5Tcm2HOn00CoRTFxw2Amw",
      "rate_name": "Compute Hours",
      "used_units": "100"
    }
  ]
}