Skip to main content
Each query below returns one row with one JSON column, in the shape the API returns at version 2.6 without any expand. Replace cus_123 (and user_1 for an entity) with your ids, and <catalog> and <namespace> (or <project> and <dataset>) with the names Autumn sent you. Rebuild a customer lists which table each part comes from. The result is as current as the tables. Balances were computed at v2_6_balances.as_of.

Customer

POST /v1/customers.get. Subscriptions and purchases are the customer-level live plans (active, past_due and scheduled, with past_due shown as active), in position order. Balances and flags are the customer’s view (scope = 'customer'), and each breakdown is in position order, the order Autumn deducts in.
In ClickHouse, output_format_json_quote_64bit_integers = 0 keeps epoch-ms timestamps as numbers instead of strings.

Example response

A customer on a custom version of Team that is canceled and moves to Pro at the end of the period, with a past-due add-on, a credit pack, credits shared between two seats by an allocation, a pool of messages fed by the seats, an unlimited feature and a flag. A custom plan looks like any other subscription here; v2_6_subscriptions.is_custom says which ones are custom.

Entity

POST /v1/entities.get. The entity sees its own plans (including the seat it holds) and the customer-level plans, own plans first. Balances and flags are the entity’s view (scope = 'entity'): shared grants appear with the entity’s allocation applied, and grants the entity owns have source: "entity".

Example response

Seat user_1 of the customer above. Its credits show its 300 allocation plus the 500 no allocation holds, and projects comes from its own Member seat.

Invoices

expand: ["invoices"] adds the customer’s newest 10 invoices:

Differences from the API

  • The API leaves out some fields when they are empty or unset, such as rollovers, allocation, allocated, unallocated, reset.interval_count, config and processors. These queries return them as null or [].
  • billing_controls is returned as stored. The API can add defaults to it, such as a usage alert’s basis and name.
  • invoices[].hosted_invoice_url is the processor’s link. The API returns an Autumn link that redirects to it.
  • Key order can differ between engines and from the API.
  • Other expands are not built here: subscriptions.plan and purchases.plan (Custom plans shows how to read a customer’s plan items), balances.feature and flags.feature (v2_6_features), breakdown[].contributions (v2_6_pooled_balance_contributions), and entities, trials_used and referrals (Querying). rewards.discounts, invoice_previews, payment_method and billing_details are not in the lakehouse.