Schema:

BILLING

BILLING_SUBSCRIPTIONS_HISTORY view

The BILLING_SUBSCRIPTIONS_HISTORY view in the BILLING schema provides a current snapshot of your existing subscriptions and relevant billing information for subscription products.

The view includes:

  • Subscription product information.
  • Subscription lifecycle dates and status.
  • Organization and account metadata.
  • Subscription phase information, when applicable.
  • Billed or pending installments.
  • Subscription quantity, amount, currency, and auto-renewal information.

The view does not include:

  • Marketplace subscriptions.
  • Overage or usage charges.
  • Oracle BYOL products.
  • Invoice activity.
  • Subscriptions without at least one qualifying installment.

Access

RequirementDetail
DatabaseSNOWFLAKE
SchemaBILLING
Account requirementMust be an org-enabled account
Database roleSNOWFLAKE.ORGANIZATION_BILLING_VIEWER

Access is restricted to org-enabled accounts and requires the ORGANIZATION_BILLING_VIEWER database role on the SNOWFLAKE shared database.

Columns

Column NameData TypeDescription
SUBSCRIPTION_IDVARCHARIdentifier of the subscription.
FEATUREVARCHARSubscription product, such as CORTEX-CODE-CLI.
PRODUCT_TYPEVARCHARProduct line represented by the row.
SUBSCRIPTION_NAMEVARCHARDisplay name of the subscription.
STATUSVARCHARLifecycle status of the subscription. For the possible values, see STATUS values.
ORGANIZATION_NAMEVARCHARName of the organization.
ACCOUNT_LOCATORVARCHARSystem-generated identifier for the account.
ACCOUNT_NAMEVARCHARUser-defined identifier for the account.
REGIONVARCHARName of the region where the account is located.
TRIAL_START_DATETIMESTAMP_NTZStart timestamp of the first Trial phase. NULL when the subscription has no configured Trial phase.
TRIAL_END_DATETIMESTAMP_NTZEnd timestamp (exclusive) of the first Trial phase. NULL when the subscription has no configured Trial phase or the phase is open-ended.
START_DATETIMESTAMP_NTZSubscription start timestamp.
END_DATETIMESTAMP_NTZSubscription end timestamp. NULL when the subscription is open-ended.
CANCELLATION_DATETIMESTAMP_NTZTimestamp when the cancellation takes effect. A future value means the subscription is marked for cancellation and remains in its current term until that time. NULL if the subscription is not canceled.
CANCELLATION_REASONVARCHARReason the subscription was canceled. NULL if the subscription is not canceled.
RENEWAL_DATEDATEDate the subscription renews. NULL if the subscription does not renew automatically.
NEXT_BILLING_DATEDATEDate of the next scheduled charge for the subscription. NULL when no charge is scheduled.
PHASE_NAMEVARCHARName of the current phase.
IS_BILLABLEBOOLEANIndicates whether the current phase is billable.
PHASE_DURATIONNUMBERConfigured duration of the current phase.
PHASE_DURATION_TYPEVARCHARUnit for PHASE_DURATION, such as DAY or MONTH.
PHASE_START_DATETIMESTAMP_NTZStart timestamp of the current phase.
PHASE_END_DATETIMESTAMP_NTZEnd timestamp (exclusive) of the current phase.
QUANTITYNUMBERNumber of subscribed units. The value can include a fraction.
UNIT_PRICENUMBERPrice of one subscribed unit on one qualifying installment, based on the most recent qualifying installment available from the source. This is not calculated as TOTAL_AMOUNT / QUANTITY and is not a lifetime average.
TOTAL_AMOUNTNUMBERAmount billed so far. This does not include usage or overage charges. The value is 0 if nothing has been billed.
CURRENCYVARCHARCurrency of the amount, represented as an ISO 4217 code. The default is USD.
INSTALLMENTS_BILLEDNUMBERNumber of subscription payments that have been billed. The value is 0 if none have been billed.
INSTALLMENTS_SCHEDULED_COUNTNUMBERNumber of subscription payments that are still scheduled. The value is 0 if none are scheduled.
IS_AUTO_RENEWBOOLEANTRUE if the subscription renews automatically.
CREATED_DATETIMESTAMP_NTZTimestamp when the subscription was created.
LAST_MODIFIED_DATETIMESTAMP_NTZTimestamp when the subscription was last updated.

STATUS values

The STATUS column is derived from the subscription lifecycle dates and the current subscription phase.

ValueDescription
CANCELEDThe subscription is canceled or marked for cancellation. CANCELLATION_DATE is when the termination takes effect. A CANCELLATION_DATE in the future means the subscription is marked for cancellation and remains in its current term until that timestamp. END_DATE is the subscription end and is not the cancellation effective date.
TRIALThe current timestamp falls within a non-billable Trial phase interval.
EXPIREDThe subscription end timestamp has passed.
ACTIVEThe subscription is not canceled, is not currently in a Trial phase, and has not passed its end date.

For trial and phase intervals, the start timestamp is inclusive and the end timestamp is exclusive. An interval with a NULL end timestamp has no defined end.

Usage notes

  • The view is available to all customers and returns the subscriptions for your organization.
  • Latency for the view may be up to 4 hours.

Example queries

Query active and trial subscriptions

SELECT
    SUBSCRIPTION_ID,
    FEATURE,
    PRODUCT_TYPE,
    STATUS,
    START_DATE,
    END_DATE,
    NEXT_BILLING_DATE
  FROM SNOWFLAKE.BILLING.BILLING_SUBSCRIPTIONS_HISTORY
  WHERE STATUS IN ('ACTIVE', 'TRIAL');

Query a feature, including future-dated cancellations

SELECT
    SUBSCRIPTION_ID,
    FEATURE,
    STATUS,
    CANCELLATION_DATE,
    END_DATE
  FROM SNOWFLAKE.BILLING.BILLING_SUBSCRIPTIONS_HISTORY
  WHERE FEATURE = 'CORTEX-CODE-CLI'
    AND (
          STATUS IN ('ACTIVE', 'TRIAL')
          OR (
              STATUS = 'CANCELED'
              AND CANCELLATION_DATE >= CURRENT_TIMESTAMP()
          )
        );