> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema

## Available data types

The following diagram describes the relations between the [available data types](#available-data-types):

<img src="https://mintcdn.com/stigg/ghlUDOmd1mRIOf61/images/docs/24f794d253c9cbcece841fbff327f0707b2b4b77fbcf588a5c637ffff89eea79-Stigg_Data_Catalog.png?fit=max&auto=format&n=ghlUDOmd1mRIOf61&q=85&s=4d889a984cb23a6065e74dcc5351b06c" alt="" width="1872" height="870" data-path="images/docs/24f794d253c9cbcece841fbff327f0707b2b4b77fbcf588a5c637ffff89eea79-Stigg_Data_Catalog.png" />

### Notes

* Mandatory fields are represented using a NOT NULL column constraint.
* DateTime field type is a string representing a date and time in ISO timestamp format.
* JSON field type represents JSON object literals containing key/value pairs.

## Customer

Represents a customer of your application, which can be either an individual or an organization. Each customer can have a [subscription](#subscription) to a [product](#product), a set of [entitlements](#entitlement-coming-soon), and usage records.

**Table:** CUSTOMERS

| Column                                  | Type          | Mandatory | Description                                                                                     |
| --------------------------------------- | ------------- | --------- | ----------------------------------------------------------------------------------------------- |
| CUSTOMER\_ID                            | VARCHAR       | Yes       | Customer identifier                                                                             |
| EMAIL                                   | VARCHAR       |           | Email address                                                                                   |
| NAME                                    | VARCHAR       |           | Customer name                                                                                   |
| BILLING\_CURRENCY                       | VARCHAR       |           | Preferred billing currency e.g USD                                                              |
| BILLING\_ID                             | VARCHAR       |           | Identifier of the customer in the billing solution that’s integrated with Stigg, i.e. Stripe ID |
| BILLING\_LINK\_URL                      | VARCHAR       |           | URL for the customer entity in the billing solution that’s integrated with Stigg                |
| DEFAULT\_PAYMENT\_EXPIRATION\_MONTH     | NUMBER        |           | Expiration month of the customer’s default payment method                                       |
| DEFAULT\_PAYMENT\_EXPIRATION\_YEAR      | NUMBER        |           | Expiration year of the customer’s default payment method                                        |
| DEFAULT\_PAYMENT\_METHOD\_ID            | VARCHAR       |           | ID of the customer’s default payment method in the billing solution                             |
| DEFAULT\_PAYMENT\_METHOD\_LAST4\_DIGITS | VARCHAR       |           | Last 4 digits of customer’s default payment method                                              |
| DEFAULT\_PAYMENT\_METHOD\_TYPE          | VARCHAR       |           | Enum. Type of default payment method. One of: CARD, BANK                                        |
| DELETED\_AT                             | TIMESTAMP\_TZ |           | Date and time of when the customer was archived                                                 |
| ENVIRONMENT\_ID                         | VARCHAR       | Yes       | Environment identifier                                                                          |
| HAS\_ACTIVE\_SUBSCRIPTION               | BOOLEAN       | Yes       | Has an active subscription                                                                      |
| ID                                      | VARCHAR       | Yes       | Customer internal identifier in Stigg                                                           |
| UPDATED\_AT                             | TIMESTAMP\_TZ | Yes       | Last update date and time                                                                       |
| CREATED\_AT                             | TIMESTAMP\_TZ | Yes       | Creation date and time                                                                          |
| ADDITIONAL\_META\_DATA                  | VARCHAR       |           | Additional metadata JSON in a text format                                                       |
| COUPON\_ID                              | VARCHAR       |           | Coupon ID of an applied coupon                                                                  |
| AWS\_MARKETPLACE\_CUSTOMER\_ID          | VARCHAR       |           | AWS Marketplace customer ID                                                                     |
| SALESFORCE\_ID                          | VARCHAR       |           | Salesforce customer ID                                                                          |

## Customer Resource

Represents a resource associated with a customer, such as a site or an app. Each resource can have its own [subscription](#subscription) to a [product](#product), as well as a distinct set of [entitlements](#entitlement-coming-soon) and usage records.

**Table:** CUSTOMER\_RESOURCES

| Column          | Type          | Mandatory | Description               |
| --------------- | ------------- | --------- | ------------------------- |
| ENVIRONMENT\_ID | VARCHAR       | Yes       | Environment identifier    |
| RESOURCE\_ID    | VARCHAR       | Yes       | Resource identifier       |
| CUSTOMER\_ID    | VARCHAR       | Yes       | Customer identifier       |
| CREATED\_AT     | TIMESTAMP\_TZ | Yes       | Creation date and time    |
| UPDATED\_AT     | TIMESTAMP\_TZ | Yes       | Last update date and time |

## Subscription

Represents the combination of functionalities to which a specific [customer](#customer) has access, including their limitations, the duration of access, and the associated cost. Subscriptions encompass both [plans](#plan) and [add-ons](#addon).

**Table:** SUBSCRIPTIONS

| Column                          | Type          | Mandatory | Description                                                                                                                    |
| ------------------------------- | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------ |
| SUBSCRIPTION\_ID                | VARCHAR       | Yes       | Subscription Identifier                                                                                                        |
| ENVIRONMENT\_ID                 | VARCHAR       | Yes       | Environment identifier                                                                                                         |
| ID                              | VARCHAR       | Yes       | Subscription internal identifier                                                                                               |
| CREATED\_AT                     | TIMESTAMP\_TZ | Yes       | Creation date and time                                                                                                         |
| UPDATED\_AT                     | TIMESTAMP\_TZ | Yes       | Last update date and time                                                                                                      |
| START\_DATE                     | TIMESTAMP\_TZ | Yes       | Subscription start date                                                                                                        |
| END\_DATE                       | TIMESTAMP\_TZ |           | Subscription end date                                                                                                          |
| CANCELLATION\_DATE              | TIMESTAMP\_TZ |           | Date of subscription cancellation                                                                                              |
| TRIAL\_END\_DATE                | TIMESTAMP\_TZ |           | End date of trial period                                                                                                       |
| BILLING\_ID                     | VARCHAR       |           | Billing identifier (i.e. Stripe ID) of the subscription                                                                        |
| OLD\_BILLING\_ID                | VARCHAR       |           | Previous billing identifier (i.e. Stripe ID), is set only for canceled or expired subscriptions.                               |
| BILLING\_LINK\_URL              | VARCHAR       |           | URL for the subscription entity in the billing solution (i.e. Stripe ID)                                                       |
| STATUS                          | VARCHAR       | Yes       | Enum. Subscription status. Can be one of: PAYMENT\_PENDING, ACTIVE, EXPIRED, IN\_TRIAL, CANCELED, NOT\_STARTED.                |
| RESOURCE\_ID                    | VARCHAR       |           | Resource identifier                                                                                                            |
| IS\_CUSTOM\_PRICE\_SUBSCRIPTION | BOOLEAN       |           | Indicates if subscription has [custom pricing](../../modeling-your-pricing-in-stigg/plans/custom-plans) (i.e. not self-served) |
| CURRENT\_BILLING\_PERIOD\_START | TIMESTAMP\_TZ |           | Start of the current billing period                                                                                            |
| CURRENT\_BILLING\_PERIOD\_END   | TIMESTAMP\_TZ |           | End of the current billing period                                                                                              |
| PRICING\_TYPE                   | VARCHAR       | Yes       | Enum. Type of pricing applied. Can be one of: FREE, PAID,CUSTOM.                                                               |
| ADDITIONAL\_META\_DATA          | VARCHAR       |           | Additional metadata                                                                                                            |
| PAYMENT\_COLLECTION             | VARCHAR       | Yes       | Enum. Payment collection status. Can be one of: NOT\_REQUIRED, PROCESSING, FAILED, ACTION\_REQUIRED (= 3DS).                   |
| CUSTOMER\_ID                    | VARCHAR       | Yes       | Associated customer identifier                                                                                                 |
| PLAN\_ID                        | VARCHAR       | Yes       | Subscription plan identifier                                                                                                   |
| ~~COUPON\_ID~~                  | ~~VARCHAR~~   |           | ⚠️ This field is **deprecated**, use the `SUBSCRIPTION_APPLIED_COUPONS` relation table instead                                 |
| SALESFORCE\_ID                  | VARCHAR       |           | Salesforce customer ID                                                                                                         |

## Subscription Price

Represents the [price](#price) of the subscription. Multiple prices can be associated with a single subscription to support a pricing model based on multiple billable metrics

**Table:** SUBSCRIPTION\_PRICES

| Column           | Type          | Mandatory | Description                                                                       |
| ---------------- | ------------- | --------- | --------------------------------------------------------------------------------- |
| ID               | VARCHAR       | Yes       | Price internal identifier                                                         |
| CREATED\_AT      | TIMESTAMP\_TZ | Yes       | Creation date and time                                                            |
| UPDATED\_AT      | TIMESTAMP\_TZ | Yes       | Last update date and time                                                         |
| USAGE\_LIMIT     | NUMBER        |           | Usage limit associated with the price                                             |
| FEATURE\_ID      | VARCHAR       |           | Identifier for the associated feature, if this price represents a billable metric |
| BILLING\_MODEL   | VARCHAR       |           | Enum. Billing model used. Can be one of: FLAT\_FEE, PER\_UNIT, USAGE\_BASED.      |
| SUBSCRIPTION\_ID | VARCHAR       | Yes       | Associated subscription identifier                                                |
| PRICE\_ID        | VARCHAR       |           | Associated plan or add-on price identifier                                        |
| ENVIRONMENT\_ID  | VARCHAR       | Yes       | Environment identifier                                                            |

## Subscription Add-on

Represents the quantity of an [add-on](#addon) that is included in the [subscription](#subscription).

**Table:** SUBSCRIPTION\_ADDONS

| Column           | Type          | Mandatory | Description                                |
| ---------------- | ------------- | --------- | ------------------------------------------ |
| ID               | VARCHAR       | Yes       | SubscriptionAddon internal identifier      |
| QUANTITY         | NUMBER        | Yes       | Quantity of the add-on                     |
| CREATED\_AT      | TIMESTAMP\_TZ | Yes       | Creation date and time                     |
| UPDATED\_AT      | TIMESTAMP\_TZ | Yes       | Last update date and time                  |
| SUBSCRIPTION\_ID | VARCHAR       | Yes       | Associated subscription identifier         |
| ADDON\_ID        | VARCHAR       | Yes       | Associated add-on identifier               |
| PRICE\_ID        | VARCHAR       |           | Associated plan or add-on price identifier |
| ENVIRONMENT\_ID  | VARCHAR       | Yes       | Environment identifier                     |

## Subscription Applied Coupons

Represents a [coupon](#coupon) entity attached to a [subscription](#subscription).

**Table**: SUBSCRIPTION\_APPLIED\_COUPONS

| Column           | Type          | Mandatory | Description                                                                      |
| ---------------- | ------------- | --------- | -------------------------------------------------------------------------------- |
| ID               | VARCHAR       | Yes       | Internal identifier                                                              |
| ENVIRONMENT\_ID  | VARCHAR       | Yes       | Environment identifier                                                           |
| CREATED\_AT      | TIMESTAMP\_TZ | Yes       | Creation date and time                                                           |
| UPDATED\_AT      | TIMESTAMP\_TZ | Yes       | Last update date and time                                                        |
| DELETED\_AT      | VARCHAR       |           | Date and time the coupon was removed from the subscription                       |
| SUBSCRIPTION\_ID | VARCHAR       | Yes       | Associated subscription identifier                                               |
| COUPON\_ID       | VARCHAR       | Yes       | Associated coupon identifier                                                     |
| STATUS           | VARCHAR       | Yes       | Enum - SubscriptionCouponStatus. Can be one of: `ACTIVE`, `EXPIRED` or `REMOVED` |

## Product

Represents a product or product line. Typically, products group together [plans](#plan) and [add-ons](#addon).

**Table:** PRODUCTS

| Column                  | Type          | Mandatory | Description                                                                     |
| ----------------------- | ------------- | --------- | ------------------------------------------------------------------------------- |
| ID                      | VARCHAR       | Yes       | Product internal identifier                                                     |
| DISPLAY\_NAME           | VARCHAR       |           | Display name of the product                                                     |
| PRODUCT\_ID             | VARCHAR       | Yes       | Product identifier                                                              |
| DESCRIPTION             | VARCHAR       |           | Description of the product                                                      |
| CREATED\_AT             | TIMESTAMP\_TZ | Yes       | Creation date and time of the product                                           |
| UPDATED\_AT             | TIMESTAMP\_TZ | Yes       | Last update date and time                                                       |
| ENVIRONMENT\_ID         | VARCHAR       | Yes       | Identifier for the associated environment                                       |
| MULTIPLE\_SUBSCRIPTIONS | BOOLEAN       | Yes       | Supports multiple subscriptions, each resource can have a separate subscription |
| ADDITIONAL\_META\_DATA  | VARCHAR       |           | Additional metadata for the product                                             |

## Plan

Represents a package of a [product](#product) for which [customers](#customer) are charged during a subscription period. The [features](#feature) included in each plan are defined by [entitlements](#entitlement-coming-soon) associated with the plan. Plans can inherit features from one another.

**Table:** PLANS

| Column                 | Type          | Mandatory | Description                                                                 |
| ---------------------- | ------------- | --------- | --------------------------------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Plan internal identifier                                                    |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time of the plan                                          |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time of the plan                                       |
| PLAN\_ID               | VARCHAR       | Yes       | Plan identifier                                                             |
| BILLING\_ID            | VARCHAR       |           | Billing identifier (Stripe ID)                                              |
| BILLING\_LINK\_URL     | VARCHAR       |           | URL for billing information                                                 |
| DISPLAY\_NAME          | VARCHAR       | Yes       | Display name of the plan                                                    |
| PRICING\_TYPE          | VARCHAR       |           | Enum. Type of pricing used for the plan. Can be one of: FREE, PAID, CUSTOM. |
| DESCRIPTION            | VARCHAR       |           | Description of the plan                                                     |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Identifier for the associated environment                                   |
| IS\_LATEST             | BOOLEAN       |           | Indicates if this is the latest version of the plan                         |
| VERSION\_NUMBER        | NUMBER        |           | Version number of the plan                                                  |
| ADDITIONAL\_META\_DATA | VARCHAR       |           | Additional metadata for the plan                                            |
| PRODUCT\_ID            | VARCHAR       | Yes       | Associated product identifier                                               |
| BASE\_PLAN\_ID         | VARCHAR       |           | Parent plan identifier if this is a child plan                              |

## Add-on

Represents a package that extends specific [plans](#plan). Add-ons are dependent on the lifecycle of the plan they extend; meaning, when a subscription expires, customers also lose access to the plan’s add-ons. The [features](#feature) included in each add-on are defined by [entitlements](#entitlement-coming-soon) associated with the add-on.

**Table:** ADDONS

| Column                 | Type          | Mandatory | Description                                                                                                       |
| ---------------------- | ------------- | --------- | ----------------------------------------------------------------------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Add-on internal identifier                                                                                        |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time                                                                                            |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time                                                                                         |
| ADDON\_ID              | VARCHAR       | Yes       | Add-on identifier                                                                                                 |
| BILLING\_ID            | VARCHAR       |           | Billing identifier (Stripe ID)                                                                                    |
| BILLING\_LINK\_URL     | VARCHAR       |           | URL for billing information of the add-on                                                                         |
| DISPLAY\_NAME          | VARCHAR       | Yes       | Display name of the add-on                                                                                        |
| PRICING\_TYPE          | VARCHAR       |           | Enum. Pricing type used for the add-on. Can be one of: FREE, PAID, CUSTOM. For add-ons, the value is always PAID. |
| DESCRIPTION            | VARCHAR       |           | Description of the add-on                                                                                         |
| ENVIRONMENT\_ID        | VARCHAR       |           | Identifier for the associated environment                                                                         |
| PRODUCT\_ID            | VARCHAR       |           | Identifier for the associated product                                                                             |
| IS\_LATEST             | BOOLEAN       |           | Indicates if this is the latest version of the add-on                                                             |
| VERSION\_NUMBER        | NUMBER        | Yes       | Version number of the add-on                                                                                      |
| ADDITIONAL\_META\_DATA | VARCHAR       |           | Additional metadata for the add-on                                                                                |

## Price

Represents the price of a package and its settings.

**Table:** PRICES

| Column                 | Type          | Mandatory | Description                                                                                                                                                  |
| ---------------------- | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ID                     | VARCHAR       | Yes       | Price internal identifier                                                                                                                                    |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time of the price                                                                                                                          |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time                                                                                                                                    |
| BILLING\_PERIOD        | VARCHAR       | Yes       | Enum. Billing period associated with the price. Can be one of: MONTHLY, ANNUALLY.                                                                            |
| BILLING\_MODEL         | VARCHAR       | Yes       | Enum. Billing model used for this price. Can be one of: FLAT\_FEE, PER\_UNIT, USAGE\_BASED.                                                                  |
| BILLING\_ID            | VARCHAR       |           | Billing identifier associated with the price                                                                                                                 |
| PRICE\_AMOUNT          | NUMBER        |           | Monetary value of the price                                                                                                                                  |
| PRICE\_CURRENCY        | VARCHAR       |           | Currency of the price                                                                                                                                        |
| BILLING\_COUNTRY\_CODE | VARCHAR       |           | Country code for billing                                                                                                                                     |
| FEATURE\_ID            | VARCHAR       |           | Identifier for the associated feature                                                                                                                        |
| MIN\_UNIT\_QUANTITY    | NUMBER        |           | Minimum unit quantity for applying this price                                                                                                                |
| PACKAGE\_ID            | VARCHAR       |           | Identifier for the associated package, can belong to a plan or an add-on                                                                                     |
| MAX\_UNIT\_QUANTITY    | NUMBER        |           | Maximum unit quantity for applying this price                                                                                                                |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Environment identifier                                                                                                                                       |
| TIERS\_MODE            | VARCHAR       |           | Enum. Mode of tiers for the price, if pricing is tiered. Can be one of: VOLUME, VOLUME\_PER\_UNIT, GRADUATED.                                                |
| TIERS                  | VARCHAR       |           | Tiers associated with the price. List of JSON objects with the following structure: `{ upTo: Float!; unitPriceAmount: Float!; unitPriceCurrency: String!; }` |

## Package Entitlement

Represents a feature entitlement associated with a [plan](#plan) or [add-on](#addon).

**Table:** PACKAGE\_ENTITLEMENTS

| Column                | Type          | Mandatory | Description                                                                                       |
| --------------------- | ------------- | --------- | ------------------------------------------------------------------------------------------------- |
| ID                    | VARCHAR       | Yes       | Unique identifier for the package entitlement                                                     |
| DESCRIPTION           | VARCHAR       |           | Description of the package entitlement                                                            |
| FEATURE\_ID           | VARCHAR       | Yes       | Identifier for the associated feature                                                             |
| PACKAGE\_ID           | VARCHAR       | Yes       | Identifier for the associated package                                                             |
| CREATED\_AT           | TIMESTAMP\_TZ |           | Creation date and time of the package entitlement                                                 |
| UPDATED\_AT           | TIMESTAMP\_TZ |           | Last update date and time of the package entitlement                                              |
| USAGE\_LIMIT          | NUMBER        |           | Usage limit for the entitlement                                                                   |
| HAS\_UNLIMITED\_USAGE | BOOLEAN       |           | Indicates if the entitlement has unlimited usage                                                  |
| IS\_CUSTOM            | BOOLEAN       |           | Indicates if the entitlement is [custom](../../modeling-your-pricing-in-stigg/plans/custom-plans) |
| ENVIRONMENT\_ID       | VARCHAR       | Yes       | Identifier for the associated environment                                                         |
| RESET\_PERIOD         | VARCHAR       |           | Enum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR.                    |

## Promotional Entitlement

Represents ad-hoc entitlements that are given to a specific [customer](#customer). Promotional entitlements can be granted to customers for a limited time period or throughout their entire lifetime.

**Table:** PROMOTIONAL\_ENTITLEMENTS

| Column                | Type          | Mandatory | Description                                                                                                                 |
| --------------------- | ------------- | --------- | --------------------------------------------------------------------------------------------------------------------------- |
| ID                    | VARCHAR       | Yes       | Unique identifier for the promotional entitlement                                                                           |
| DESCRIPTION           | VARCHAR       |           | Description of the promotional entitlement                                                                                  |
| CUSTOMER\_ID          | VARCHAR       | Yes       | Associated customer identifier                                                                                              |
| FEATURE\_ID           | VARCHAR       | Yes       | Identifier for the associated feature                                                                                       |
| CREATED\_AT           | TIMESTAMP\_TZ | Yes       | Creation date and time of the entitlement                                                                                   |
| UPDATED\_AT           | TIMESTAMP\_TZ | Yes       | Last update date and time of the entitlement                                                                                |
| START\_DATE           | TIMESTAMP\_TZ | Yes       | Start date of the promotional entitlement                                                                                   |
| END\_DATE             | TIMESTAMP\_TZ |           | End date of the promotional entitlement                                                                                     |
| USAGE\_LIMIT          | NUMBER        |           | Usage limit for the entitlement                                                                                             |
| HAS\_UNLIMITED\_USAGE | BOOLEAN       |           | Indicates if the entitlement has unlimited usage                                                                            |
| STATUS                | VARCHAR       | Yes       | Enum. Status of the promotional entitlement. Can be one of: Active, Expired, Paused.                                        |
| PERIOD                | VARCHAR       | Yes       | Enum. Period of the promotional entitlement. Can be one of: ONE\_WEEK, ONE\_MONTH, SIX\_MONTH, ONE\_YEAR, LIFETIME, CUSTOM. |
| RESET\_PERIOD         | VARCHAR       |           | Enum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR.                                              |
| ENVIRONMENT\_ID       | VARCHAR       |           | Identifier for the associated environment                                                                                   |

## Feature

Represents a configurable functionality in the product that can be monetized.

**Table:** FEATURES

| Column                 | Type          | Mandatory | Description                                                                     |
| ---------------------- | ------------- | --------- | ------------------------------------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Feature internal identifier                                                     |
| DISPLAY\_NAME          | VARCHAR       | Yes       | Display name of the feature                                                     |
| FEATURE\_ID            | VARCHAR       | Yes       | Feature identifier                                                              |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time of the feature                                           |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time of the feature                                        |
| FEATURE\_UNITS         | VARCHAR       |           | Units in which the feature is measured                                          |
| FEATURE\_UNITS\_PLURAL | VARCHAR       |           | Plural form of the feature units                                                |
| DESCRIPTION            | VARCHAR       |           | Description of the feature                                                      |
| FEATURE\_TYPE          | VARCHAR       | Yes       | Enum. Type of the feature. Can be one of: BOOLEAN, NUMBER.                      |
| METER\_TYPE            | VARCHAR       |           | Enum. Meter type of the feature. Can be one of: None, Fluctuating, Incremental. |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Identifier for the associated environment                                       |
| ADDITIONAL\_META\_DATA | VARCHAR       |           | Additional metadata for the feature                                             |

## Entitlement

Represents the right to use an application [feature](#feature), and to what extent. In Stigg, customer entitlements can be granted from multiple sources: [plans](#plan), [add-ons](#addon), overlapping trial [subscriptions](#subscription), [promotional entitlements](#promotional-entitlement), and additional [products](#product).

Entitlements are typically computed and cached. If one of the entitlement sources changes, the entitlements need to be refreshed. You can read about how entitlements are calculated [here](/faq/entitlements-and-usage/entitlement-calculation-in-stigg).

**Table:** ENTITLEMENTS

| Column                                | Type          | Mandatory | Description                                                                                                                                                                           |
| ------------------------------------- | ------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ID                                    | VARCHAR       | Yes       | Entitlement internal identifier                                                                                                                                                       |
| CREATED\_AT                           | TIMESTAMP\_TZ | Yes       | Creation date and time of the entitlement                                                                                                                                             |
| UPDATED\_AT                           | TIMESTAMP\_TZ | Yes       | Last update date and time of the entitlement                                                                                                                                          |
| ENVIRONMENT\_ID                       | VARCHAR       | Yes       | Identifier for the associated environment                                                                                                                                             |
| CUSTOMER\_UUID                        | VARCHAR       | Yes       | Customer internal identifier                                                                                                                                                          |
| CUSTOMER\_ID                          | VARCHAR       | Yes       | Customer identifier                                                                                                                                                                   |
| RESOURCE\_UUID                        | VARCHAR       |           | Resource internal identifier                                                                                                                                                          |
| RESOURCE\_ID                          | VARCHAR       |           | Resource identifier                                                                                                                                                                   |
| FEATURE\_UUID                         | VARCHAR       | Yes       | Feature internal identifier                                                                                                                                                           |
| FEATURE\_ID                           | VARCHAR       | Yes       | Feature identifier                                                                                                                                                                    |
| IS\_DELETED                           | BOOLEAN       | Yes       | Indicates whether the entitlement was deleted and is no longer applicable                                                                                                             |
| CURRENT\_USAGE                        | NUMBER        |           | Current usage of the entitlement                                                                                                                                                      |
| USAGE\_LIMIT                          | NUMBER        |           | Usage limit for the entitlement                                                                                                                                                       |
| HAS\_UNLIMITED\_USAGE                 | BOOLEAN       |           | Indicates if the entitlement has unlimited usage                                                                                                                                      |
| USAGE\_PERIOD\_ANCHOR                 | TIMESTAMP\_TZ |           | The anchor for calculating the usage period for metered entitlements with a reset period configured                                                                                   |
| USAGE\_PERIOD\_START                  | TIMESTAMP\_TZ |           | The start date of the usage period for metered entitlements with a reset period configured                                                                                            |
| USAGE\_PERIOD\_END                    | TIMESTAMP\_TZ |           | The end date of the usage period for metered entitlements with a reset period configured                                                                                              |
| RESET\_PERIOD                         | VARCHAR       |           | Enum. Reset period for the entitlement. Can be one of: MONTH, WEEK, DAY, HOUR.                                                                                                        |
| RESET\_PERIOD\_MONTHLY\_ACCORDING\_TO | VARCHAR       |           | Enum. Configuration for the monthly reset period. Can be one of: SubscriptionStart, StartOfTheMonth.                                                                                  |
| RESET\_PERIOD\_WEEKLY\_ACCORDING\_TO  | VARCHAR       |           | Enum. Configuration for the weekly reset period. Can be one of: SubscriptionStart, EverySunday, EveryMonday, EveryTuesday, EveryWednesday, EveryThursday, EveryFriday, EverySaturday. |

## Usage Measurement

Represents [calculated usage](../../getting-usage-data-into-stigg/reporting-calculated-usage) reports associated with a customer for a metered feature.

**Table:** USAGE\_MEASUREMENTS

| Column          | Type          | Mandatory | Description                                                                                       |
| --------------- | ------------- | --------- | ------------------------------------------------------------------------------------------------- |
| ID              | VARCHAR       | Yes       | Usage measurement internal identifier                                                             |
| CUSTOMER\_ID    | VARCHAR       | Yes       | Customer identifier                                                                               |
| RESOURCE\_ID    | VARCHAR       |           | Resource identifier                                                                               |
| FEATURE\_ID     | VARCHAR       | Yes       | Feature identifier                                                                                |
| CREATED\_AT     | TIMESTAMP\_TZ | Yes       | Creation date and time of the usage measurement                                                   |
| UPDATED\_AT     | TIMESTAMP\_TZ | Yes       | Last update date and time of the usage measurement                                                |
| VALUE           | NUMBER        | Yes       | Reported usage value reflects a change in usage, i.e., the delta, at the time of the report       |
| RESET\_PERIOD   | VARCHAR       |           | Enum. Reset period for the entitlement of the measurement. Can be one of: MONTH, WEEK, DAY, HOUR. |
| PERIOD\_START   | TIMESTAMP\_TZ |           | Reset period window start time                                                                    |
| PERIOD\_END     | TIMESTAMP\_TZ |           | Reset period window end time                                                                      |
| ENVIRONMENT\_ID | VARCHAR       | Yes       | Identifier for the associated environment                                                         |

## Usage Events

Represents the [raw usage events](../../getting-usage-data-into-stigg/reporting-raw-events/index) associated with a customer.

<Note>
  To enable reporting of raw usage events, please contact Stigg support.
</Note>

**Table:** USAGE\_EVENT\_\<ENVIRONMENT\_ID>

| Column           | Type          | Mandatory | Description                                                                         |
| ---------------- | ------------- | --------- | ----------------------------------------------------------------------------------- |
| ID               | VARCHAR       | Yes       | Usage event internal identifier                                                     |
| CUSTOMER\_ID     | VARCHAR       | Yes       | Customer identifier                                                                 |
| RESOURCE\_ID     | VARCHAR       |           | Resource identifier                                                                 |
| EVENT\_NAME      | VARCHAR       | Yes       | The name of the event                                                               |
| CREATED\_AT      | TIMESTAMP\_TZ | Yes       | Creation time ingested of the event                                                 |
| TIMESTAMP        | TIMESTAMP\_TZ | Yes       | The timestamp of the event                                                          |
| DIMENSIONS       | VARCHAR       | Yes       | Additional dimensions of the event which are used for the filtering and aggregation |
| IDEMPOTENCY\_KEY | VARCHAR       | Yes       | The events unique key.                                                              |
| ENVIRONMENT\_ID  | VARCHAR       | Yes       | Identifier for the associated environment                                           |

<Note>
  When enabled, the usage\_events table will also include events of calculated usage reports that were made to Stigg. Such reports will appear as \$usage.reported events.
</Note>

## Coupon

Represents a discount coupon that can be applied to a customer.

**Table:** COUPONS

| Column                 | Type          | Mandatory | Description                                                                                                                             |
| ---------------------- | ------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Coupon internal identifier                                                                                                              |
| COUPON\_ID             | VARCHAR       | Yes       | Coupon identifier                                                                                                                       |
| NAME                   | VARCHAR       | Yes       | Coupon name                                                                                                                             |
| DESCRIPTION            | VARCHAR       |           | Coupon description                                                                                                                      |
| BILLING\_ID            | VARCHAR       |           | Identifier of the coupon in the billing solution that’s integrated with Stigg, i.e. Stripe ID                                           |
| BILLING\_LINK\_URL     | VARCHAR       |           | URL for the coupon entity in the billing solution that’s integrated with Stigg                                                          |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time of the coupon                                                                                                    |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time of the coupon                                                                                                 |
| TYPE                   | VARCHAR       | Yes       | Enum. Coupon discount type. Can be one of: FIXED, PERCENTAGE.                                                                           |
| ~~DISCOUNT\_VALUE~~    | ~~NUMBER~~    | Yes       | ⚠️ This field is **deprecated**, use the `PERCENT_OFF` and `AMOUNTS_OFF`                                                                |
| AMOUNTS\_OFF           | VARCHAR       |           | Fixed price discounts in multiple-currency. List of JSON objects with the following structure: `{ amount: Float!; currency: String!; }` |
| PERCENT\_OFF           | NUMBER        |           | Percentage off discount                                                                                                                 |
| STATUS                 | VARCHAR       | Yes       | Enum. Coupon status. Can be one of: `ACTIVE`, `ARCHIVED`.                                                                               |
| ADDITIONAL\_META\_DATA | VARCHAR       |           | Additional metadata                                                                                                                     |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Identifier for the associated environment                                                                                               |

## Credits

### Credit Usage

Represents raw credit usage activity for a customer/resource.

**Table:** CREDITS\_USAGE\_\<ENVIRONMENT\_ID>

<Note>
  This export originates from ClickHouse and must be enabled by Stigg support before it is available in your BigQuery dataset.
</Note>

| Column                 | Type          | Mandatory | Description                                                |
| ---------------------- | ------------- | --------- | ---------------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Credit usage event internal identifier                     |
| EVENT\_ID              | VARCHAR       |           | Identifier of the source event                             |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Ingestion creation time of the record                      |
| FEATURE\_ID            | VARCHAR       |           | Identifier of the feature associated with the credit usage |
| TOTAL\_COST            | NUMERIC       |           | Total credit cost of the usage event                       |
| EVENT\_NAME            | VARCHAR       | Yes       | Name of the credit usage event                             |
| CUSTOMER\_ID           | VARCHAR       | Yes       | Customer identifier                                        |
| RESOURCE\_ID           | VARCHAR       |           | Resource identifier                                        |
| PARTIAL\_COST          | NUMERIC       |           | Partial credit cost consumed in the event                  |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Identifier for the associated environment                  |
| CREDIT\_GRANT\_ID      | VARCHAR       |           | Identifier of the credit grant being consumed              |
| EVENT\_TIMESTAMP       | TIMESTAMP\_TZ |           | Timestamp of the source event                              |
| CREDIT\_CURRENCY\_ID   | VARCHAR       |           | Identifier of the credit currency type                     |
| CONSUMPTION\_TIMESTAMP | TIMESTAMP\_TZ |           | Timestamp when credits were consumed                       |

<Note>
  The `CREDITS_USAGE` table does not include event dimensions. To enrich credit usage records with dimensions, join with the [`USAGE_EVENT`](#usage-events) table:

  ```sql theme={null}
  SELECT *
  FROM `<PROJECT_ID>.<DATASET_ID>.CREDITS_USAGE_<ENVIRONMENT_ID>` cu
  JOIN `<PROJECT_ID>.<DATASET_ID>.USAGE_EVENT_<ENVIRONMENT_ID>` ue ON cu.event_id = ue.id
  ```
</Note>

### Custom Currency

Represents a custom credit currency configured for an account (e.g., “Build Credits”, “AI Tokens”).

**Table:** CUSTOM\_CURRENCIES

| Column                 | Type          | Mandatory | Description                                          |
| ---------------------- | ------------- | --------- | ---------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Custom currency internal identifier                  |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time                               |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time                            |
| ACCOUNT\_ID            | VARCHAR       |           | Account identifier                                   |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Identifier for the associated environment            |
| DISPLAY\_NAME          | VARCHAR       | Yes       | Display name of the custom currency                  |
| CURRENCY\_ID           | VARCHAR       |           | Related standard currency identifier (if applicable) |
| SYMBOL                 | VARCHAR       |           | Symbol shown with the currency (e.g., “cr”, “⚡”)     |
| DESCRIPTION            | VARCHAR       |           | Description                                          |
| ADDITIONAL\_META\_DATA | VARCHAR       |           | Additional metadata JSON in a text format            |
| UNITS\_SINGULAR        | VARCHAR       |           | Singular display units (e.g., “credit”)              |
| UNITS\_PLURAL          | VARCHAR       |           | Plural display units (e.g., “credits”)               |

### Credit Grant

Represents a grant (allocation) of credits to a customer and/or resource, including lifecycle, amount, and consumption.

**Table:** CREDIT\_GRANTS

| Column                 | Type          | Mandatory | Description                                                                               |
| ---------------------- | ------------- | --------- | ----------------------------------------------------------------------------------------- |
| ID                     | VARCHAR       | Yes       | Credit grant internal identifier                                                          |
| CREATED\_AT            | TIMESTAMP\_TZ | Yes       | Creation date and time                                                                    |
| UPDATED\_AT            | TIMESTAMP\_TZ | Yes       | Last update date and time                                                                 |
| ACCOUNT\_ID            | VARCHAR       |           | Account identifier                                                                        |
| ENVIRONMENT\_ID        | VARCHAR       | Yes       | Identifier for the associated environment                                                 |
| DISPLAY\_NAME          | VARCHAR       |           | Display name for the grant                                                                |
| AMOUNT                 | NUMBER        | Yes       | Granted credit amount                                                                     |
| CONSUMED\_AMOUNT       | NUMBER        | Yes       | Amount of the grant that has been consumed                                                |
| GRANT\_TYPE            | VARCHAR       | Yes       | Enum. Type/category of the grant                                                          |
| PRIORITY               | NUMBER        |           | Priority used when multiple grants are applicable                                         |
| EFFECTIVE\_AT          | TIMESTAMP\_TZ | Yes       | Start time when the grant becomes effective                                               |
| EXPIRE\_AT             | TIMESTAMP\_TZ |           | Expiration time (if any)                                                                  |
| ADDITIONAL\_META\_DATA | VARCHAR       |           | Additional metadata JSON in a text format                                                 |
| COMMENT                | VARCHAR       |           | Free-text comment                                                                         |
| CUSTOMER\_ID           | VARCHAR       |           | Associated customer identifier                                                            |
| CUSTOMER\_REF\_ID      | VARCHAR       |           | External reference ID for the customer (if used)                                          |
| RESOURCE\_ID           | VARCHAR       |           | Associated resource identifier                                                            |
| RESOURCE\_REF\_ID      | VARCHAR       |           | External reference ID for the resource (if used)                                          |
| CUSTOM\_CURRENCY\_ID   | VARCHAR       |           | Associated custom currency identifier                                                     |
| CURRENCY\_ID           | VARCHAR       |           | Related standard currency identifier (if applicable)                                      |
| COST\_AMOUNT           | NUMBER        |           | Cost associated with the grant (monetary)                                                 |
| COST\_CURRENCY         | VARCHAR       |           | Currency code of the cost amount                                                          |
| CREDIT\_GRANT\_ID      | VARCHAR       |           | Related/parent grant identifier (for adjustments, roll-ups, or provenance, if applicable) |

## Integrations

### Integration

Represents a [native integration](/api-and-sdks/integration/overview) of a third-party application (i.e. Stripe, Salesforce, etc.) with Stigg.

**Table:** INTEGRATION

| Column             | Type          | Mandatory | Description                                                    |
| ------------------ | ------------- | --------- | -------------------------------------------------------------- |
| ID                 | VARCHAR       | Yes       | Internal identifier                                            |
| INTEGRATION\_ID    | VARCHAR       | Yes       | Integration identifier                                         |
| CREATED\_AT        | TIMESTAMP\_TZ | Yes       | Creation timestamp                                             |
| UPDATED\_AT        | TIMESTAMP\_TZ | Yes       | Last update timestamp                                          |
| VENDOR\_IDENTIFIER | VARCHAR       | Yes       | Vendor type, for example: Stripe, Salesforce, etc.             |
| IS\_DEFAULT        | BOOLEAN       | No        | Indicates whether this is the default integration of that type |
| DELETED\_AT        | TIMESTAMP\_TZ | No        | Deletion timestamp (if applicable)                             |

### Customer Integration

A linking table between the [Customer](#customer) table and the [Integration](#integration) table.

**Table:** CUSTOMER\_INTEGRATION

| Column             | Type          | Mandatory | Description                                           |
| ------------------ | ------------- | --------- | ----------------------------------------------------- |
| ID                 | VARCHAR       | Yes       | Internal identifier                                   |
| VENDOR\_IDENTIFIER | VARCHAR       | Yes       | Vendor type, for example: Stripe, Salesforce, etc.    |
| CUSTOMER\_ID       | VARCHAR       | Yes       | The customer ID                                       |
| SYNCED\_ENTITY\_ID | VARCHAR       | Yes       | The ID of the customer in the third-party integration |
| ENVIRONMENT\_ID    | VARCHAR       | Yes       | Identifier for the associated environment             |
| UPDATED\_AT        | TIMESTAMP\_TZ | Yes       | Last update timestamp                                 |

### Subscription Integration

A linking table between the [Subscription](#subscription) table and the [Integration](#integration) table.

**Table:** SUBSCRIPTION\_INTEGRATION

| Column             | Type          | Mandatory | Description                                               |
| ------------------ | ------------- | --------- | --------------------------------------------------------- |
| ID                 | VARCHAR       | Yes       | Internal identifier                                       |
| VENDOR\_IDENTIFIER | VARCHAR       | Yes       | Vendor type, for example: Stripe, Salesforce, etc.        |
| SUBSCRIPTION\_ID   | VARCHAR       | Yes       | The subscription ID                                       |
| SYNCED\_ENTITY\_ID | VARCHAR       | Yes       | The ID of the subscription in the third-party integration |
| ENVIRONMENT\_ID    | VARCHAR       | Yes       | Identifier for the associated environment                 |
| UPDATED\_AT        | TIMESTAMP\_TZ | Yes       | Last update timestamp                                     |

### Plan Integration

A linking table between the [Plan](#plan) table and the [Integration](#integration) table.

**Table:** PLAN\_INTEGRATION

| Column             | Type          | Mandatory | Description                                        |
| ------------------ | ------------- | --------- | -------------------------------------------------- |
| ID                 | VARCHAR       | Yes       | Internal identifier                                |
| VENDOR\_IDENTIFIER | VARCHAR       | Yes       | Vendor type, for example: Stripe, Salesforce, etc. |
| PLAN\_ID           | VARCHAR       | Yes       | The plan ID                                        |
| SYNCED\_ENTITY\_ID | VARCHAR       | Yes       | The ID of the plan in the third-party integration  |
| ENVIRONMENT\_ID    | VARCHAR       | Yes       | Identifier for the associated environment          |
| UPDATED\_AT        | TIMESTAMP\_TZ | Yes       | Last update timestamp                              |

### Add-on Integration

A linking table between the [Add-on](#add-on) table and the [Integration](#integration) table.

**Table:** ADDON\_INTEGRATION

| Column             | Type          | Mandatory | Description                                         |
| ------------------ | ------------- | --------- | --------------------------------------------------- |
| ID                 | VARCHAR       | Yes       | Internal identifier                                 |
| VENDOR\_IDENTIFIER | VARCHAR       | Yes       | Vendor type, for example: Stripe, Salesforce, etc.  |
| ADDON\_ID          | VARCHAR       | Yes       | The add-on ID                                       |
| SYNCED\_ENTITY\_ID | VARCHAR       | Yes       | The ID of the add-on in the third-party integration |
| ENVIRONMENT\_ID    | VARCHAR       | Yes       | Identifier for the associated environment           |
| UPDATED\_AT        | TIMESTAMP\_TZ | Yes       | Last update timestamp                               |

### Coupon Integration

A linking table between the [Coupon](#coupon) table and the [Integration](#integration) table.

**Table:** COUPON\_INTEGRATION

| Column             | Type          | Mandatory | Description                                         |
| ------------------ | ------------- | --------- | --------------------------------------------------- |
| ID                 | VARCHAR       | Yes       | Internal identifier                                 |
| VENDOR\_IDENTIFIER | VARCHAR       | Yes       | Vendor type, for example: Stripe, Salesforce, etc.  |
| COUPON\_ID         | VARCHAR       | Yes       | The coupon ID                                       |
| SYNCED\_ENTITY\_ID | VARCHAR       | Yes       | The ID of the add-on in the third-party integration |
| ENVIRONMENT\_ID    | VARCHAR       | Yes       | Identifier for the associated environment           |
| UPDATED\_AT        | TIMESTAMP\_TZ | Yes       | Last update timestamp                               |
