Skip to content
Join our SlackContact usGet started

Get Billing State

get/customer-access/{subject_id}/billing-state

Get Billing State

Path ParametersExpand Collapse
subject_id: string

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

ReturnsExpand Collapse
active_subscriptions: array of object { rate_card_id, subscription_id }

List of active subscriptions the subject is subscribed to.

rate_card_id: string
subscription_id: string
has_active_subscription: boolean

Whether the subject has an active subscription.

has_overage_for_usage: boolean

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

usage_data: array of object { included_units, pricing_metric_id, rate_name, used_units }

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

included_units: number
pricing_metric_id: string
rate_name: string
used_units: string
Get Billing State
curl https://api.uselark.ai/customer-access/$SUBJECT_ID/billing-state \
    -H "X-API-Key: $LARK_API_KEY"
{
  "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"
    }
  ]
}