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

# Import

> Image a customer into Autumn for live migration. Read-only against processors.

export const DynamicResponseExample = ({json, statusCode = "200"}) => {
  const toCamelCase = str => {
    return str.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
  };
  const convertKeysToCamelCase = obj => {
    if (Array.isArray(obj)) {
      return obj.map(item => convertKeysToCamelCase(item));
    }
    if (obj !== null && typeof obj === "object") {
      return Object.keys(obj).reduce((acc, key) => {
        const camelKey = toCamelCase(key);
        acc[camelKey] = convertKeysToCamelCase(obj[key]);
        return acc;
      }, {});
    }
    return obj;
  };
  const [isTypeScript, setIsTypeScript] = useState(() => {
    if (typeof window !== "undefined") {
      try {
        const lang = localStorage.getItem("code");
        return JSON.parse(lang) === "typescript";
      } catch {
        return true;
      }
    }
    return true;
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      if (event.detail?.key === "code") {
        try {
          const value = JSON.parse(event.detail.value);
          setIsTypeScript(value === "typescript");
        } catch {}
      }
    };
    const pollInterval = setInterval(() => {
      try {
        const lang = localStorage.getItem("code");
        const value = JSON.parse(lang);
        setIsTypeScript(value === "typescript");
      } catch {}
    }, 300);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, []);
  const camelCaseJson = useMemo(() => convertKeysToCamelCase(json), [json]);
  const snakeCaseString = JSON.stringify(json, null, 2);
  const camelCaseString = JSON.stringify(camelCaseJson, null, 2);
  return <ResponseExample>
			{isTypeScript ? <CodeBlock language="json" filename={statusCode}>
					{camelCaseString}
				</CodeBlock> : <CodeBlock language="json" filename={statusCode}>
					{snakeCaseString}
				</CodeBlock>}
		</ResponseExample>;
};

export const DynamicResponseField = ({children, name, ...props}) => {
  const convertToCamelCase = str => {
    if (typeof str !== "string") return str;
    return str.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
  };
  const [lang, setLang] = useState(() => {
    if (typeof window !== "undefined") {
      const stored = localStorage.getItem("code");
      return stored || '"typescript"';
    }
    return '"typescript"';
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      const key = event.detail?.key;
      if (key === "code") {
        setLang(event.detail.value);
      }
    };
    const pollInterval = setInterval(() => {
      const current = localStorage.getItem("code");
      if (current && current !== lang) {
        setLang(current);
      }
    }, 500);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, [lang]);
  const resolvedName = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(name) : name;
    } catch {
      return name;
    }
  }, [name, lang]);
  return <ResponseField name={resolvedName} {...props}>
			{children}
		</ResponseField>;
};

export const DynamicParamField = ({children, body, path, ...props}) => {
  const convertToCamelCase = str => {
    if (typeof str !== "string") return str;
    return str.replace(/[_-](\w)/g, (_, c) => c.toUpperCase());
  };
  const [lang, setLang] = useState(() => {
    if (typeof window !== "undefined") {
      const stored = localStorage.getItem("code");
      return stored || '"typescript"';
    }
    return '"typescript"';
  });
  useEffect(() => {
    const onMintlifyStorage = event => {
      const key = event.detail?.key;
      if (key === "code") {
        setLang(event.detail.value);
      }
    };
    const pollInterval = setInterval(() => {
      const current = localStorage.getItem("code");
      if (current && current !== lang) {
        setLang(current);
      }
    }, 500);
    document.addEventListener("mintlify-localstorage", onMintlifyStorage);
    return () => {
      document.removeEventListener("mintlify-localstorage", onMintlifyStorage);
      clearInterval(pollInterval);
    };
  }, [lang]);
  const resolvedBody = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(body) : body;
    } catch {
      return body;
    }
  }, [body, lang]);
  const resolvedPath = useMemo(() => {
    try {
      const value = JSON.parse(lang);
      const useCamelCase = value === "typescript";
      return useCamelCase ? convertToCamelCase(path) : path;
    } catch {
      return path;
    }
  }, [path, lang]);
  return <ParamField body={resolvedBody} path={resolvedPath} {...props}>
			{children}
		</ParamField>;
};

### Body Parameters

<DynamicParamField body="customer_id" type="string" required>
  Autumn customer to image into.
</DynamicParamField>

<DynamicParamField body="customer_data" type="object">
  Optional identity fields to upsert if the customer is new.

  <Expandable title="properties">
    <DynamicParamField body="name" type="string">
      Display name for the customer.
    </DynamicParamField>

    <DynamicParamField body="email" type="string">
      Email address for the customer.
    </DynamicParamField>

    <DynamicParamField body="fingerprint" type="string">
      Anti-fraud fingerprint for the customer.
    </DynamicParamField>
  </Expandable>
</DynamicParamField>

<DynamicParamField body="processors" type="object[]">
  The customer's processor identities (e.g. Stripe customer id, RevenueCat app\_user\_id). Omit for customers with no processor, e.g. those only ever on a free plan.

  <Expandable title="properties">
    <DynamicParamField body="type" type="'stripe' | 'revenuecat'" required>
      The processor this identity belongs to.
    </DynamicParamField>

    <DynamicParamField body="id" type="string" required>
      The customer's id in that processor (Stripe customer id, or RevenueCat app\_user\_id).
    </DynamicParamField>
  </Expandable>
</DynamicParamField>

<DynamicParamField body="billables" type="object[]" required>
  The billing objects (subscriptions, one-offs) to image, each carrying its plan.

  <Expandable title="properties">
    <DynamicParamField body="processor" type="'stripe' | 'revenuecat'">
      The processor that owns this billable (stripe or revenuecat). Omit for plans with no processor, e.g. a free plan.
    </DynamicParamField>

    <DynamicParamField body="link" type="object">
      Existing processor billing object this billable is adopted from; omit for paid one-offs.

      <Expandable title="properties">
        <DynamicParamField body="subscription_id" type="string">
          Existing processor subscription id this billable is adopted from.
        </DynamicParamField>

        <DynamicParamField body="schedule_id" type="string">
          Existing processor subscription-schedule id this billable is adopted from.
        </DynamicParamField>
      </Expandable>
    </DynamicParamField>

    <DynamicParamField body="billing_cycle_anchor" type="number">
      Unix ms billing anchor shared by co-billed plans on this billable.
    </DynamicParamField>

    <DynamicParamField body="plan" type="object">
      The single plan on this billable (provide either plan or phases, not both).

      <Expandable title="properties">
        <DynamicParamField body="plan_id" type="string" required>
          The Autumn plan to attach to the customer.
        </DynamicParamField>

        <DynamicParamField body="version" type="number">
          Specific plan version to attach; defaults to the latest.
        </DynamicParamField>

        <DynamicParamField body="status" type="'active' | 'trialing' | 'past_due' | 'canceled' | 'expired'">
          Set the status of the plan to be flashed. Active if undefined.
        </DynamicParamField>

        <DynamicParamField body="started_at" type="number">
          When the plan started (Unix ms). Defaults to the linked subscription's start, else the import time. Set this for one-off purchases to record the real purchase date.
        </DynamicParamField>

        <DynamicParamField body="quantity" type="number">
          Seat/unit quantity for the plan.
        </DynamicParamField>

        <DynamicParamField body="feature_quantities" type="object[]">
          Purchased prepaid quantities per feature.

          <Expandable title="properties">
            <DynamicParamField body="feature_id" type="string" required>
              The prepaid feature being quantified.
            </DynamicParamField>

            <DynamicParamField body="quantity" type="number" required>
              Purchased quantity for this prepaid feature.
            </DynamicParamField>
          </Expandable>
        </DynamicParamField>

        <DynamicParamField body="balances" type="object[]">
          Per-feature balances to image onto the plan.

          <Expandable title="properties">
            <DynamicParamField body="feature_id" type="string" required>
              The feature whose balance is being set.
            </DynamicParamField>

            <DynamicParamField body="filter" type="object">
              Disambiguates which entitlement line to target when the feature has multiple.

              <Expandable title="properties">
                <DynamicParamField body="interval" type="'hour' | 'day' | 'week' | 'month' | 'year'">
                  Reset interval selecting which entitlement line to target when a feature has several (null = the non-resetting one-off line).
                </DynamicParamField>

                <DynamicParamField body="billing_behavior" type="'included' | 'prepaid'">
                  Selects the included vs prepaid entitlement line when a feature has both.
                </DynamicParamField>
              </Expandable>
            </DynamicParamField>

            <DynamicParamField body="usage" type="number">
              Units already consumed; remaining balance is derived from the plan allowance minus this.
            </DynamicParamField>

            <DynamicParamField body="balance" type="number">
              Explicit remaining balance override (mutually exclusive with usage).
            </DynamicParamField>

            <DynamicParamField body="next_reset_at" type="number">
              Unix ms timestamp of this line's next reset.
            </DynamicParamField>
          </Expandable>
        </DynamicParamField>
      </Expandable>
    </DynamicParamField>
  </Expandable>
</DynamicParamField>

<DynamicParamField body="dry_run" type="boolean">
  If true, validate and compute without persisting; returns what would be flashed.
</DynamicParamField>

### Response

<DynamicResponseField name="customer_id" type="string">
  The imaged customer's id.
</DynamicResponseField>

<DynamicResponseField name="flashed" type="object[]">
  Per-plan outcome of the flash.

  <Expandable title="properties">
    <DynamicResponseField name="plan_id" type="string">
      The plan that was imaged.
    </DynamicResponseField>

    <DynamicResponseField name="processor" type="string">
      The processor that owns the imaged plan.
    </DynamicResponseField>

    <DynamicResponseField name="customer_product_id" type="string | null">
      The created (or existing) customer product id, if any.
    </DynamicResponseField>

    <DynamicResponseField name="status" type="string">
      The resulting status of the imaged plan.
    </DynamicResponseField>

    <DynamicResponseField name="skipped" type="boolean">
      True if an active plan already existed and this one was left untouched.
    </DynamicResponseField>

    <DynamicResponseField name="expired" type="boolean">
      True if this was an existing active plan expired because it was absent from the imaged desired state.
    </DynamicResponseField>

    <DynamicResponseField name="mismatch" type="boolean">
      True when the imaged state may be wrong — e.g. a resetting plan with no resolvable billing anchor, or a paid recurring plan with no linked subscription for Autumn to manage. The plan is still imaged; see `reason` and fix by supplying started\_at or a subscription\_id.
    </DynamicResponseField>

    <DynamicResponseField name="reason" type="string">
      Why the plan was skipped, expired, or flagged as a mismatch, when applicable.
    </DynamicResponseField>
  </Expandable>
</DynamicResponseField>

<DynamicResponseField name="customer" type="object | null">
  The freshly-read imaged customer; null for dry\_run.

  <Expandable title="properties">
    <DynamicResponseField name="id" type="string | null">
      Your unique identifier for the customer.
    </DynamicResponseField>

    <DynamicResponseField name="name" type="string | null">
      The name of the customer.
    </DynamicResponseField>

    <DynamicResponseField name="email" type="string | null">
      The email address of the customer.
    </DynamicResponseField>

    <DynamicResponseField name="created_at" type="number">
      Timestamp of customer creation in milliseconds since epoch.
    </DynamicResponseField>

    <DynamicResponseField name="fingerprint" type="string | null">
      A unique identifier (eg. serial number) to de-duplicate customers across devices or browsers. For example: apple device ID.
    </DynamicResponseField>

    <DynamicResponseField name="stripe_id" type="string | null">
      Stripe customer ID.
    </DynamicResponseField>

    <DynamicResponseField name="env" type="'sandbox' | 'live'">
      The environment this customer was created in.
    </DynamicResponseField>

    <DynamicResponseField name="metadata" type="object">
      The metadata for the customer.
    </DynamicResponseField>

    <DynamicResponseField name="send_email_receipts" type="boolean">
      Whether to send email receipts to the customer.
    </DynamicResponseField>

    <DynamicResponseField name="billing_controls" type="object">
      Billing controls for the customer (auto top-ups, etc.)

      <Expandable title="properties">
        <DynamicResponseField name="auto_topups" type="object[]">
          List of auto top-up configurations per feature.

          <Expandable title="properties">
            <DynamicResponseField name="feature_id" type="string">
              The ID of the feature (credit balance) to auto top-up.
            </DynamicResponseField>

            <DynamicResponseField name="enabled" type="boolean">
              Whether auto top-up is enabled.
            </DynamicResponseField>

            <DynamicResponseField name="threshold" type="number">
              When the balance drops below this threshold, an auto top-up will be purchased.
            </DynamicResponseField>

            <DynamicResponseField name="quantity" type="number">
              Amount of credits to add per auto top-up.
            </DynamicResponseField>

            <DynamicResponseField name="purchase_limit" type="object">
              Optional rate limit to cap how often auto top-ups occur. Expand billing\_controls.auto\_topups.purchase\_limit for a count of top ups and the next\_reset\_at.

              <Expandable title="properties">
                <DynamicResponseField name="interval" type="'hour' | 'day' | 'week' | 'month'">
                  The time interval for the purchase limit window.
                </DynamicResponseField>

                <DynamicResponseField name="interval_count" type="number">
                  Number of intervals in the purchase limit window.
                </DynamicResponseField>

                <DynamicResponseField name="limit" type="number">
                  Maximum number of auto top-ups allowed within the interval.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="invoice_mode" type="boolean">
              When true, auto top-up creates a send\_invoice invoice instead of auto-charging.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="spend_limits" type="object[]">
          List of overage spend limits per feature (caps overage spend).

          <Expandable title="properties">
            <DynamicResponseField name="feature_id" type="string">
              Optional feature ID this spend limit applies to.
            </DynamicResponseField>

            <DynamicResponseField name="enabled" type="boolean">
              Whether the overage spend limit is enabled.
            </DynamicResponseField>

            <DynamicResponseField name="limit_type" type="'absolute' | 'usage_percentage'">
              How overage\_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
            </DynamicResponseField>

            <DynamicResponseField name="overage_limit" type="number">
              Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit\_type is usage\_percentage.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="usage_limits" type="object[]">
          List of hard usage caps per feature, with current interval usage.

          <Expandable title="properties">
            <DynamicResponseField name="feature_id" type="string">
              The feature this usage limit applies to.
            </DynamicResponseField>

            <DynamicResponseField name="enabled" type="boolean">
              Whether this usage limit is enabled.
            </DynamicResponseField>

            <DynamicResponseField name="limit" type="number">
              Maximum units allowed per interval.
            </DynamicResponseField>

            <DynamicResponseField name="interval" type="'day' | 'week' | 'month' | 'year'">
              Interval for the cap, aligned to the customer's billing cycle.
            </DynamicResponseField>

            <DynamicResponseField name="usage" type="number">
              Current usage already consumed in the active interval. Response-only; not stored on billing controls.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="usage_alerts" type="object[]">
          List of usage alert configurations per feature.

          <Expandable title="properties">
            <DynamicResponseField name="feature_id" type="string">
              The feature ID this alert applies to.
            </DynamicResponseField>

            <DynamicResponseField name="enabled" type="boolean">
              Whether this usage alert is enabled.
            </DynamicResponseField>

            <DynamicResponseField name="threshold" type="number">
              The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage\_percentage or remaining\_percentage, this is a percentage (0-100).
            </DynamicResponseField>

            <DynamicResponseField name="threshold_type" type="'usage' | 'usage_percentage' | 'remaining' | 'remaining_percentage'">
              Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
            </DynamicResponseField>

            <DynamicResponseField name="name" type="string">
              Optional user-defined label to distinguish multiple alerts on the same feature.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="overage_allowed" type="object[]">
          List of overage allowed controls per feature. When enabled, usage can exceed balance.

          <Expandable title="properties">
            <DynamicResponseField name="feature_id" type="string">
              The feature ID this overage allowed control applies to.
            </DynamicResponseField>

            <DynamicResponseField name="enabled" type="boolean">
              Whether overage is allowed for this feature.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="subscriptions" type="object[]">
      Active and scheduled recurring plans that this customer has attached.

      <Expandable title="properties">
        <DynamicResponseField name="id" type="string">
          The unique identifier of this subscription. If a subscription\_id was provided at attach time, it is used; otherwise, falls back to the internal ID.
        </DynamicResponseField>

        <DynamicResponseField name="plan" type="object">
          The full plan object if expanded.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              Unique identifier for the plan.
            </DynamicResponseField>

            <DynamicResponseField name="name" type="string">
              Display name of the plan.
            </DynamicResponseField>

            <DynamicResponseField name="description" type="string | null">
              Optional description of the plan.
            </DynamicResponseField>

            <DynamicResponseField name="group" type="string | null">
              Group identifier for organizing related plans. Plans in the same group are mutually exclusive.
            </DynamicResponseField>

            <DynamicResponseField name="version" type="number">
              Version number of the plan. Incremented when plan configuration changes.
            </DynamicResponseField>

            <DynamicResponseField name="add_on" type="boolean">
              Whether this is an add-on plan that can be attached alongside a main plan.
            </DynamicResponseField>

            <DynamicResponseField name="auto_enable" type="boolean">
              If true, this plan is automatically attached when a customer is created. Used for free plans.
            </DynamicResponseField>

            <DynamicResponseField name="price" type="object | null">
              Base recurring price for the plan. Null for free plans or usage-only plans.

              <Expandable title="properties">
                <DynamicResponseField name="amount" type="number">
                  Base price amount for the plan.
                </DynamicResponseField>

                <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                  Billing interval (e.g. 'month', 'year').
                </DynamicResponseField>

                <DynamicResponseField name="interval_count" type="number">
                  Number of intervals per billing cycle. Defaults to 1.
                </DynamicResponseField>

                <DynamicResponseField name="display" type="object">
                  Display text for showing this price in pricing pages.

                  <Expandable title="properties">
                    <DynamicResponseField name="primary_text" type="string">
                      Main display text (e.g. '\$10' or '100 messages').
                    </DynamicResponseField>

                    <DynamicResponseField name="secondary_text" type="string">
                      Secondary display text (e.g. 'per month' or 'then \$0.5 per 100').
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="items" type="object[]">
              Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.

              <Expandable title="properties">
                <DynamicResponseField name="feature_id" type="string">
                  The ID of the feature this item configures.
                </DynamicResponseField>

                <DynamicResponseField name="feature" type="object">
                  The full feature object if expanded.

                  <Expandable title="properties">
                    <DynamicResponseField name="id" type="string">
                      The ID of the feature, used to refer to it in other API calls like /track or /check.
                    </DynamicResponseField>

                    <DynamicResponseField name="name" type="string | null">
                      The name of the feature.
                    </DynamicResponseField>

                    <DynamicResponseField name="type" type="'static' | 'boolean' | 'single_use' | 'continuous_use' | 'credit_system' | 'ai_credit_system'">
                      The type of the feature
                    </DynamicResponseField>

                    <DynamicResponseField name="display" type="object | null">
                      Singular and plural display names for the feature.

                      <Expandable title="properties">
                        <DynamicResponseField name="singular" type="string">
                          The singular display name for the feature.
                        </DynamicResponseField>

                        <DynamicResponseField name="plural" type="string">
                          The plural display name for the feature.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="credit_schema" type="object[] | null">
                      Credit cost schema for credit system features.

                      <Expandable title="properties">
                        <DynamicResponseField name="metered_feature_id" type="string">
                          The ID of the metered feature (should be a single\_use feature).
                        </DynamicResponseField>

                        <DynamicResponseField name="credit_cost" type="number">
                          The credit cost of the metered feature.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="archived" type="boolean | null">
                      Whether or not the feature is archived.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="included" type="number">
                  Number of free units included. For consumable features, balance resets to this number each interval.
                </DynamicResponseField>

                <DynamicResponseField name="unlimited" type="boolean">
                  Whether the customer has unlimited access to this feature.
                </DynamicResponseField>

                <DynamicResponseField name="reset" type="object | null">
                  Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.

                  <Expandable title="properties">
                    <DynamicResponseField name="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                      The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
                    </DynamicResponseField>

                    <DynamicResponseField name="interval_count" type="number">
                      Number of intervals between resets. Defaults to 1.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="price" type="object | null">
                  Pricing configuration for usage beyond included units. Null if feature is entirely free.

                  <Expandable title="properties">
                    <DynamicResponseField name="amount" type="number">
                      Price per billing\_units after included usage is consumed. Mutually exclusive with tiers.
                    </DynamicResponseField>

                    <DynamicResponseField name="tiers" type="object[]">
                      Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.

                      <Expandable title="properties">
                        <DynamicResponseField name="to" type="number" />

                        <DynamicResponseField name="amount" type="number" />

                        <DynamicResponseField name="flat_amount" type="number" />
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="tier_behavior" type="'graduated' | 'volume'" />

                    <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                      Billing interval for this price. For consumable features, should match reset.interval.
                    </DynamicResponseField>

                    <DynamicResponseField name="interval_count" type="number">
                      Number of intervals per billing cycle. Defaults to 1.
                    </DynamicResponseField>

                    <DynamicResponseField name="billing_units" type="number">
                      Number of units per price increment. Usage is rounded UP to the nearest billing\_units when billed (e.g. billing\_units=100 means 101 usage rounds to 200).
                    </DynamicResponseField>

                    <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                      'prepaid' for features like seats where customers pay upfront, 'usage\_based' for pay-as-you-go after included usage.
                    </DynamicResponseField>

                    <DynamicResponseField name="max_purchase" type="number | null">
                      Maximum units a customer can purchase beyond included. E.g. if included=100 and max\_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="display" type="object">
                  Display text for showing this item in pricing pages.

                  <Expandable title="properties">
                    <DynamicResponseField name="primary_text" type="string">
                      Main display text (e.g. '\$10' or '100 messages').
                    </DynamicResponseField>

                    <DynamicResponseField name="secondary_text" type="string">
                      Secondary display text (e.g. 'per month' or 'then \$0.5 per 100').
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="rollover" type="object">
                  Rollover configuration for unused units. If set, unused included units roll over to the next period.

                  <Expandable title="properties">
                    <DynamicResponseField name="max" type="number | null">
                      Maximum rollover units. Null for unlimited rollover.
                    </DynamicResponseField>

                    <DynamicResponseField name="max_percentage" type="number | null">
                      Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
                    </DynamicResponseField>

                    <DynamicResponseField name="expiry_duration_type" type="'month' | 'forever'">
                      When rolled over units expire.
                    </DynamicResponseField>

                    <DynamicResponseField name="expiry_duration_length" type="number">
                      Number of periods before expiry.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="free_trial" type="object">
              Free trial configuration. If set, new customers can try this plan before being charged.

              <Expandable title="properties">
                <DynamicResponseField name="duration_length" type="number">
                  Number of duration\_type periods the trial lasts.
                </DynamicResponseField>

                <DynamicResponseField name="duration_type" type="'day' | 'month' | 'year'">
                  Unit of time for the trial duration ('day', 'month', 'year').
                </DynamicResponseField>

                <DynamicResponseField name="card_required" type="boolean">
                  Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
                </DynamicResponseField>

                <DynamicResponseField name="on_end" type="'bill' | 'revert'">
                  Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="created_at" type="number">
              Unix timestamp (ms) when the plan was created.
            </DynamicResponseField>

            <DynamicResponseField name="env" type="'sandbox' | 'live'">
              Environment this plan belongs to ('sandbox' or 'live').
            </DynamicResponseField>

            <DynamicResponseField name="archived" type="boolean">
              Whether the plan is archived. Archived plans cannot be attached to new customers.
            </DynamicResponseField>

            <DynamicResponseField name="base_variant_id" type="string | null">
              Deprecated. Use variant\_details.base\_plan\_id instead. If this is a variant, the ID of the base plan it was created from.
            </DynamicResponseField>

            <DynamicResponseField name="variant_details" type="object">
              Details about how this variant relates to its latest base plan.

              <Expandable title="properties">
                <DynamicResponseField name="base_plan_id" type="string">
                  The ID of the base plan this variant was derived from.
                </DynamicResponseField>

                <DynamicResponseField name="customize" type="object">
                  The customization that transforms the base plan into this variant.

                  <Expandable title="properties">
                    <DynamicResponseField name="price" type="object | null">
                      Base price configuration for a plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="amount" type="number">
                          Base price amount for the plan.
                        </DynamicResponseField>

                        <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                          Billing interval (e.g. 'month', 'year').
                        </DynamicResponseField>

                        <DynamicResponseField name="interval_count" type="number">
                          Number of intervals per billing cycle. Defaults to 1.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="add_items" type="object[]">
                      Items to add to the plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="feature_id" type="string">
                          The ID of the feature to configure.
                        </DynamicResponseField>

                        <DynamicResponseField name="included" type="number">
                          Number of free units included. Balance resets to this each interval for consumable features.
                        </DynamicResponseField>

                        <DynamicResponseField name="unlimited" type="boolean">
                          If true, customer has unlimited access to this feature.
                        </DynamicResponseField>

                        <DynamicResponseField name="reset" type="object">
                          Reset configuration for consumable features. Omit for non-consumable features like seats.

                          <Expandable title="properties">
                            <DynamicResponseField name="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                              Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
                            </DynamicResponseField>

                            <DynamicResponseField name="interval_count" type="number">
                              Number of intervals between resets. Defaults to 1.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="price" type="object">
                          Pricing for usage beyond included units. Omit for free features.

                          <Expandable title="properties">
                            <DynamicResponseField name="amount" type="number">
                              Price per billing\_units after included usage. Either 'amount' or 'tiers' is required.
                            </DynamicResponseField>

                            <DynamicResponseField name="tiers" type="object[]">
                              Tiered pricing. Either 'amount' or 'tiers' is required.

                              <Expandable title="properties">
                                <DynamicResponseField name="to" type="number" />

                                <DynamicResponseField name="amount" type="number" />

                                <DynamicResponseField name="flat_amount" type="number" />
                              </Expandable>
                            </DynamicResponseField>

                            <DynamicResponseField name="tier_behavior" type="'graduated' | 'volume'" />

                            <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                              Billing interval. For consumable features, should match reset.interval.
                            </DynamicResponseField>

                            <DynamicResponseField name="interval_count" type="number">
                              Number of intervals per billing cycle. Defaults to 1.
                            </DynamicResponseField>

                            <DynamicResponseField name="billing_units" type="number">
                              Units per price increment. Usage is rounded UP when billed (e.g. billing\_units=100 means 101 rounds to 200).
                            </DynamicResponseField>

                            <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                              'prepaid' for upfront payment (seats), 'usage\_based' for pay-as-you-go.
                            </DynamicResponseField>

                            <DynamicResponseField name="max_purchase" type="number | null">
                              Max units purchasable beyond included. E.g. included=100, max\_purchase=300 allows 400 total. Null for no limit.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="proration" type="object">
                          Proration settings for prepaid features. Controls mid-cycle quantity change billing.

                          <Expandable title="properties">
                            <DynamicResponseField name="on_increase" type="'bill_immediately' | 'prorate_immediately' | 'prorate_next_cycle' | 'bill_next_cycle'">
                              Billing behavior when quantity increases mid-cycle.
                            </DynamicResponseField>

                            <DynamicResponseField name="on_decrease" type="'prorate' | 'prorate_immediately' | 'prorate_next_cycle' | 'none' | 'no_prorations'">
                              Credit behavior when quantity decreases mid-cycle.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="rollover" type="object">
                          Rollover config for unused units. If set, unused included units carry over.

                          <Expandable title="properties">
                            <DynamicResponseField name="max" type="number">
                              Max rollover units. Omit for unlimited rollover.
                            </DynamicResponseField>

                            <DynamicResponseField name="max_percentage" type="number">
                              Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
                            </DynamicResponseField>

                            <DynamicResponseField name="expiry_duration_type" type="'month' | 'forever'">
                              When rolled over units expire.
                            </DynamicResponseField>

                            <DynamicResponseField name="expiry_duration_length" type="number">
                              Number of periods before expiry.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="remove_items" type="object[]">
                      Filters selecting items to remove from the plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="feature_id" type="string">
                          Match items linked to this feature.
                        </DynamicResponseField>

                        <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                          Match items with this billing method (prepaid or usage\_based).
                        </DynamicResponseField>

                        <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                          Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
                        </DynamicResponseField>

                        <DynamicResponseField name="interval_count" type="integer">
                          Match items with this interval\_count. Disambiguates between items that share an interval but differ in count.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="free_trial" type="object | null">
                      Free trial configuration for a plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="duration_length" type="number">
                          Number of duration\_type periods the trial lasts.
                        </DynamicResponseField>

                        <DynamicResponseField name="duration_type" type="'day' | 'month' | 'year'">
                          Unit of time for the trial ('day', 'month', 'year').
                        </DynamicResponseField>

                        <DynamicResponseField name="card_required" type="boolean">
                          If true, payment method required to start trial. Customer is charged after trial ends.
                        </DynamicResponseField>

                        <DynamicResponseField name="on_end" type="'bill' | 'revert'">
                          Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="billing_controls" type="object">
                      Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.

                      <Expandable title="properties">
                        <DynamicResponseField name="auto_topups" type="object[]">
                          List of auto top-up configurations per feature.

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The ID of the feature (credit balance) to auto top-up.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether auto top-up is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="threshold" type="number">
                              When the balance drops below this threshold, an auto top-up will be purchased.
                            </DynamicResponseField>

                            <DynamicResponseField name="quantity" type="number">
                              Amount of credits to add per auto top-up.
                            </DynamicResponseField>

                            <DynamicResponseField name="purchase_limit" type="object">
                              Optional rate limit to cap how often auto top-ups occur.

                              <Expandable title="properties">
                                <DynamicResponseField name="interval" type="'hour' | 'day' | 'week' | 'month'">
                                  The time interval for the purchase limit window.
                                </DynamicResponseField>

                                <DynamicResponseField name="interval_count" type="number">
                                  Number of intervals in the purchase limit window.
                                </DynamicResponseField>

                                <DynamicResponseField name="limit" type="number">
                                  Maximum number of auto top-ups allowed within the interval.
                                </DynamicResponseField>
                              </Expandable>
                            </DynamicResponseField>

                            <DynamicResponseField name="invoice_mode" type="boolean">
                              When true, auto top-up creates a send\_invoice invoice instead of auto-charging.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="spend_limits" type="object[]">
                          List of overage spend limits per feature (caps overage spend).

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              Optional feature ID this spend limit applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether the overage spend limit is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="limit_type" type="'absolute' | 'usage_percentage'">
                              How overage\_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
                            </DynamicResponseField>

                            <DynamicResponseField name="overage_limit" type="number">
                              Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit\_type is usage\_percentage.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="usage_limits" type="object[]">
                          List of hard usage caps per feature (max units per interval).

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The feature this usage limit applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether this usage limit is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="limit" type="number">
                              Maximum units allowed per interval.
                            </DynamicResponseField>

                            <DynamicResponseField name="interval" type="'day' | 'week' | 'month' | 'year'">
                              Interval for the cap, aligned to the customer's billing cycle.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="usage_alerts" type="object[]">
                          List of usage alert configurations per feature.

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The feature ID this alert applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether this usage alert is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="threshold" type="number">
                              The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage\_percentage or remaining\_percentage, this is a percentage (0-100).
                            </DynamicResponseField>

                            <DynamicResponseField name="threshold_type" type="'usage' | 'usage_percentage' | 'remaining' | 'remaining_percentage'">
                              Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
                            </DynamicResponseField>

                            <DynamicResponseField name="name" type="string">
                              Optional user-defined label to distinguish multiple alerts on the same feature.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="overage_allowed" type="object[]">
                          List of overage allowed controls per feature. When enabled, usage can exceed balance.

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The feature ID this overage allowed control applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether overage is allowed for this feature.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="config" type="object">
              Miscellaneous plan-level configuration flags.

              <Expandable title="properties">
                <DynamicResponseField name="ignore_past_due" type="boolean">
                  If true, entitlements attached to this plan will still reset on schedule even when the customer's product is in a past\_due state.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="billing_controls" type="object">
              Plan-level billing controls used as customer defaults.

              <Expandable title="properties">
                <DynamicResponseField name="auto_topups" type="object[]">
                  List of auto top-up configurations per feature.

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The ID of the feature (credit balance) to auto top-up.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether auto top-up is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="threshold" type="number">
                      When the balance drops below this threshold, an auto top-up will be purchased.
                    </DynamicResponseField>

                    <DynamicResponseField name="quantity" type="number">
                      Amount of credits to add per auto top-up.
                    </DynamicResponseField>

                    <DynamicResponseField name="purchase_limit" type="object">
                      Optional rate limit to cap how often auto top-ups occur.

                      <Expandable title="properties">
                        <DynamicResponseField name="interval" type="'hour' | 'day' | 'week' | 'month'">
                          The time interval for the purchase limit window.
                        </DynamicResponseField>

                        <DynamicResponseField name="interval_count" type="number">
                          Number of intervals in the purchase limit window.
                        </DynamicResponseField>

                        <DynamicResponseField name="limit" type="number">
                          Maximum number of auto top-ups allowed within the interval.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="invoice_mode" type="boolean">
                      When true, auto top-up creates a send\_invoice invoice instead of auto-charging.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="spend_limits" type="object[]">
                  List of overage spend limits per feature (caps overage spend).

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      Optional feature ID this spend limit applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether the overage spend limit is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="limit_type" type="'absolute' | 'usage_percentage'">
                      How overage\_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
                    </DynamicResponseField>

                    <DynamicResponseField name="overage_limit" type="number">
                      Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit\_type is usage\_percentage.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="usage_limits" type="object[]">
                  List of hard usage caps per feature (max units per interval).

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The feature this usage limit applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether this usage limit is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="limit" type="number">
                      Maximum units allowed per interval.
                    </DynamicResponseField>

                    <DynamicResponseField name="interval" type="'day' | 'week' | 'month' | 'year'">
                      Interval for the cap, aligned to the customer's billing cycle.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="usage_alerts" type="object[]">
                  List of usage alert configurations per feature.

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The feature ID this alert applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether this usage alert is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="threshold" type="number">
                      The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage\_percentage or remaining\_percentage, this is a percentage (0-100).
                    </DynamicResponseField>

                    <DynamicResponseField name="threshold_type" type="'usage' | 'usage_percentage' | 'remaining' | 'remaining_percentage'">
                      Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
                    </DynamicResponseField>

                    <DynamicResponseField name="name" type="string">
                      Optional user-defined label to distinguish multiple alerts on the same feature.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="overage_allowed" type="object[]">
                  List of overage allowed controls per feature. When enabled, usage can exceed balance.

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The feature ID this overage allowed control applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether overage is allowed for this feature.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="metadata" type="object">
              Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
            </DynamicResponseField>

            <DynamicResponseField name="customer_eligibility" type="object">
              <Expandable title="properties">
                <DynamicResponseField name="trial_available" type="boolean">
                  Whether the trial on this plan is available to this customer. For example, if the customer used the trial in the past, this will be false.
                </DynamicResponseField>

                <DynamicResponseField name="status" type="'active' | 'scheduled'">
                  The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
                </DynamicResponseField>

                <DynamicResponseField name="canceling" type="boolean">
                  Whether the customer's active instance of this plan is set to cancel.
                </DynamicResponseField>

                <DynamicResponseField name="trialing" type="boolean">
                  Whether the customer is currently on a free trial of this plan.
                </DynamicResponseField>

                <DynamicResponseField name="attach_action" type="'activate' | 'upgrade' | 'downgrade' | 'none' | 'purchase'">
                  The action that would occur if this plan were attached to the customer.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="plan_id" type="string">
          The unique identifier of the subscribed plan.
        </DynamicResponseField>

        <DynamicResponseField name="auto_enable" type="boolean">
          Whether the plan was automatically enabled for the customer.
        </DynamicResponseField>

        <DynamicResponseField name="add_on" type="boolean">
          Whether this is an add-on plan rather than a base subscription.
        </DynamicResponseField>

        <DynamicResponseField name="status" type="'active' | 'scheduled'">
          Current status of the subscription.
        </DynamicResponseField>

        <DynamicResponseField name="past_due" type="boolean">
          Whether the subscription has overdue payments.
        </DynamicResponseField>

        <DynamicResponseField name="canceled_at" type="number | null">
          Timestamp when the subscription was canceled, or null if not canceled.
        </DynamicResponseField>

        <DynamicResponseField name="expires_at" type="number | null">
          Timestamp when the subscription will expire, or null if no expiry set.
        </DynamicResponseField>

        <DynamicResponseField name="trial_ends_at" type="number | null">
          Timestamp when the trial period ends, or null if not on trial.
        </DynamicResponseField>

        <DynamicResponseField name="started_at" type="number">
          Timestamp when the subscription started.
        </DynamicResponseField>

        <DynamicResponseField name="current_period_start" type="number | null">
          Start timestamp of the current billing period.
        </DynamicResponseField>

        <DynamicResponseField name="current_period_end" type="number | null">
          End timestamp of the current billing period.
        </DynamicResponseField>

        <DynamicResponseField name="quantity" type="number">
          Number of units of this subscription (for per-seat plans).
        </DynamicResponseField>

        <DynamicResponseField name="scope" type="'customer' | 'entity'">
          Whether this subscription is attached at the customer level or entity level.
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="purchases" type="object[]">
      One-time purchases made by the customer.

      <Expandable title="properties">
        <DynamicResponseField name="plan" type="object">
          The full plan object if expanded.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              Unique identifier for the plan.
            </DynamicResponseField>

            <DynamicResponseField name="name" type="string">
              Display name of the plan.
            </DynamicResponseField>

            <DynamicResponseField name="description" type="string | null">
              Optional description of the plan.
            </DynamicResponseField>

            <DynamicResponseField name="group" type="string | null">
              Group identifier for organizing related plans. Plans in the same group are mutually exclusive.
            </DynamicResponseField>

            <DynamicResponseField name="version" type="number">
              Version number of the plan. Incremented when plan configuration changes.
            </DynamicResponseField>

            <DynamicResponseField name="add_on" type="boolean">
              Whether this is an add-on plan that can be attached alongside a main plan.
            </DynamicResponseField>

            <DynamicResponseField name="auto_enable" type="boolean">
              If true, this plan is automatically attached when a customer is created. Used for free plans.
            </DynamicResponseField>

            <DynamicResponseField name="price" type="object | null">
              Base recurring price for the plan. Null for free plans or usage-only plans.

              <Expandable title="properties">
                <DynamicResponseField name="amount" type="number">
                  Base price amount for the plan.
                </DynamicResponseField>

                <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                  Billing interval (e.g. 'month', 'year').
                </DynamicResponseField>

                <DynamicResponseField name="interval_count" type="number">
                  Number of intervals per billing cycle. Defaults to 1.
                </DynamicResponseField>

                <DynamicResponseField name="display" type="object">
                  Display text for showing this price in pricing pages.

                  <Expandable title="properties">
                    <DynamicResponseField name="primary_text" type="string">
                      Main display text (e.g. '\$10' or '100 messages').
                    </DynamicResponseField>

                    <DynamicResponseField name="secondary_text" type="string">
                      Secondary display text (e.g. 'per month' or 'then \$0.5 per 100').
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="items" type="object[]">
              Feature configurations included in this plan. Each item defines included units, pricing, and reset behavior for a feature.

              <Expandable title="properties">
                <DynamicResponseField name="feature_id" type="string">
                  The ID of the feature this item configures.
                </DynamicResponseField>

                <DynamicResponseField name="feature" type="object">
                  The full feature object if expanded.

                  <Expandable title="properties">
                    <DynamicResponseField name="id" type="string">
                      The ID of the feature, used to refer to it in other API calls like /track or /check.
                    </DynamicResponseField>

                    <DynamicResponseField name="name" type="string | null">
                      The name of the feature.
                    </DynamicResponseField>

                    <DynamicResponseField name="type" type="'static' | 'boolean' | 'single_use' | 'continuous_use' | 'credit_system' | 'ai_credit_system'">
                      The type of the feature
                    </DynamicResponseField>

                    <DynamicResponseField name="display" type="object | null">
                      Singular and plural display names for the feature.

                      <Expandable title="properties">
                        <DynamicResponseField name="singular" type="string">
                          The singular display name for the feature.
                        </DynamicResponseField>

                        <DynamicResponseField name="plural" type="string">
                          The plural display name for the feature.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="credit_schema" type="object[] | null">
                      Credit cost schema for credit system features.

                      <Expandable title="properties">
                        <DynamicResponseField name="metered_feature_id" type="string">
                          The ID of the metered feature (should be a single\_use feature).
                        </DynamicResponseField>

                        <DynamicResponseField name="credit_cost" type="number">
                          The credit cost of the metered feature.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="archived" type="boolean | null">
                      Whether or not the feature is archived.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="included" type="number">
                  Number of free units included. For consumable features, balance resets to this number each interval.
                </DynamicResponseField>

                <DynamicResponseField name="unlimited" type="boolean">
                  Whether the customer has unlimited access to this feature.
                </DynamicResponseField>

                <DynamicResponseField name="reset" type="object | null">
                  Reset configuration for consumable features. Null for non-consumable features like seats where usage persists across billing cycles.

                  <Expandable title="properties">
                    <DynamicResponseField name="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                      The interval at which the feature balance resets (e.g. 'month', 'year'). For consumable features, usage resets to 0 and included units are restored.
                    </DynamicResponseField>

                    <DynamicResponseField name="interval_count" type="number">
                      Number of intervals between resets. Defaults to 1.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="price" type="object | null">
                  Pricing configuration for usage beyond included units. Null if feature is entirely free.

                  <Expandable title="properties">
                    <DynamicResponseField name="amount" type="number">
                      Price per billing\_units after included usage is consumed. Mutually exclusive with tiers.
                    </DynamicResponseField>

                    <DynamicResponseField name="tiers" type="object[]">
                      Tiered pricing configuration. Each tier's 'to' INCLUDES the included amount. Either 'tiers' or 'amount' is required.

                      <Expandable title="properties">
                        <DynamicResponseField name="to" type="number" />

                        <DynamicResponseField name="amount" type="number" />

                        <DynamicResponseField name="flat_amount" type="number" />
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="tier_behavior" type="'graduated' | 'volume'" />

                    <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                      Billing interval for this price. For consumable features, should match reset.interval.
                    </DynamicResponseField>

                    <DynamicResponseField name="interval_count" type="number">
                      Number of intervals per billing cycle. Defaults to 1.
                    </DynamicResponseField>

                    <DynamicResponseField name="billing_units" type="number">
                      Number of units per price increment. Usage is rounded UP to the nearest billing\_units when billed (e.g. billing\_units=100 means 101 usage rounds to 200).
                    </DynamicResponseField>

                    <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                      'prepaid' for features like seats where customers pay upfront, 'usage\_based' for pay-as-you-go after included usage.
                    </DynamicResponseField>

                    <DynamicResponseField name="max_purchase" type="number | null">
                      Maximum units a customer can purchase beyond included. E.g. if included=100 and max\_purchase=300, customer can use up to 400 total before usage is capped. Null for no limit.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="display" type="object">
                  Display text for showing this item in pricing pages.

                  <Expandable title="properties">
                    <DynamicResponseField name="primary_text" type="string">
                      Main display text (e.g. '\$10' or '100 messages').
                    </DynamicResponseField>

                    <DynamicResponseField name="secondary_text" type="string">
                      Secondary display text (e.g. 'per month' or 'then \$0.5 per 100').
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="rollover" type="object">
                  Rollover configuration for unused units. If set, unused included units roll over to the next period.

                  <Expandable title="properties">
                    <DynamicResponseField name="max" type="number | null">
                      Maximum rollover units. Null for unlimited rollover.
                    </DynamicResponseField>

                    <DynamicResponseField name="max_percentage" type="number | null">
                      Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
                    </DynamicResponseField>

                    <DynamicResponseField name="expiry_duration_type" type="'month' | 'forever'">
                      When rolled over units expire.
                    </DynamicResponseField>

                    <DynamicResponseField name="expiry_duration_length" type="number">
                      Number of periods before expiry.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="free_trial" type="object">
              Free trial configuration. If set, new customers can try this plan before being charged.

              <Expandable title="properties">
                <DynamicResponseField name="duration_length" type="number">
                  Number of duration\_type periods the trial lasts.
                </DynamicResponseField>

                <DynamicResponseField name="duration_type" type="'day' | 'month' | 'year'">
                  Unit of time for the trial duration ('day', 'month', 'year').
                </DynamicResponseField>

                <DynamicResponseField name="card_required" type="boolean">
                  Whether a payment method is required to start the trial. If true, customer will be charged after trial ends.
                </DynamicResponseField>

                <DynamicResponseField name="on_end" type="'bill' | 'revert'">
                  Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="created_at" type="number">
              Unix timestamp (ms) when the plan was created.
            </DynamicResponseField>

            <DynamicResponseField name="env" type="'sandbox' | 'live'">
              Environment this plan belongs to ('sandbox' or 'live').
            </DynamicResponseField>

            <DynamicResponseField name="archived" type="boolean">
              Whether the plan is archived. Archived plans cannot be attached to new customers.
            </DynamicResponseField>

            <DynamicResponseField name="base_variant_id" type="string | null">
              Deprecated. Use variant\_details.base\_plan\_id instead. If this is a variant, the ID of the base plan it was created from.
            </DynamicResponseField>

            <DynamicResponseField name="variant_details" type="object">
              Details about how this variant relates to its latest base plan.

              <Expandable title="properties">
                <DynamicResponseField name="base_plan_id" type="string">
                  The ID of the base plan this variant was derived from.
                </DynamicResponseField>

                <DynamicResponseField name="customize" type="object">
                  The customization that transforms the base plan into this variant.

                  <Expandable title="properties">
                    <DynamicResponseField name="price" type="object | null">
                      Base price configuration for a plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="amount" type="number">
                          Base price amount for the plan.
                        </DynamicResponseField>

                        <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                          Billing interval (e.g. 'month', 'year').
                        </DynamicResponseField>

                        <DynamicResponseField name="interval_count" type="number">
                          Number of intervals per billing cycle. Defaults to 1.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="add_items" type="object[]">
                      Items to add to the plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="feature_id" type="string">
                          The ID of the feature to configure.
                        </DynamicResponseField>

                        <DynamicResponseField name="included" type="number">
                          Number of free units included. Balance resets to this each interval for consumable features.
                        </DynamicResponseField>

                        <DynamicResponseField name="unlimited" type="boolean">
                          If true, customer has unlimited access to this feature.
                        </DynamicResponseField>

                        <DynamicResponseField name="reset" type="object">
                          Reset configuration for consumable features. Omit for non-consumable features like seats.

                          <Expandable title="properties">
                            <DynamicResponseField name="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                              Interval at which balance resets (e.g. 'month', 'year'). For consumable features only.
                            </DynamicResponseField>

                            <DynamicResponseField name="interval_count" type="number">
                              Number of intervals between resets. Defaults to 1.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="price" type="object">
                          Pricing for usage beyond included units. Omit for free features.

                          <Expandable title="properties">
                            <DynamicResponseField name="amount" type="number">
                              Price per billing\_units after included usage. Either 'amount' or 'tiers' is required.
                            </DynamicResponseField>

                            <DynamicResponseField name="tiers" type="object[]">
                              Tiered pricing. Either 'amount' or 'tiers' is required.

                              <Expandable title="properties">
                                <DynamicResponseField name="to" type="number" />

                                <DynamicResponseField name="amount" type="number" />

                                <DynamicResponseField name="flat_amount" type="number" />
                              </Expandable>
                            </DynamicResponseField>

                            <DynamicResponseField name="tier_behavior" type="'graduated' | 'volume'" />

                            <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                              Billing interval. For consumable features, should match reset.interval.
                            </DynamicResponseField>

                            <DynamicResponseField name="interval_count" type="number">
                              Number of intervals per billing cycle. Defaults to 1.
                            </DynamicResponseField>

                            <DynamicResponseField name="billing_units" type="number">
                              Units per price increment. Usage is rounded UP when billed (e.g. billing\_units=100 means 101 rounds to 200).
                            </DynamicResponseField>

                            <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                              'prepaid' for upfront payment (seats), 'usage\_based' for pay-as-you-go.
                            </DynamicResponseField>

                            <DynamicResponseField name="max_purchase" type="number | null">
                              Max units purchasable beyond included. E.g. included=100, max\_purchase=300 allows 400 total. Null for no limit.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="proration" type="object">
                          Proration settings for prepaid features. Controls mid-cycle quantity change billing.

                          <Expandable title="properties">
                            <DynamicResponseField name="on_increase" type="'bill_immediately' | 'prorate_immediately' | 'prorate_next_cycle' | 'bill_next_cycle'">
                              Billing behavior when quantity increases mid-cycle.
                            </DynamicResponseField>

                            <DynamicResponseField name="on_decrease" type="'prorate' | 'prorate_immediately' | 'prorate_next_cycle' | 'none' | 'no_prorations'">
                              Credit behavior when quantity decreases mid-cycle.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="rollover" type="object">
                          Rollover config for unused units. If set, unused included units carry over.

                          <Expandable title="properties">
                            <DynamicResponseField name="max" type="number">
                              Max rollover units. Omit for unlimited rollover.
                            </DynamicResponseField>

                            <DynamicResponseField name="max_percentage" type="number">
                              Maximum rollover as a percentage (0-100) of included + prepaid grant. Mutually exclusive with max.
                            </DynamicResponseField>

                            <DynamicResponseField name="expiry_duration_type" type="'month' | 'forever'">
                              When rolled over units expire.
                            </DynamicResponseField>

                            <DynamicResponseField name="expiry_duration_length" type="number">
                              Number of periods before expiry.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="remove_items" type="object[]">
                      Filters selecting items to remove from the plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="feature_id" type="string">
                          Match items linked to this feature.
                        </DynamicResponseField>

                        <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                          Match items with this billing method (prepaid or usage\_based).
                        </DynamicResponseField>

                        <DynamicResponseField name="interval" type="'one_off' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                          Match items with this interval. Accepts either a BillingInterval (price-side) or a ResetInterval (reset-side, includes day/hour/minute) so price-less items keyed by reset.interval can be disambiguated.
                        </DynamicResponseField>

                        <DynamicResponseField name="interval_count" type="integer">
                          Match items with this interval\_count. Disambiguates between items that share an interval but differ in count.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="free_trial" type="object | null">
                      Free trial configuration for a plan.

                      <Expandable title="properties">
                        <DynamicResponseField name="duration_length" type="number">
                          Number of duration\_type periods the trial lasts.
                        </DynamicResponseField>

                        <DynamicResponseField name="duration_type" type="'day' | 'month' | 'year'">
                          Unit of time for the trial ('day', 'month', 'year').
                        </DynamicResponseField>

                        <DynamicResponseField name="card_required" type="boolean">
                          If true, payment method required to start trial. Customer is charged after trial ends.
                        </DynamicResponseField>

                        <DynamicResponseField name="on_end" type="'bill' | 'revert'">
                          Behavior when the trial ends. 'bill' charges the customer (default). 'revert' expires the trial and restores the customer's previous plan.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="billing_controls" type="object">
                      Override the plan's billing controls (auto top-ups, spend limits, usage limits, usage alerts, overage allowed) for this customer.

                      <Expandable title="properties">
                        <DynamicResponseField name="auto_topups" type="object[]">
                          List of auto top-up configurations per feature.

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The ID of the feature (credit balance) to auto top-up.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether auto top-up is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="threshold" type="number">
                              When the balance drops below this threshold, an auto top-up will be purchased.
                            </DynamicResponseField>

                            <DynamicResponseField name="quantity" type="number">
                              Amount of credits to add per auto top-up.
                            </DynamicResponseField>

                            <DynamicResponseField name="purchase_limit" type="object">
                              Optional rate limit to cap how often auto top-ups occur.

                              <Expandable title="properties">
                                <DynamicResponseField name="interval" type="'hour' | 'day' | 'week' | 'month'">
                                  The time interval for the purchase limit window.
                                </DynamicResponseField>

                                <DynamicResponseField name="interval_count" type="number">
                                  Number of intervals in the purchase limit window.
                                </DynamicResponseField>

                                <DynamicResponseField name="limit" type="number">
                                  Maximum number of auto top-ups allowed within the interval.
                                </DynamicResponseField>
                              </Expandable>
                            </DynamicResponseField>

                            <DynamicResponseField name="invoice_mode" type="boolean">
                              When true, auto top-up creates a send\_invoice invoice instead of auto-charging.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="spend_limits" type="object[]">
                          List of overage spend limits per feature (caps overage spend).

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              Optional feature ID this spend limit applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether the overage spend limit is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="limit_type" type="'absolute' | 'usage_percentage'">
                              How overage\_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
                            </DynamicResponseField>

                            <DynamicResponseField name="overage_limit" type="number">
                              Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit\_type is usage\_percentage.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="usage_limits" type="object[]">
                          List of hard usage caps per feature (max units per interval).

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The feature this usage limit applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether this usage limit is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="limit" type="number">
                              Maximum units allowed per interval.
                            </DynamicResponseField>

                            <DynamicResponseField name="interval" type="'day' | 'week' | 'month' | 'year'">
                              Interval for the cap, aligned to the customer's billing cycle.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="usage_alerts" type="object[]">
                          List of usage alert configurations per feature.

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The feature ID this alert applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether this usage alert is enabled.
                            </DynamicResponseField>

                            <DynamicResponseField name="threshold" type="number">
                              The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage\_percentage or remaining\_percentage, this is a percentage (0-100).
                            </DynamicResponseField>

                            <DynamicResponseField name="threshold_type" type="'usage' | 'usage_percentage' | 'remaining' | 'remaining_percentage'">
                              Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
                            </DynamicResponseField>

                            <DynamicResponseField name="name" type="string">
                              Optional user-defined label to distinguish multiple alerts on the same feature.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>

                        <DynamicResponseField name="overage_allowed" type="object[]">
                          List of overage allowed controls per feature. When enabled, usage can exceed balance.

                          <Expandable title="properties">
                            <DynamicResponseField name="feature_id" type="string">
                              The feature ID this overage allowed control applies to.
                            </DynamicResponseField>

                            <DynamicResponseField name="enabled" type="boolean">
                              Whether overage is allowed for this feature.
                            </DynamicResponseField>
                          </Expandable>
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="config" type="object">
              Miscellaneous plan-level configuration flags.

              <Expandable title="properties">
                <DynamicResponseField name="ignore_past_due" type="boolean">
                  If true, entitlements attached to this plan will still reset on schedule even when the customer's product is in a past\_due state.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="billing_controls" type="object">
              Plan-level billing controls used as customer defaults.

              <Expandable title="properties">
                <DynamicResponseField name="auto_topups" type="object[]">
                  List of auto top-up configurations per feature.

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The ID of the feature (credit balance) to auto top-up.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether auto top-up is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="threshold" type="number">
                      When the balance drops below this threshold, an auto top-up will be purchased.
                    </DynamicResponseField>

                    <DynamicResponseField name="quantity" type="number">
                      Amount of credits to add per auto top-up.
                    </DynamicResponseField>

                    <DynamicResponseField name="purchase_limit" type="object">
                      Optional rate limit to cap how often auto top-ups occur.

                      <Expandable title="properties">
                        <DynamicResponseField name="interval" type="'hour' | 'day' | 'week' | 'month'">
                          The time interval for the purchase limit window.
                        </DynamicResponseField>

                        <DynamicResponseField name="interval_count" type="number">
                          Number of intervals in the purchase limit window.
                        </DynamicResponseField>

                        <DynamicResponseField name="limit" type="number">
                          Maximum number of auto top-ups allowed within the interval.
                        </DynamicResponseField>
                      </Expandable>
                    </DynamicResponseField>

                    <DynamicResponseField name="invoice_mode" type="boolean">
                      When true, auto top-up creates a send\_invoice invoice instead of auto-charging.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="spend_limits" type="object[]">
                  List of overage spend limits per feature (caps overage spend).

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      Optional feature ID this spend limit applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether the overage spend limit is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="limit_type" type="'absolute' | 'usage_percentage'">
                      How overage\_limit is interpreted: an absolute overage cap (default) or a percentage of the main-plan allowance.
                    </DynamicResponseField>

                    <DynamicResponseField name="overage_limit" type="number">
                      Overage cap for the feature: absolute units, or a percent (e.g. 120) when limit\_type is usage\_percentage.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="usage_limits" type="object[]">
                  List of hard usage caps per feature (max units per interval).

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The feature this usage limit applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether this usage limit is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="limit" type="number">
                      Maximum units allowed per interval.
                    </DynamicResponseField>

                    <DynamicResponseField name="interval" type="'day' | 'week' | 'month' | 'year'">
                      Interval for the cap, aligned to the customer's billing cycle.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="usage_alerts" type="object[]">
                  List of usage alert configurations per feature.

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The feature ID this alert applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether this usage alert is enabled.
                    </DynamicResponseField>

                    <DynamicResponseField name="threshold" type="number">
                      The threshold value that triggers the alert. For usage or remaining, this is an absolute count. For usage\_percentage or remaining\_percentage, this is a percentage (0-100).
                    </DynamicResponseField>

                    <DynamicResponseField name="threshold_type" type="'usage' | 'usage_percentage' | 'remaining' | 'remaining_percentage'">
                      Whether the threshold is an absolute count or a percentage of the usage allowance or remaining balance.
                    </DynamicResponseField>

                    <DynamicResponseField name="name" type="string">
                      Optional user-defined label to distinguish multiple alerts on the same feature.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="overage_allowed" type="object[]">
                  List of overage allowed controls per feature. When enabled, usage can exceed balance.

                  <Expandable title="properties">
                    <DynamicResponseField name="feature_id" type="string">
                      The feature ID this overage allowed control applies to.
                    </DynamicResponseField>

                    <DynamicResponseField name="enabled" type="boolean">
                      Whether overage is allowed for this feature.
                    </DynamicResponseField>
                  </Expandable>
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="metadata" type="object">
              Arbitrary key-value metadata defined by you for your own use. Shared across all versions of the plan.
            </DynamicResponseField>

            <DynamicResponseField name="customer_eligibility" type="object">
              <Expandable title="properties">
                <DynamicResponseField name="trial_available" type="boolean">
                  Whether the trial on this plan is available to this customer. For example, if the customer used the trial in the past, this will be false.
                </DynamicResponseField>

                <DynamicResponseField name="status" type="'active' | 'scheduled'">
                  The customer's current status with this plan. 'active' if attached, 'scheduled' if pending activation.
                </DynamicResponseField>

                <DynamicResponseField name="canceling" type="boolean">
                  Whether the customer's active instance of this plan is set to cancel.
                </DynamicResponseField>

                <DynamicResponseField name="trialing" type="boolean">
                  Whether the customer is currently on a free trial of this plan.
                </DynamicResponseField>

                <DynamicResponseField name="attach_action" type="'activate' | 'upgrade' | 'downgrade' | 'none' | 'purchase'">
                  The action that would occur if this plan were attached to the customer.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="plan_id" type="string">
          The unique identifier of the purchased plan.
        </DynamicResponseField>

        <DynamicResponseField name="expires_at" type="number | null">
          Timestamp when the purchase expires, or null for lifetime access.
        </DynamicResponseField>

        <DynamicResponseField name="started_at" type="number">
          Timestamp when the purchase was made.
        </DynamicResponseField>

        <DynamicResponseField name="quantity" type="number">
          Number of units purchased.
        </DynamicResponseField>

        <DynamicResponseField name="scope" type="'customer' | 'entity'">
          Whether this purchase is attached at the customer level or entity level.
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="balances.{key}" type="object">
      Feature balances keyed by feature ID, showing usage limits and remaining amounts.

      <Expandable title="properties">
        <DynamicResponseField name="feature_id" type="string">
          The feature ID this balance is for.
        </DynamicResponseField>

        <DynamicResponseField name="feature" type="object">
          The full feature object if expanded.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              The unique identifier for this feature, used in /check and /track calls.
            </DynamicResponseField>

            <DynamicResponseField name="name" type="string">
              Human-readable name displayed in the dashboard and billing UI.
            </DynamicResponseField>

            <DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system' | 'ai_credit_system'">
              Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit\_system' for unified credit pools, 'ai\_credit\_system' for model-based token pricing.
            </DynamicResponseField>

            <DynamicResponseField name="consumable" type="boolean">
              For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
            </DynamicResponseField>

            <DynamicResponseField name="event_names" type="string[]">
              Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
            </DynamicResponseField>

            <DynamicResponseField name="credit_schema" type="object[]">
              For credit\_system features: maps metered features to their credit costs.

              <Expandable title="properties">
                <DynamicResponseField name="metered_feature_id" type="string">
                  ID of the metered feature that draws from this credit system.
                </DynamicResponseField>

                <DynamicResponseField name="credit_cost" type="number">
                  Credits consumed per unit of the metered feature.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="model_markups.{key}" type="object | null">
              Per-model markup overrides for AI credit systems.

              <Expandable title="properties">
                <DynamicResponseField name="markup" type="number" />

                <DynamicResponseField name="input_cost" type="number" />

                <DynamicResponseField name="output_cost" type="number" />
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="default_markup" type="number">
              Default percentage markup for AI credit systems. Use -100 to make usage free.
            </DynamicResponseField>

            <DynamicResponseField name="provider_markups.{key}" type="object | null">
              Per-provider default markup percentages for AI credit systems.

              <Expandable title="properties">
                <DynamicResponseField name="markup" type="number" />
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="display" type="object">
              Display names for the feature in billing UI and customer-facing components.

              <Expandable title="properties">
                <DynamicResponseField name="singular" type="string | null">
                  Singular form for UI display (e.g., 'API call', 'seat').
                </DynamicResponseField>

                <DynamicResponseField name="plural" type="string | null">
                  Plural form for UI display (e.g., 'API calls', 'seats').
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="archived" type="boolean">
              Whether the feature is archived and hidden from the dashboard.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="granted" type="number">
          Total balance granted (included + prepaid).
        </DynamicResponseField>

        <DynamicResponseField name="remaining" type="number">
          Remaining balance available for use.
        </DynamicResponseField>

        <DynamicResponseField name="usage" type="number">
          Total usage consumed in the current period.
        </DynamicResponseField>

        <DynamicResponseField name="unlimited" type="boolean">
          Whether this feature has unlimited usage.
        </DynamicResponseField>

        <DynamicResponseField name="overage_allowed" type="boolean">
          Whether usage beyond the granted balance is allowed (with overage charges).
        </DynamicResponseField>

        <DynamicResponseField name="max_purchase" type="number | null">
          Maximum quantity that can be purchased as a top-up, or null for unlimited.
        </DynamicResponseField>

        <DynamicResponseField name="next_reset_at" type="number | null">
          Timestamp when the balance will reset, or null for no reset.
        </DynamicResponseField>

        <DynamicResponseField name="breakdown" type="object[]">
          Detailed breakdown of balance sources when stacking multiple plans or grants.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              The unique identifier for this balance breakdown.
            </DynamicResponseField>

            <DynamicResponseField name="plan_id" type="string | null">
              The plan ID this balance originates from, or null for standalone balances.
            </DynamicResponseField>

            <DynamicResponseField name="included_grant" type="number">
              Amount granted from the plan's included usage.
            </DynamicResponseField>

            <DynamicResponseField name="prepaid_grant" type="number">
              Amount granted from prepaid purchases or top-ups.
            </DynamicResponseField>

            <DynamicResponseField name="remaining" type="number">
              Remaining balance available for use.
            </DynamicResponseField>

            <DynamicResponseField name="usage" type="number">
              Amount consumed in the current period.
            </DynamicResponseField>

            <DynamicResponseField name="unlimited" type="boolean">
              Whether this balance has unlimited usage.
            </DynamicResponseField>

            <DynamicResponseField name="reset" type="object | null">
              Reset configuration for this balance, or null if no reset.

              <Expandable title="properties">
                <DynamicResponseField name="interval" type="'one_off' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'semi_annual' | 'year'">
                  The reset interval (hour, day, week, month, etc.) or 'multiple' if combined from different intervals.
                </DynamicResponseField>

                <DynamicResponseField name="interval_count" type="number">
                  Number of intervals between resets (eg. 2 for bi-monthly).
                </DynamicResponseField>

                <DynamicResponseField name="resets_at" type="number | null">
                  Timestamp when the balance will next reset.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="price" type="object | null">
              Pricing configuration if this balance has usage-based pricing.

              <Expandable title="properties">
                <DynamicResponseField name="amount" type="number">
                  The per-unit price amount.
                </DynamicResponseField>

                <DynamicResponseField name="tiers" type="object[]">
                  Tiered pricing configuration if applicable.

                  <Expandable title="properties">
                    <DynamicResponseField name="to" type="number" />

                    <DynamicResponseField name="amount" type="number" />

                    <DynamicResponseField name="flat_amount" type="number" />
                  </Expandable>
                </DynamicResponseField>

                <DynamicResponseField name="tier_behavior" type="'graduated' | 'volume'">
                  How tiers are applied: graduated (split across bands) or volume (flat rate for the matched tier).
                </DynamicResponseField>

                <DynamicResponseField name="billing_units" type="number">
                  The number of units per billing increment (eg. \$9 / 250 units).
                </DynamicResponseField>

                <DynamicResponseField name="billing_method" type="'prepaid' | 'usage_based'">
                  Whether usage is prepaid or billed pay-per-use.
                </DynamicResponseField>

                <DynamicResponseField name="max_purchase" type="number | null">
                  Maximum quantity that can be purchased, or null for unlimited.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="expires_at" type="number | null">
              Timestamp when this balance expires, or null for no expiration.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="rollovers" type="object[]">
          Rollover balances carried over from previous periods.

          <Expandable title="properties">
            <DynamicResponseField name="balance" type="number">
              Amount of balance rolled over from a previous period.
            </DynamicResponseField>

            <DynamicResponseField name="expires_at" type="number">
              Timestamp when the rollover balance expires.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="flags.{key}" type="object">
      Boolean feature flags keyed by feature ID, showing enabled access for on/off features.

      <Expandable title="properties">
        <DynamicResponseField name="id" type="string">
          The unique identifier for this flag.
        </DynamicResponseField>

        <DynamicResponseField name="plan_id" type="string | null">
          The plan ID this flag originates from, or null for standalone flags.
        </DynamicResponseField>

        <DynamicResponseField name="expires_at" type="number | null">
          Timestamp when this flag expires, or null for no expiration.
        </DynamicResponseField>

        <DynamicResponseField name="feature_id" type="string">
          The feature ID this flag is for.
        </DynamicResponseField>

        <DynamicResponseField name="feature" type="object">
          The full feature object if expanded.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              The unique identifier for this feature, used in /check and /track calls.
            </DynamicResponseField>

            <DynamicResponseField name="name" type="string">
              Human-readable name displayed in the dashboard and billing UI.
            </DynamicResponseField>

            <DynamicResponseField name="type" type="'boolean' | 'metered' | 'credit_system' | 'ai_credit_system'">
              Feature type: 'boolean' for on/off access, 'metered' for usage-tracked features, 'credit\_system' for unified credit pools, 'ai\_credit\_system' for model-based token pricing.
            </DynamicResponseField>

            <DynamicResponseField name="consumable" type="boolean">
              For metered features: true if usage resets periodically (API calls, credits), false if allocated persistently (seats, storage).
            </DynamicResponseField>

            <DynamicResponseField name="event_names" type="string[]">
              Event names that trigger this feature's balance. Allows multiple features to respond to a single event.
            </DynamicResponseField>

            <DynamicResponseField name="credit_schema" type="object[]">
              For credit\_system features: maps metered features to their credit costs.

              <Expandable title="properties">
                <DynamicResponseField name="metered_feature_id" type="string">
                  ID of the metered feature that draws from this credit system.
                </DynamicResponseField>

                <DynamicResponseField name="credit_cost" type="number">
                  Credits consumed per unit of the metered feature.
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="model_markups.{key}" type="object | null">
              Per-model markup overrides for AI credit systems.

              <Expandable title="properties">
                <DynamicResponseField name="markup" type="number" />

                <DynamicResponseField name="input_cost" type="number" />

                <DynamicResponseField name="output_cost" type="number" />
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="default_markup" type="number">
              Default percentage markup for AI credit systems. Use -100 to make usage free.
            </DynamicResponseField>

            <DynamicResponseField name="provider_markups.{key}" type="object | null">
              Per-provider default markup percentages for AI credit systems.

              <Expandable title="properties">
                <DynamicResponseField name="markup" type="number" />
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="display" type="object">
              Display names for the feature in billing UI and customer-facing components.

              <Expandable title="properties">
                <DynamicResponseField name="singular" type="string | null">
                  Singular form for UI display (e.g., 'API call', 'seat').
                </DynamicResponseField>

                <DynamicResponseField name="plural" type="string | null">
                  Plural form for UI display (e.g., 'API calls', 'seats').
                </DynamicResponseField>
              </Expandable>
            </DynamicResponseField>

            <DynamicResponseField name="archived" type="boolean">
              Whether the feature is archived and hidden from the dashboard.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="config" type="object">
      Configuration for the customer.

      <Expandable title="properties">
        <DynamicResponseField name="disable_pooled_balance" type="boolean">
          Whether to disable the shared customer-level pool for entities.
        </DynamicResponseField>

        <DynamicResponseField name="disable_overage_billing" type="boolean">
          Stops Autumn from posting usage-overage line items to Stripe for this customer. Check/track and balance resets still behave normally. When set, this overrides the organization-level disable\_overage\_billing setting.
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="processors" type="object">
      Payment processors this customer is connected to (Stripe, Vercel, RevenueCat). Omitted entirely when the customer has not been created in any processor.

      <Expandable title="properties">
        <DynamicResponseField name="stripe" type="object">
          Stripe processor connection for the customer.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              Stripe customer ID.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="vercel" type="object">
          Vercel processor connection for the customer (public-safe subset).

          <Expandable title="properties">
            <DynamicResponseField name="installation_id" type="string">
              Vercel marketplace installation ID for this customer.
            </DynamicResponseField>

            <DynamicResponseField name="account_id" type="string">
              Vercel account ID associated with the installation.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="revenuecat" type="object">
          RevenueCat processor connection for the customer.

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string | null">
              Customer's external ID, used as the RevenueCat app user ID. Null if the customer has no external ID set.
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="invoices" type="object[]">
      Invoices for this customer.

      <Expandable title="properties">
        <DynamicResponseField name="plan_ids" type="string[]">
          Array of plan IDs included in this invoice
        </DynamicResponseField>

        <DynamicResponseField name="stripe_id" type="string">
          The Stripe invoice ID
        </DynamicResponseField>

        <DynamicResponseField name="processor_type" type="'stripe' | 'revenuecat'">
          The billing processor that owns this invoice.
        </DynamicResponseField>

        <DynamicResponseField name="status" type="string">
          The status of the invoice
        </DynamicResponseField>

        <DynamicResponseField name="total" type="number">
          The total amount of the invoice
        </DynamicResponseField>

        <DynamicResponseField name="currency" type="string">
          The currency code for the invoice
        </DynamicResponseField>

        <DynamicResponseField name="created_at" type="number">
          Timestamp when the invoice was created
        </DynamicResponseField>

        <DynamicResponseField name="hosted_invoice_url" type="string | null">
          URL to the Stripe-hosted invoice page
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="entities" type="object[]">
      Entities associated with this customer.

      <Expandable title="properties">
        <DynamicResponseField name="id" type="string | null">
          The unique identifier of the entity
        </DynamicResponseField>

        <DynamicResponseField name="name" type="string | null">
          The name of the entity
        </DynamicResponseField>

        <DynamicResponseField name="customer_id" type="string | null">
          The customer ID this entity belongs to
        </DynamicResponseField>

        <DynamicResponseField name="feature_id" type="string | null">
          The feature ID this entity belongs to
        </DynamicResponseField>

        <DynamicResponseField name="created_at" type="number">
          Unix timestamp when the entity was created
        </DynamicResponseField>

        <DynamicResponseField name="env" type="'sandbox' | 'live'">
          The environment (sandbox/live)
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="trials_used" type="object[]">
      Trial usage history for this customer.

      <Expandable title="properties">
        <DynamicResponseField name="plan_id" type="string" />

        <DynamicResponseField name="customer_id" type="string" />

        <DynamicResponseField name="fingerprint" type="string | null" />
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="rewards" type="object | null">
      Rewards earned or applied for this customer.

      <Expandable title="properties">
        <DynamicResponseField name="discounts" type="object[]">
          Array of active discounts applied to the customer

          <Expandable title="properties">
            <DynamicResponseField name="id" type="string">
              The unique identifier for this discount
            </DynamicResponseField>

            <DynamicResponseField name="name" type="string">
              The name of the discount or coupon
            </DynamicResponseField>

            <DynamicResponseField name="type" type="'percentage_discount' | 'fixed_discount' | 'free_product' | 'invoice_credits' | 'feature_grant'">
              The type of reward
            </DynamicResponseField>

            <DynamicResponseField name="discount_value" type="number">
              The discount value (percentage or fixed amount)
            </DynamicResponseField>

            <DynamicResponseField name="duration_type" type="'one_off' | 'months' | 'forever'">
              How long the discount lasts
            </DynamicResponseField>

            <DynamicResponseField name="duration_value" type="number | null">
              Number of billing periods the discount applies for repeating durations
            </DynamicResponseField>

            <DynamicResponseField name="currency" type="string | null">
              The currency code for fixed amount discounts
            </DynamicResponseField>

            <DynamicResponseField name="start" type="number | null">
              Timestamp when the discount becomes active
            </DynamicResponseField>

            <DynamicResponseField name="end" type="number | null">
              Timestamp when the discount expires
            </DynamicResponseField>

            <DynamicResponseField name="subscription_id" type="string | null">
              The Stripe subscription ID this discount is applied to
            </DynamicResponseField>

            <DynamicResponseField name="total_discount_amount" type="number | null">
              Total amount saved from this discount
            </DynamicResponseField>
          </Expandable>
        </DynamicResponseField>
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="referrals" type="object[]">
      Referral records for this customer.

      <Expandable title="properties">
        <DynamicResponseField name="program_id" type="string" />

        <DynamicResponseField name="customer" type="object">
          <Expandable title="properties">
            <DynamicResponseField name="id" type="string" />

            <DynamicResponseField name="name" type="string | null" />

            <DynamicResponseField name="email" type="string | null" />
          </Expandable>
        </DynamicResponseField>

        <DynamicResponseField name="reward_applied" type="boolean" />

        <DynamicResponseField name="created_at" type="number" />
      </Expandable>
    </DynamicResponseField>

    <DynamicResponseField name="payment_method" type="any | null">
      The customer's default payment method.
    </DynamicResponseField>
  </Expandable>
</DynamicResponseField>

<ResponseExample>
  ```json 200 theme={null}
  {
    "customer_id": "cus_123",
    "flashed": [
      {
        "plan_id": "pro",
        "processor": "stripe",
        "customer_product_id": "cus_prod_123",
        "status": "active",
        "skipped": false
      }
    ],
    "customer": {
      "id": "cus_123",
      "name": "Jane Doe",
      "email": "jane@example.com",
      "createdAt": 1771409161016,
      "fingerprint": null,
      "stripeId": "cus_stripe_123",
      "processors": {
        "stripe": {
          "id": "cus_stripe_123"
        }
      },
      "env": "sandbox",
      "metadata": {},
      "sendEmailReceipts": false,
      "billingControls": {
        "autoTopups": []
      },
      "subscriptions": [
        {
          "planId": "pro",
          "autoEnable": false,
          "addOn": false,
          "status": "active",
          "pastDue": false,
          "canceledAt": null,
          "expiresAt": null,
          "trialEndsAt": null,
          "startedAt": 1771431921437,
          "currentPeriodStart": 1771431921437,
          "currentPeriodEnd": 1771999921437,
          "quantity": 1
        }
      ],
      "purchases": [],
      "balances": {
        "messages": {
          "featureId": "messages",
          "granted": 100,
          "remaining": 90,
          "usage": 10,
          "unlimited": false,
          "overageAllowed": false,
          "maxPurchase": null,
          "nextResetAt": 1773851121437,
          "breakdown": [
            {
              "id": "cus_ent_39qmLooixXLAqMywgXywjAz96rV",
              "planId": "pro",
              "includedGrant": 100,
              "prepaidGrant": 0,
              "remaining": 90,
              "usage": 10,
              "unlimited": false,
              "reset": {
                "interval": "month",
                "resetsAt": 1773851121437
              },
              "price": null,
              "expiresAt": null
            }
          ]
        }
      },
      "flags": {},
      "config": {
        "disable_pooled_balance": false,
        "disable_overage_billing": false
      }
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml openapi POST /v1/billing.import
openapi: 3.1.0
info:
  title: Autumn API
  version: 2.3.0
servers:
  - url: https://api.useautumn.com
    description: Production server
security:
  - secretKey: []
paths:
  /v1/billing.import:
    post:
      tags:
        - billing
      summary: Import
      description: >-
        Image a customer into Autumn for live migration. Read-only against
        processors.
      operationId: import
      parameters:
        - name: x-api-version
          in: header
          required: true
          schema:
            type: string
            default: 2.3.0
          x-speakeasy-globals-hidden: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer_id:
                  type: string
                  description: Autumn customer to image into.
                customer_data:
                  type: object
                  properties:
                    name:
                      type: string
                      description: Display name for the customer.
                    email:
                      type: string
                      description: Email address for the customer.
                    fingerprint:
                      type: string
                      description: Anti-fraud fingerprint for the customer.
                  description: Optional identity fields to upsert if the customer is new.
                processors:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        enum:
                          - stripe
                          - revenuecat
                        type: string
                        description: The processor this identity belongs to.
                      id:
                        type: string
                        description: >-
                          The customer's id in that processor (Stripe customer
                          id, or RevenueCat app_user_id).
                    required:
                      - type
                      - id
                  description: >-
                    The customer's processor identities (e.g. Stripe customer
                    id, RevenueCat app_user_id). Omit for customers with no
                    processor, e.g. those only ever on a free plan.
                billables:
                  type: array
                  items:
                    type: object
                    properties:
                      processor:
                        enum:
                          - stripe
                          - revenuecat
                        type: string
                        description: >-
                          The processor that owns this billable (stripe or
                          revenuecat). Omit for plans with no processor, e.g. a
                          free plan.
                      link:
                        type: object
                        properties:
                          subscription_id:
                            type: string
                            description: >-
                              Existing processor subscription id this billable
                              is adopted from.
                          schedule_id:
                            type: string
                            description: >-
                              Existing processor subscription-schedule id this
                              billable is adopted from.
                        description: >-
                          Existing processor billing object this billable is
                          adopted from; omit for paid one-offs.
                      billing_cycle_anchor:
                        type: number
                        description: >-
                          Unix ms billing anchor shared by co-billed plans on
                          this billable.
                      plan:
                        type: object
                        properties:
                          plan_id:
                            type: string
                            description: The Autumn plan to attach to the customer.
                          version:
                            type: number
                            description: >-
                              Specific plan version to attach; defaults to the
                              latest.
                          status:
                            enum:
                              - active
                              - trialing
                              - past_due
                              - canceled
                              - expired
                            type: string
                            description: >-
                              Set the status of the plan to be flashed. Active
                              if undefined.
                          started_at:
                            type: number
                            description: >-
                              When the plan started (Unix ms). Defaults to the
                              linked subscription's start, else the import time.
                              Set this for one-off purchases to record the real
                              purchase date.
                          quantity:
                            type: number
                            description: Seat/unit quantity for the plan.
                          feature_quantities:
                            type: array
                            items:
                              type: object
                              properties:
                                feature_id:
                                  type: string
                                  description: The prepaid feature being quantified.
                                quantity:
                                  type: number
                                  description: Purchased quantity for this prepaid feature.
                              required:
                                - feature_id
                                - quantity
                            description: Purchased prepaid quantities per feature.
                          balances:
                            type: array
                            items:
                              type: object
                              properties:
                                feature_id:
                                  type: string
                                  description: The feature whose balance is being set.
                                filter:
                                  type: object
                                  properties:
                                    interval:
                                      anyOf:
                                        - enum:
                                            - hour
                                            - day
                                            - week
                                            - month
                                            - year
                                          type: string
                                        - type: 'null'
                                      description: >-
                                        Reset interval selecting which
                                        entitlement line to target when a
                                        feature has several (null = the
                                        non-resetting one-off line).
                                    billing_behavior:
                                      enum:
                                        - included
                                        - prepaid
                                      type: string
                                      description: >-
                                        Selects the included vs prepaid
                                        entitlement line when a feature has
                                        both.
                                  description: >-
                                    Disambiguates which entitlement line to
                                    target when the feature has multiple.
                                usage:
                                  type: number
                                  description: >-
                                    Units already consumed; remaining balance is
                                    derived from the plan allowance minus this.
                                balance:
                                  type: number
                                  description: >-
                                    Explicit remaining balance override
                                    (mutually exclusive with usage).
                                next_reset_at:
                                  type: number
                                  description: Unix ms timestamp of this line's next reset.
                              required:
                                - feature_id
                            description: Per-feature balances to image onto the plan.
                        required:
                          - plan_id
                        description: >-
                          The single plan on this billable (provide either plan
                          or phases, not both).
                  description: >-
                    The billing objects (subscriptions, one-offs) to image, each
                    carrying its plan.
                dry_run:
                  type: boolean
                  description: >-
                    If true, validate and compute without persisting; returns
                    what would be flashed.
              required:
                - customer_id
                - billables
              title: DfuFlashParams
              examples:
                - customer_id: cus_123
                  processors:
                    - type: stripe
                      id: cus_stripe_123
                  billables:
                    - processor: stripe
                      link:
                        subscription_id: sub_123
                      plan:
                        plan_id: pro
                        status: active
                        balances:
                          - feature_id: messages
                            usage: 10
            example:
              customer_id: cus_123
              processors:
                - type: stripe
                  id: cus_stripe_123
              billables:
                - processor: stripe
                  link:
                    subscription_id: sub_123
                  plan:
                    plan_id: pro
                    status: active
                    balances:
                      - feature_id: messages
                        usage: 10
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  customer_id:
                    type: string
                    description: The imaged customer's id.
                  flashed:
                    type: array
                    items:
                      type: object
                      properties:
                        plan_id:
                          type: string
                          description: The plan that was imaged.
                        processor:
                          type: string
                          description: The processor that owns the imaged plan.
                        customer_product_id:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: >-
                            The created (or existing) customer product id, if
                            any.
                        status:
                          type: string
                          description: The resulting status of the imaged plan.
                        skipped:
                          type: boolean
                          description: >-
                            True if an active plan already existed and this one
                            was left untouched.
                        expired:
                          type: boolean
                          description: >-
                            True if this was an existing active plan expired
                            because it was absent from the imaged desired state.
                        mismatch:
                          type: boolean
                          description: >-
                            True when the imaged state may be wrong — e.g. a
                            resetting plan with no resolvable billing anchor, or
                            a paid recurring plan with no linked subscription
                            for Autumn to manage. The plan is still imaged; see
                            `reason` and fix by supplying started_at or a
                            subscription_id.
                        reason:
                          type: string
                          description: >-
                            Why the plan was skipped, expired, or flagged as a
                            mismatch, when applicable.
                      required:
                        - plan_id
                        - processor
                        - customer_product_id
                        - status
                        - skipped
                    description: Per-plan outcome of the flash.
                  customer:
                    anyOf:
                      - $ref: '#/components/schemas/Customer'
                      - type: 'null'
                    description: The freshly-read imaged customer; null for dry_run.
                required:
                  - customer_id
                  - flashed
                  - customer
                title: DfuFlashResult
                examples:
                  - customer_id: cus_123
                    flashed:
                      - plan_id: pro
                        processor: stripe
                        customer_product_id: cus_prod_123
                        status: active
                        skipped: false
                    customer:
                      id: cus_123
                      name: Jane Doe
                      email: jane@example.com
                      createdAt: 1771409161016
                      fingerprint: null
                      stripeId: cus_stripe_123
                      processors:
                        stripe:
                          id: cus_stripe_123
                      env: sandbox
                      metadata: {}
                      sendEmailReceipts: false
                      billingControls:
                        autoTopups: []
                      subscriptions:
                        - planId: pro
                          autoEnable: false
                          addOn: false
                          status: active
                          pastDue: false
                          canceledAt: null
                          expiresAt: null
                          trialEndsAt: null
                          startedAt: 1771431921437
                          currentPeriodStart: 1771431921437
                          currentPeriodEnd: 1771999921437
                          quantity: 1
                      purchases: []
                      balances:
                        messages:
                          featureId: messages
                          granted: 100
                          remaining: 90
                          usage: 10
                          unlimited: false
                          overageAllowed: false
                          maxPurchase: null
                          nextResetAt: 1773851121437
                          breakdown:
                            - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV
                              planId: pro
                              includedGrant: 100
                              prepaidGrant: 0
                              remaining: 90
                              usage: 10
                              unlimited: false
                              reset:
                                interval: month
                                resetsAt: 1773851121437
                              price: null
                              expiresAt: null
                      flags: {}
                      config:
                        disable_pooled_balance: false
                        disable_overage_billing: false
              example:
                customer_id: cus_123
                flashed:
                  - plan_id: pro
                    processor: stripe
                    customer_product_id: cus_prod_123
                    status: active
                    skipped: false
                customer:
                  id: cus_123
                  name: Jane Doe
                  email: jane@example.com
                  createdAt: 1771409161016
                  fingerprint: null
                  stripeId: cus_stripe_123
                  processors:
                    stripe:
                      id: cus_stripe_123
                  env: sandbox
                  metadata: {}
                  sendEmailReceipts: false
                  billingControls:
                    autoTopups: []
                  subscriptions:
                    - planId: pro
                      autoEnable: false
                      addOn: false
                      status: active
                      pastDue: false
                      canceledAt: null
                      expiresAt: null
                      trialEndsAt: null
                      startedAt: 1771431921437
                      currentPeriodStart: 1771431921437
                      currentPeriodEnd: 1771999921437
                      quantity: 1
                  purchases: []
                  balances:
                    messages:
                      featureId: messages
                      granted: 100
                      remaining: 90
                      usage: 10
                      unlimited: false
                      overageAllowed: false
                      maxPurchase: null
                      nextResetAt: 1773851121437
                      breakdown:
                        - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV
                          planId: pro
                          includedGrant: 100
                          prepaidGrant: 0
                          remaining: 90
                          usage: 10
                          unlimited: false
                          reset:
                            interval: month
                            resetsAt: 1773851121437
                          price: null
                          expiresAt: null
                  flags: {}
                  config:
                    disable_pooled_balance: false
                    disable_overage_billing: false
      x-codeSamples:
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { Autumn } from 'autumn-js'

            const autumn = new Autumn()

            const result = await autumn.billing.import({
              customerId: "cus_123",
              processors: [
                {
                  type: "stripe",
                  id: "cus_stripe_123",
                },
              ],
              billables: [
                {
                  processor: "stripe",
                  link: {
                    subscriptionId: "sub_123",
                  },
                  plan: {
                    planId: "pro",
                    status: "active",
                    balances: [
                      {
                        featureId: "messages",
                        usage: 10,
                      },
                    ],
                  },
                },
              ],
            });
        - lang: python
          label: Python (SDK)
          source: |-
            from autumn_sdk import Autumn

            autumn = Autumn(secret_key="am_sk_test...")

            res = autumn.billing.import_(
                customer_id="cus_123",
                billables=[
                    {
                        "processor": "stripe",
                        "link": {
                            "subscription_id": "sub_123",
                        },
                        "plan": {
                            "plan_id": "pro",
                            "status": "active",
                            "balances": [
                                {
                                    "feature_id": "messages",
                                    "usage": 10,
                                },
                            ],
                        },
                    },
                ],
                processors=[
                    {
                        "type": "stripe",
                        "id": "cus_stripe_123",
                    },
                ],
            )
components:
  schemas:
    Customer:
      type: object
      properties:
        id:
          anyOf:
            - type: string
            - type: 'null'
          description: Your unique identifier for the customer.
        name:
          anyOf:
            - type: string
            - type: 'null'
          description: The name of the customer.
        email:
          anyOf:
            - type: string
            - type: 'null'
          description: The email address of the customer.
        created_at:
          type: number
          description: Timestamp of customer creation in milliseconds since epoch.
        fingerprint:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            A unique identifier (eg. serial number) to de-duplicate customers
            across devices or browsers. For example: apple device ID.
        stripe_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Stripe customer ID.
        env:
          enum:
            - sandbox
            - live
          type: string
          description: The environment this customer was created in.
        metadata:
          type: object
          propertyNames: {}
          additionalProperties: {}
          description: The metadata for the customer.
        send_email_receipts:
          type: boolean
          description: Whether to send email receipts to the customer.
        billing_controls:
          type: object
          properties:
            auto_topups:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The ID of the feature (credit balance) to auto top-up.
                  enabled:
                    type: boolean
                    default: false
                    description: Whether auto top-up is enabled.
                  threshold:
                    type: number
                    minimum: 0
                    description: >-
                      When the balance drops below this threshold, an auto
                      top-up will be purchased.
                  quantity:
                    type: number
                    minimum: 1
                    description: Amount of credits to add per auto top-up.
                  purchase_limit:
                    anyOf:
                      - type: object
                        properties:
                          interval:
                            enum:
                              - hour
                              - day
                              - week
                              - month
                            type: string
                            description: The time interval for the purchase limit window.
                          interval_count:
                            type: number
                            minimum: 1
                            default: 1
                            description: Number of intervals in the purchase limit window.
                          limit:
                            type: number
                            minimum: 1
                            description: >-
                              Maximum number of auto top-ups allowed within the
                              interval.
                        required:
                          - interval
                          - limit
                      - type: object
                        properties:
                          interval:
                            anyOf:
                              - enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                type: string
                              - type: 'null'
                            description: >-
                              The time interval for the purchase limit window.
                              Null when no purchase limit is configured.
                          interval_count:
                            anyOf:
                              - type: number
                                minimum: 1
                              - type: 'null'
                            description: >-
                              Number of intervals in the purchase limit window.
                              Null when no purchase limit is configured.
                          limit:
                            anyOf:
                              - type: number
                                minimum: 1
                              - type: 'null'
                            description: >-
                              Maximum number of auto top-ups allowed within the
                              interval. Null when no purchase limit is
                              configured.
                          count:
                            type: number
                            description: >-
                              Number of auto top-ups already consumed in the
                              current window.
                          next_reset_at:
                            type: number
                            description: >-
                              Unix ms timestamp when the current purchase window
                              ends and the count resets.
                        required:
                          - interval
                          - interval_count
                          - limit
                          - count
                          - next_reset_at
                    description: >-
                      Optional rate limit to cap how often auto top-ups occur.
                      Expand billing_controls.auto_topups.purchase_limit for a
                      count of top ups and the next_reset_at.
                  invoice_mode:
                    type: boolean
                    description: >-
                      When true, auto top-up creates a send_invoice invoice
                      instead of auto-charging.
                required:
                  - feature_id
                  - threshold
                  - quantity
              description: List of auto top-up configurations per feature.
            spend_limits:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: Optional feature ID this spend limit applies to.
                  enabled:
                    type: boolean
                    default: false
                    description: Whether the overage spend limit is enabled.
                  limit_type:
                    enum:
                      - absolute
                      - usage_percentage
                    type: string
                    description: >-
                      How overage_limit is interpreted: an absolute overage cap
                      (default) or a percentage of the main-plan allowance.
                  overage_limit:
                    type: number
                    minimum: 0
                    description: >-
                      Overage cap for the feature: absolute units, or a percent
                      (e.g. 120) when limit_type is usage_percentage.
              description: List of overage spend limits per feature (caps overage spend).
            usage_limits:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The feature this usage limit applies to.
                  enabled:
                    type: boolean
                    default: true
                    description: Whether this usage limit is enabled.
                  limit:
                    type: number
                    minimum: 0
                    description: Maximum units allowed per interval.
                  interval:
                    enum:
                      - day
                      - week
                      - month
                      - year
                    type: string
                    description: >-
                      Interval for the cap, aligned to the customer's billing
                      cycle.
                  usage:
                    type: number
                    minimum: 0
                    description: >-
                      Current usage already consumed in the active interval.
                      Response-only; not stored on billing controls.
                required:
                  - feature_id
                  - limit
                  - interval
              description: >-
                List of hard usage caps per feature, with current interval
                usage.
            usage_alerts:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The feature ID this alert applies to.
                  enabled:
                    type: boolean
                    default: true
                    description: Whether this usage alert is enabled.
                  threshold:
                    type: number
                    minimum: 0
                    description: >-
                      The threshold value that triggers the alert. For usage or
                      remaining, this is an absolute count. For usage_percentage
                      or remaining_percentage, this is a percentage (0-100).
                  threshold_type:
                    enum:
                      - usage
                      - usage_percentage
                      - remaining
                      - remaining_percentage
                    type: string
                    description: >-
                      Whether the threshold is an absolute count or a percentage
                      of the usage allowance or remaining balance.
                  name:
                    type: string
                    description: >-
                      Optional user-defined label to distinguish multiple alerts
                      on the same feature.
                required:
                  - threshold
                  - threshold_type
              description: List of usage alert configurations per feature.
            overage_allowed:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The feature ID this overage allowed control applies to.
                  enabled:
                    type: boolean
                    default: false
                    description: Whether overage is allowed for this feature.
                required:
                  - feature_id
              description: >-
                List of overage allowed controls per feature. When enabled,
                usage can exceed balance.
          description: Billing controls for the customer (auto top-ups, etc.)
        subscriptions:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: >-
                  The unique identifier of this subscription. If a
                  subscription_id was provided at attach time, it is used;
                  otherwise, falls back to the internal ID.
              plan:
                $ref: '#/components/schemas/Plan'
                description: The full plan object if expanded.
              plan_id:
                type: string
                description: The unique identifier of the subscribed plan.
              auto_enable:
                type: boolean
                description: Whether the plan was automatically enabled for the customer.
              add_on:
                type: boolean
                description: >-
                  Whether this is an add-on plan rather than a base
                  subscription.
              status:
                enum:
                  - active
                  - scheduled
                type: string
                description: Current status of the subscription.
              past_due:
                type: boolean
                description: Whether the subscription has overdue payments.
              canceled_at:
                anyOf:
                  - type: number
                  - type: 'null'
                description: >-
                  Timestamp when the subscription was canceled, or null if not
                  canceled.
              expires_at:
                anyOf:
                  - type: number
                  - type: 'null'
                description: >-
                  Timestamp when the subscription will expire, or null if no
                  expiry set.
              trial_ends_at:
                anyOf:
                  - type: number
                  - type: 'null'
                description: Timestamp when the trial period ends, or null if not on trial.
              started_at:
                type: number
                description: Timestamp when the subscription started.
              current_period_start:
                anyOf:
                  - type: number
                  - type: 'null'
                description: Start timestamp of the current billing period.
              current_period_end:
                anyOf:
                  - type: number
                  - type: 'null'
                description: End timestamp of the current billing period.
              quantity:
                type: number
                description: Number of units of this subscription (for per-seat plans).
              scope:
                enum:
                  - customer
                  - entity
                type: string
                description: >-
                  Whether this subscription is attached at the customer level or
                  entity level.
            required:
              - id
              - plan_id
              - auto_enable
              - add_on
              - status
              - past_due
              - canceled_at
              - expires_at
              - trial_ends_at
              - started_at
              - current_period_start
              - current_period_end
              - quantity
          description: >-
            Active and scheduled recurring plans that this customer has
            attached.
        purchases:
          type: array
          items:
            type: object
            properties:
              plan:
                $ref: '#/components/schemas/Plan'
                description: The full plan object if expanded.
              plan_id:
                type: string
                description: The unique identifier of the purchased plan.
              expires_at:
                anyOf:
                  - type: number
                  - type: 'null'
                description: >-
                  Timestamp when the purchase expires, or null for lifetime
                  access.
              started_at:
                type: number
                description: Timestamp when the purchase was made.
              quantity:
                type: number
                description: Number of units purchased.
              scope:
                enum:
                  - customer
                  - entity
                type: string
                description: >-
                  Whether this purchase is attached at the customer level or
                  entity level.
            required:
              - plan_id
              - expires_at
              - started_at
              - quantity
          description: One-time purchases made by the customer.
        balances:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            $ref: '#/components/schemas/Balance'
          description: >-
            Feature balances keyed by feature ID, showing usage limits and
            remaining amounts.
        flags:
          type: object
          propertyNames:
            type: string
          additionalProperties:
            type: object
            properties:
              id:
                type: string
                description: The unique identifier for this flag.
              plan_id:
                anyOf:
                  - type: string
                  - type: 'null'
                description: >-
                  The plan ID this flag originates from, or null for standalone
                  flags.
              expires_at:
                anyOf:
                  - type: number
                  - type: 'null'
                description: Timestamp when this flag expires, or null for no expiration.
              feature_id:
                type: string
                description: The feature ID this flag is for.
              feature:
                type: object
                properties:
                  id:
                    type: string
                    description: >-
                      The unique identifier for this feature, used in /check and
                      /track calls.
                  name:
                    type: string
                    description: >-
                      Human-readable name displayed in the dashboard and billing
                      UI.
                  type:
                    enum:
                      - boolean
                      - metered
                      - credit_system
                      - ai_credit_system
                    type: string
                    description: >-
                      Feature type: 'boolean' for on/off access, 'metered' for
                      usage-tracked features, 'credit_system' for unified credit
                      pools, 'ai_credit_system' for model-based token pricing.
                  consumable:
                    type: boolean
                    description: >-
                      For metered features: true if usage resets periodically
                      (API calls, credits), false if allocated persistently
                      (seats, storage).
                  event_names:
                    type: array
                    items:
                      type: string
                    description: >-
                      Event names that trigger this feature's balance. Allows
                      multiple features to respond to a single event.
                  credit_schema:
                    type: array
                    items:
                      type: object
                      properties:
                        metered_feature_id:
                          type: string
                          description: >-
                            ID of the metered feature that draws from this
                            credit system.
                        credit_cost:
                          type: number
                          description: Credits consumed per unit of the metered feature.
                      required:
                        - metered_feature_id
                        - credit_cost
                    description: >-
                      For credit_system features: maps metered features to their
                      credit costs.
                  model_markups:
                    anyOf:
                      - type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: object
                          properties:
                            markup:
                              type: number
                              minimum: -100
                            input_cost:
                              type: number
                              minimum: 0
                            output_cost:
                              type: number
                              minimum: 0
                      - type: 'null'
                    description: Per-model markup overrides for AI credit systems.
                  default_markup:
                    type: number
                    minimum: -100
                    description: >-
                      Default percentage markup for AI credit systems. Use -100
                      to make usage free.
                  provider_markups:
                    anyOf:
                      - type: object
                        propertyNames:
                          type: string
                        additionalProperties:
                          type: object
                          properties:
                            markup:
                              type: number
                              minimum: -100
                          required:
                            - markup
                      - type: 'null'
                    description: >-
                      Per-provider default markup percentages for AI credit
                      systems.
                  display:
                    type: object
                    properties:
                      singular:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: >-
                          Singular form for UI display (e.g., 'API call',
                          'seat').
                      plural:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: >-
                          Plural form for UI display (e.g., 'API calls',
                          'seats').
                    description: >-
                      Display names for the feature in billing UI and
                      customer-facing components.
                  archived:
                    type: boolean
                    description: >-
                      Whether the feature is archived and hidden from the
                      dashboard.
                required:
                  - id
                  - name
                  - type
                  - consumable
                  - archived
                description: The full feature object if expanded.
            required:
              - id
              - plan_id
              - expires_at
              - feature_id
            examples:
              - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV
                plan_id: pro_plan
                expires_at: null
                feature_id: dashboard
          description: >-
            Boolean feature flags keyed by feature ID, showing enabled access
            for on/off features.
        config:
          type: object
          properties:
            disable_pooled_balance:
              type: boolean
              description: Whether to disable the shared customer-level pool for entities.
            disable_overage_billing:
              type: boolean
              description: >-
                Stops Autumn from posting usage-overage line items to Stripe for
                this customer. Check/track and balance resets still behave
                normally. When set, this overrides the organization-level
                disable_overage_billing setting.
          description: Configuration for the customer.
        processors:
          type: object
          properties:
            stripe:
              type: object
              properties:
                id:
                  type: string
                  description: Stripe customer ID.
              required:
                - id
              description: Stripe processor connection for the customer.
            vercel:
              type: object
              properties:
                installation_id:
                  type: string
                  description: Vercel marketplace installation ID for this customer.
                account_id:
                  type: string
                  description: Vercel account ID associated with the installation.
              required:
                - installation_id
                - account_id
              description: >-
                Vercel processor connection for the customer (public-safe
                subset).
            revenuecat:
              type: object
              properties:
                id:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: >-
                    Customer's external ID, used as the RevenueCat app user ID.
                    Null if the customer has no external ID set.
              required:
                - id
              description: RevenueCat processor connection for the customer.
          description: >-
            Payment processors this customer is connected to (Stripe, Vercel,
            RevenueCat). Omitted entirely when the customer has not been created
            in any processor.
        invoices:
          type: array
          items:
            type: object
            properties:
              plan_ids:
                type: array
                items:
                  type: string
                description: Array of plan IDs included in this invoice
              stripe_id:
                type: string
                description: The Stripe invoice ID
              processor_type:
                enum:
                  - stripe
                  - revenuecat
                type: string
                default: stripe
                description: The billing processor that owns this invoice.
              status:
                type: string
                description: The status of the invoice
              total:
                type: number
                description: The total amount of the invoice
              currency:
                type: string
                description: The currency code for the invoice
              created_at:
                type: number
                description: Timestamp when the invoice was created
              hosted_invoice_url:
                anyOf:
                  - type: string
                  - type: 'null'
                description: URL to the Stripe-hosted invoice page
            required:
              - plan_ids
              - stripe_id
              - status
              - total
              - currency
              - created_at
          description: Invoices for this customer.
        entities:
          type: array
          items:
            type: object
            properties:
              id:
                anyOf:
                  - type: string
                  - type: 'null'
                description: The unique identifier of the entity
              name:
                anyOf:
                  - type: string
                  - type: 'null'
                description: The name of the entity
              customer_id:
                anyOf:
                  - type: string
                  - type: 'null'
                description: The customer ID this entity belongs to
              feature_id:
                anyOf:
                  - type: string
                  - type: 'null'
                description: The feature ID this entity belongs to
              created_at:
                type: number
                description: Unix timestamp when the entity was created
              env:
                enum:
                  - sandbox
                  - live
                type: string
                description: The environment (sandbox/live)
            required:
              - id
              - name
              - created_at
              - env
          description: Entities associated with this customer.
        trials_used:
          type: array
          items:
            type: object
            properties:
              plan_id:
                type: string
              customer_id:
                type: string
              fingerprint:
                anyOf:
                  - type: string
                  - type: 'null'
            required:
              - plan_id
              - customer_id
          description: Trial usage history for this customer.
        rewards:
          anyOf:
            - type: object
              properties:
                discounts:
                  type: array
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: The unique identifier for this discount
                      name:
                        type: string
                        description: The name of the discount or coupon
                      type:
                        enum:
                          - percentage_discount
                          - fixed_discount
                          - free_product
                          - invoice_credits
                          - feature_grant
                        type: string
                        description: The type of reward
                      discount_value:
                        type: number
                        description: The discount value (percentage or fixed amount)
                      duration_type:
                        enum:
                          - one_off
                          - months
                          - forever
                        type: string
                        description: How long the discount lasts
                      duration_value:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: >-
                          Number of billing periods the discount applies for
                          repeating durations
                      currency:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: The currency code for fixed amount discounts
                      start:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: Timestamp when the discount becomes active
                      end:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: Timestamp when the discount expires
                      subscription_id:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: The Stripe subscription ID this discount is applied to
                      total_discount_amount:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: Total amount saved from this discount
                    required:
                      - id
                      - name
                      - type
                      - discount_value
                      - duration_type
                  description: Array of active discounts applied to the customer
              required:
                - discounts
            - type: 'null'
          description: Rewards earned or applied for this customer.
        referrals:
          type: array
          items:
            type: object
            properties:
              program_id:
                type: string
              customer:
                type: object
                properties:
                  id:
                    type: string
                  name:
                    anyOf:
                      - type: string
                      - type: 'null'
                  email:
                    anyOf:
                      - type: string
                      - type: 'null'
                required:
                  - id
              reward_applied:
                type: boolean
              created_at:
                type: number
            required:
              - program_id
              - customer
              - reward_applied
              - created_at
          description: Referral records for this customer.
        payment_method:
          anyOf:
            - {}
            - type: 'null'
          description: The customer's default payment method.
      required:
        - id
        - name
        - email
        - created_at
        - fingerprint
        - stripe_id
        - env
        - metadata
        - send_email_receipts
        - billing_controls
        - subscriptions
        - purchases
        - balances
        - flags
      examples:
        - id: 2ee25a41-0d81-4ad2-8451-ec1aadaefe58
          name: Patrick
          email: patrick@useautumn.com
          createdAt: 1771409161016
          fingerprint: null
          stripeId: cus_U0BKxpq1mFhuJO
          processors:
            stripe:
              id: cus_U0BKxpq1mFhuJO
          env: sandbox
          metadata: {}
          sendEmailReceipts: false
          billingControls:
            autoTopups: []
          subscriptions:
            - planId: pro_plan
              autoEnable: true
              addOn: false
              status: active
              pastDue: false
              canceledAt: null
              expiresAt: null
              trialEndsAt: null
              startedAt: 1771431921437
              currentPeriodStart: 1771431921437
              currentPeriodEnd: 1771999921437
              quantity: 1
          purchases: []
          balances:
            messages:
              featureId: messages
              granted: 100
              remaining: 0
              usage: 100
              unlimited: false
              overageAllowed: false
              maxPurchase: null
              nextResetAt: 1773851121437
              breakdown:
                - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV
                  planId: pro_plan
                  includedGrant: 100
                  prepaidGrant: 0
                  remaining: 0
                  usage: 100
                  unlimited: false
                  reset:
                    interval: month
                    resetsAt: 1773851121437
                  price: null
                  expiresAt: null
          flags:
            advanced_workflows:
              id: cus_ent_abc123
              plan_id: pro_plan
              expires_at: null
              feature_id: advanced_workflows
          config:
            disable_pooled_balance: false
            disable_overage_billing: false
    Plan:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the plan.
        name:
          type: string
          description: Display name of the plan.
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: Optional description of the plan.
        group:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Group identifier for organizing related plans. Plans in the same
            group are mutually exclusive.
        version:
          type: number
          description: >-
            Version number of the plan. Incremented when plan configuration
            changes.
        add_on:
          type: boolean
          description: >-
            Whether this is an add-on plan that can be attached alongside a main
            plan.
        auto_enable:
          type: boolean
          description: >-
            If true, this plan is automatically attached when a customer is
            created. Used for free plans.
        price:
          anyOf:
            - type: object
              properties:
                amount:
                  type: number
                  description: Base price amount for the plan.
                interval:
                  enum:
                    - one_off
                    - week
                    - month
                    - quarter
                    - semi_annual
                    - year
                  type: string
                  description: Billing interval (e.g. 'month', 'year').
                interval_count:
                  type: number
                  description: Number of intervals per billing cycle. Defaults to 1.
                display:
                  type: object
                  properties:
                    primary_text:
                      type: string
                      description: Main display text (e.g. '$10' or '100 messages').
                    secondary_text:
                      type: string
                      description: >-
                        Secondary display text (e.g. 'per month' or 'then $0.5
                        per 100').
                  required:
                    - primary_text
                  description: Display text for showing this price in pricing pages.
              required:
                - amount
                - interval
            - type: 'null'
          description: >-
            Base recurring price for the plan. Null for free plans or usage-only
            plans.
        items:
          type: array
          items:
            type: object
            properties:
              feature_id:
                type: string
                description: The ID of the feature this item configures.
              feature:
                type: object
                properties:
                  id:
                    type: string
                    description: >-
                      The ID of the feature, used to refer to it in other API
                      calls like /track or /check.
                  name:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: The name of the feature.
                  type:
                    enum:
                      - static
                      - boolean
                      - single_use
                      - continuous_use
                      - credit_system
                      - ai_credit_system
                    type: string
                    description: The type of the feature
                  display:
                    anyOf:
                      - type: object
                        properties:
                          singular:
                            type: string
                            description: The singular display name for the feature.
                          plural:
                            type: string
                            description: The plural display name for the feature.
                        required:
                          - singular
                          - plural
                      - type: 'null'
                    description: Singular and plural display names for the feature.
                  credit_schema:
                    anyOf:
                      - type: array
                        items:
                          type: object
                          properties:
                            metered_feature_id:
                              type: string
                              description: >-
                                The ID of the metered feature (should be a
                                single_use feature).
                            credit_cost:
                              type: number
                              description: The credit cost of the metered feature.
                          required:
                            - metered_feature_id
                            - credit_cost
                      - type: 'null'
                    description: Credit cost schema for credit system features.
                  archived:
                    anyOf:
                      - type: boolean
                      - type: 'null'
                    description: Whether or not the feature is archived.
                required:
                  - id
                  - type
                description: The full feature object if expanded.
              included:
                type: number
                description: >-
                  Number of free units included. For consumable features,
                  balance resets to this number each interval.
              unlimited:
                type: boolean
                description: Whether the customer has unlimited access to this feature.
              reset:
                anyOf:
                  - type: object
                    properties:
                      interval:
                        enum:
                          - one_off
                          - minute
                          - hour
                          - day
                          - week
                          - month
                          - quarter
                          - semi_annual
                          - year
                        type: string
                        description: >-
                          The interval at which the feature balance resets (e.g.
                          'month', 'year'). For consumable features, usage
                          resets to 0 and included units are restored.
                      interval_count:
                        type: number
                        description: Number of intervals between resets. Defaults to 1.
                    required:
                      - interval
                  - type: 'null'
                description: >-
                  Reset configuration for consumable features. Null for
                  non-consumable features like seats where usage persists across
                  billing cycles.
              price:
                anyOf:
                  - type: object
                    properties:
                      amount:
                        type: number
                        description: >-
                          Price per billing_units after included usage is
                          consumed. Mutually exclusive with tiers.
                      tiers:
                        type: array
                        items:
                          type: object
                          properties:
                            to:
                              anyOf:
                                - type: number
                                - const: inf
                            amount:
                              type: number
                            flat_amount:
                              type: number
                          required:
                            - to
                            - amount
                        description: >-
                          Tiered pricing configuration. Each tier's 'to'
                          INCLUDES the included amount. Either 'tiers' or
                          'amount' is required.
                      tier_behavior:
                        enum:
                          - graduated
                          - volume
                        type: string
                      interval:
                        enum:
                          - one_off
                          - week
                          - month
                          - quarter
                          - semi_annual
                          - year
                        type: string
                        description: >-
                          Billing interval for this price. For consumable
                          features, should match reset.interval.
                      interval_count:
                        type: number
                        description: Number of intervals per billing cycle. Defaults to 1.
                      billing_units:
                        type: number
                        description: >-
                          Number of units per price increment. Usage is rounded
                          UP to the nearest billing_units when billed (e.g.
                          billing_units=100 means 101 usage rounds to 200).
                      billing_method:
                        enum:
                          - prepaid
                          - usage_based
                        type: string
                        description: >-
                          'prepaid' for features like seats where customers pay
                          upfront, 'usage_based' for pay-as-you-go after
                          included usage.
                      max_purchase:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: >-
                          Maximum units a customer can purchase beyond included.
                          E.g. if included=100 and max_purchase=300, customer
                          can use up to 400 total before usage is capped. Null
                          for no limit.
                    required:
                      - interval
                      - billing_units
                      - billing_method
                      - max_purchase
                  - type: 'null'
                description: >-
                  Pricing configuration for usage beyond included units. Null if
                  feature is entirely free.
              display:
                type: object
                properties:
                  primary_text:
                    type: string
                    description: Main display text (e.g. '$10' or '100 messages').
                  secondary_text:
                    type: string
                    description: >-
                      Secondary display text (e.g. 'per month' or 'then $0.5 per
                      100').
                required:
                  - primary_text
                description: Display text for showing this item in pricing pages.
              rollover:
                type: object
                properties:
                  max:
                    anyOf:
                      - type: number
                      - type: 'null'
                    description: Maximum rollover units. Null for unlimited rollover.
                  max_percentage:
                    anyOf:
                      - type: number
                      - type: 'null'
                    description: >-
                      Maximum rollover as a percentage (0-100) of included +
                      prepaid grant. Mutually exclusive with max.
                  expiry_duration_type:
                    enum:
                      - month
                      - forever
                    type: string
                    description: When rolled over units expire.
                  expiry_duration_length:
                    type: number
                    description: Number of periods before expiry.
                required:
                  - max
                  - expiry_duration_type
                description: >-
                  Rollover configuration for unused units. If set, unused
                  included units roll over to the next period.
            required:
              - feature_id
              - included
              - unlimited
              - reset
              - price
          description: >-
            Feature configurations included in this plan. Each item defines
            included units, pricing, and reset behavior for a feature.
        free_trial:
          type: object
          properties:
            duration_length:
              type: number
              description: Number of duration_type periods the trial lasts.
            duration_type:
              enum:
                - day
                - month
                - year
              type: string
              description: Unit of time for the trial duration ('day', 'month', 'year').
            card_required:
              type: boolean
              description: >-
                Whether a payment method is required to start the trial. If
                true, customer will be charged after trial ends.
            on_end:
              anyOf:
                - enum:
                    - bill
                    - revert
                  type: string
                - type: 'null'
              description: >-
                Behavior when the trial ends. 'bill' charges the customer
                (default). 'revert' expires the trial and restores the
                customer's previous plan.
          required:
            - duration_length
            - duration_type
            - card_required
          description: >-
            Free trial configuration. If set, new customers can try this plan
            before being charged.
        created_at:
          type: number
          description: Unix timestamp (ms) when the plan was created.
        env:
          enum:
            - sandbox
            - live
          type: string
          description: Environment this plan belongs to ('sandbox' or 'live').
        archived:
          type: boolean
          description: >-
            Whether the plan is archived. Archived plans cannot be attached to
            new customers.
        base_variant_id:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            Deprecated. Use variant_details.base_plan_id instead. If this is a
            variant, the ID of the base plan it was created from.
        variant_details:
          type: object
          properties:
            base_plan_id:
              type: string
              description: The ID of the base plan this variant was derived from.
            customize:
              type: object
              properties:
                price:
                  anyOf:
                    - type: object
                      properties:
                        amount:
                          type: number
                          description: Base price amount for the plan.
                        interval:
                          enum:
                            - one_off
                            - week
                            - month
                            - quarter
                            - semi_annual
                            - year
                          type: string
                          description: Billing interval (e.g. 'month', 'year').
                        interval_count:
                          type: number
                          description: >-
                            Number of intervals per billing cycle. Defaults to
                            1.
                      required:
                        - amount
                        - interval
                      title: BasePrice
                      description: Base price configuration for a plan.
                    - type: 'null'
                  description: >-
                    Override the base price of the plan. Pass null to remove the
                    base price.
                add_items:
                  type: array
                  items:
                    type: object
                    properties:
                      feature_id:
                        type: string
                        description: The ID of the feature to configure.
                      included:
                        type: number
                        description: >-
                          Number of free units included. Balance resets to this
                          each interval for consumable features.
                      unlimited:
                        type: boolean
                        description: >-
                          If true, customer has unlimited access to this
                          feature.
                      reset:
                        type: object
                        properties:
                          interval:
                            enum:
                              - one_off
                              - minute
                              - hour
                              - day
                              - week
                              - month
                              - quarter
                              - semi_annual
                              - year
                            type: string
                            description: >-
                              Interval at which balance resets (e.g. 'month',
                              'year'). For consumable features only.
                          interval_count:
                            type: number
                            description: Number of intervals between resets. Defaults to 1.
                        required:
                          - interval
                        description: >-
                          Reset configuration for consumable features. Omit for
                          non-consumable features like seats.
                      price:
                        type: object
                        properties:
                          amount:
                            type: number
                            description: >-
                              Price per billing_units after included usage.
                              Either 'amount' or 'tiers' is required.
                          tiers:
                            type: array
                            items:
                              type: object
                              properties:
                                to:
                                  anyOf:
                                    - type: number
                                    - const: inf
                                amount:
                                  type: number
                                flat_amount:
                                  type: number
                              required:
                                - to
                                - amount
                            description: >-
                              Tiered pricing.  Either 'amount' or 'tiers' is
                              required.
                          tier_behavior:
                            enum:
                              - graduated
                              - volume
                            type: string
                          interval:
                            enum:
                              - one_off
                              - week
                              - month
                              - quarter
                              - semi_annual
                              - year
                            type: string
                            description: >-
                              Billing interval. For consumable features, should
                              match reset.interval.
                          interval_count:
                            type: number
                            default: 1
                            description: >-
                              Number of intervals per billing cycle. Defaults to
                              1.
                          billing_units:
                            type: number
                            default: 1
                            description: >-
                              Units per price increment. Usage is rounded UP
                              when billed (e.g. billing_units=100 means 101
                              rounds to 200).
                          billing_method:
                            enum:
                              - prepaid
                              - usage_based
                            type: string
                            description: >-
                              'prepaid' for upfront payment (seats),
                              'usage_based' for pay-as-you-go.
                          max_purchase:
                            anyOf:
                              - type: number
                              - type: 'null'
                            description: >-
                              Max units purchasable beyond included. E.g.
                              included=100, max_purchase=300 allows 400 total.
                              Null for no limit.
                        required:
                          - interval
                          - billing_method
                        description: >-
                          Pricing for usage beyond included units. Omit for free
                          features.
                      proration:
                        type: object
                        properties:
                          on_increase:
                            enum:
                              - bill_immediately
                              - prorate_immediately
                              - prorate_next_cycle
                              - bill_next_cycle
                            type: string
                            description: >-
                              Billing behavior when quantity increases
                              mid-cycle.
                          on_decrease:
                            enum:
                              - prorate
                              - prorate_immediately
                              - prorate_next_cycle
                              - none
                              - no_prorations
                            type: string
                            description: Credit behavior when quantity decreases mid-cycle.
                        required:
                          - on_increase
                          - on_decrease
                        description: >-
                          Proration settings for prepaid features. Controls
                          mid-cycle quantity change billing.
                      rollover:
                        type: object
                        properties:
                          max:
                            type: number
                            description: Max rollover units. Omit for unlimited rollover.
                          max_percentage:
                            type: number
                            description: >-
                              Maximum rollover as a percentage (0-100) of
                              included + prepaid grant. Mutually exclusive with
                              max.
                          expiry_duration_type:
                            enum:
                              - month
                              - forever
                            type: string
                            description: When rolled over units expire.
                          expiry_duration_length:
                            type: number
                            description: Number of periods before expiry.
                        required:
                          - expiry_duration_type
                        description: >-
                          Rollover config for unused units. If set, unused
                          included units carry over.
                    required:
                      - feature_id
                    title: PlanItem
                    description: >-
                      Configuration for a feature item in a plan, including
                      usage limits, pricing, and rollover settings.
                  description: Items to add to the plan.
                remove_items:
                  type: array
                  items:
                    type: object
                    properties:
                      feature_id:
                        type: string
                        description: Match items linked to this feature.
                      billing_method:
                        enum:
                          - prepaid
                          - usage_based
                        type: string
                        description: >-
                          Match items with this billing method (prepaid or
                          usage_based).
                      interval:
                        anyOf:
                          - enum:
                              - one_off
                              - week
                              - month
                              - quarter
                              - semi_annual
                              - year
                            type: string
                          - enum:
                              - one_off
                              - minute
                              - hour
                              - day
                              - week
                              - month
                              - quarter
                              - semi_annual
                              - year
                            type: string
                        description: >-
                          Match items with this interval. Accepts either a
                          BillingInterval (price-side) or a ResetInterval
                          (reset-side, includes day/hour/minute) so price-less
                          items keyed by reset.interval can be disambiguated.
                      interval_count:
                        type: integer
                        minimum: -9007199254740991
                        maximum: 9007199254740991
                        exclusiveMinimum: 0
                        description: >-
                          Match items with this interval_count. Disambiguates
                          between items that share an interval but differ in
                          count.
                    title: PlanItemFilter
                    description: >-
                      Filter for matching plan items. All provided fields must
                      match (AND).
                  description: Filters selecting items to remove from the plan.
                free_trial:
                  anyOf:
                    - type: object
                      properties:
                        duration_length:
                          type: number
                          description: Number of duration_type periods the trial lasts.
                        duration_type:
                          enum:
                            - day
                            - month
                            - year
                          type: string
                          default: month
                          description: Unit of time for the trial ('day', 'month', 'year').
                        card_required:
                          type: boolean
                          default: true
                          description: >-
                            If true, payment method required to start trial.
                            Customer is charged after trial ends.
                        on_end:
                          enum:
                            - bill
                            - revert
                          type: string
                          description: >-
                            Behavior when the trial ends. 'bill' charges the
                            customer (default). 'revert' expires the trial and
                            restores the customer's previous plan.
                      required:
                        - duration_length
                      title: FreeTrialParams
                      description: Free trial configuration for a plan.
                    - type: 'null'
                  description: >-
                    Override the plan's default free trial. Pass an object to
                    set a custom trial, or null to remove the trial entirely.
                billing_controls:
                  type: object
                  properties:
                    auto_topups:
                      type: array
                      items:
                        type: object
                        properties:
                          feature_id:
                            type: string
                            description: >-
                              The ID of the feature (credit balance) to auto
                              top-up.
                          enabled:
                            type: boolean
                            default: false
                            description: Whether auto top-up is enabled.
                          threshold:
                            type: number
                            minimum: 0
                            description: >-
                              When the balance drops below this threshold, an
                              auto top-up will be purchased.
                          quantity:
                            type: number
                            minimum: 1
                            description: Amount of credits to add per auto top-up.
                          purchase_limit:
                            type: object
                            properties:
                              interval:
                                enum:
                                  - hour
                                  - day
                                  - week
                                  - month
                                type: string
                                description: >-
                                  The time interval for the purchase limit
                                  window.
                              interval_count:
                                type: number
                                minimum: 1
                                default: 1
                                description: >-
                                  Number of intervals in the purchase limit
                                  window.
                              limit:
                                type: number
                                minimum: 1
                                description: >-
                                  Maximum number of auto top-ups allowed within
                                  the interval.
                            required:
                              - interval
                              - limit
                            description: >-
                              Optional rate limit to cap how often auto top-ups
                              occur.
                          invoice_mode:
                            type: boolean
                            description: >-
                              When true, auto top-up creates a send_invoice
                              invoice instead of auto-charging.
                        required:
                          - feature_id
                          - threshold
                          - quantity
                      description: List of auto top-up configurations per feature.
                    spend_limits:
                      type: array
                      items:
                        type: object
                        properties:
                          feature_id:
                            type: string
                            description: Optional feature ID this spend limit applies to.
                          enabled:
                            type: boolean
                            default: false
                            description: Whether the overage spend limit is enabled.
                          limit_type:
                            enum:
                              - absolute
                              - usage_percentage
                            type: string
                            description: >-
                              How overage_limit is interpreted: an absolute
                              overage cap (default) or a percentage of the
                              main-plan allowance.
                          overage_limit:
                            type: number
                            minimum: 0
                            description: >-
                              Overage cap for the feature: absolute units, or a
                              percent (e.g. 120) when limit_type is
                              usage_percentage.
                      description: >-
                        List of overage spend limits per feature (caps overage
                        spend).
                    usage_limits:
                      type: array
                      items:
                        type: object
                        properties:
                          feature_id:
                            type: string
                            description: The feature this usage limit applies to.
                          enabled:
                            type: boolean
                            default: true
                            description: Whether this usage limit is enabled.
                          limit:
                            type: number
                            minimum: 0
                            description: Maximum units allowed per interval.
                          interval:
                            enum:
                              - day
                              - week
                              - month
                              - year
                            type: string
                            description: >-
                              Interval for the cap, aligned to the customer's
                              billing cycle.
                        required:
                          - feature_id
                          - limit
                          - interval
                      description: >-
                        List of hard usage caps per feature (max units per
                        interval).
                    usage_alerts:
                      type: array
                      items:
                        type: object
                        properties:
                          feature_id:
                            type: string
                            description: The feature ID this alert applies to.
                          enabled:
                            type: boolean
                            default: true
                            description: Whether this usage alert is enabled.
                          threshold:
                            type: number
                            minimum: 0
                            description: >-
                              The threshold value that triggers the alert. For
                              usage or remaining, this is an absolute count. For
                              usage_percentage or remaining_percentage, this is
                              a percentage (0-100).
                          threshold_type:
                            enum:
                              - usage
                              - usage_percentage
                              - remaining
                              - remaining_percentage
                            type: string
                            description: >-
                              Whether the threshold is an absolute count or a
                              percentage of the usage allowance or remaining
                              balance.
                          name:
                            type: string
                            description: >-
                              Optional user-defined label to distinguish
                              multiple alerts on the same feature.
                        required:
                          - threshold
                          - threshold_type
                      description: List of usage alert configurations per feature.
                    overage_allowed:
                      type: array
                      items:
                        type: object
                        properties:
                          feature_id:
                            type: string
                            description: >-
                              The feature ID this overage allowed control
                              applies to.
                          enabled:
                            type: boolean
                            default: false
                            description: Whether overage is allowed for this feature.
                        required:
                          - feature_id
                      description: >-
                        List of overage allowed controls per feature. When
                        enabled, usage can exceed balance.
                  description: >-
                    Override the plan's billing controls (auto top-ups, spend
                    limits, usage limits, usage alerts, overage allowed) for
                    this customer.
              description: >-
                The customization that transforms the base plan into this
                variant.
          required:
            - base_plan_id
          description: Details about how this variant relates to its latest base plan.
        config:
          type: object
          properties:
            ignore_past_due:
              type: boolean
              default: false
              description: >-
                If true, entitlements attached to this plan will still reset on
                schedule even when the customer's product is in a past_due
                state.
          description: Miscellaneous plan-level configuration flags.
        billing_controls:
          type: object
          properties:
            auto_topups:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The ID of the feature (credit balance) to auto top-up.
                  enabled:
                    type: boolean
                    default: false
                    description: Whether auto top-up is enabled.
                  threshold:
                    type: number
                    minimum: 0
                    description: >-
                      When the balance drops below this threshold, an auto
                      top-up will be purchased.
                  quantity:
                    type: number
                    minimum: 1
                    description: Amount of credits to add per auto top-up.
                  purchase_limit:
                    type: object
                    properties:
                      interval:
                        enum:
                          - hour
                          - day
                          - week
                          - month
                        type: string
                        description: The time interval for the purchase limit window.
                      interval_count:
                        type: number
                        minimum: 1
                        default: 1
                        description: Number of intervals in the purchase limit window.
                      limit:
                        type: number
                        minimum: 1
                        description: >-
                          Maximum number of auto top-ups allowed within the
                          interval.
                    required:
                      - interval
                      - limit
                    description: Optional rate limit to cap how often auto top-ups occur.
                  invoice_mode:
                    type: boolean
                    description: >-
                      When true, auto top-up creates a send_invoice invoice
                      instead of auto-charging.
                required:
                  - feature_id
                  - threshold
                  - quantity
              description: List of auto top-up configurations per feature.
            spend_limits:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: Optional feature ID this spend limit applies to.
                  enabled:
                    type: boolean
                    default: false
                    description: Whether the overage spend limit is enabled.
                  limit_type:
                    enum:
                      - absolute
                      - usage_percentage
                    type: string
                    description: >-
                      How overage_limit is interpreted: an absolute overage cap
                      (default) or a percentage of the main-plan allowance.
                  overage_limit:
                    type: number
                    minimum: 0
                    description: >-
                      Overage cap for the feature: absolute units, or a percent
                      (e.g. 120) when limit_type is usage_percentage.
              description: List of overage spend limits per feature (caps overage spend).
            usage_limits:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The feature this usage limit applies to.
                  enabled:
                    type: boolean
                    default: true
                    description: Whether this usage limit is enabled.
                  limit:
                    type: number
                    minimum: 0
                    description: Maximum units allowed per interval.
                  interval:
                    enum:
                      - day
                      - week
                      - month
                      - year
                    type: string
                    description: >-
                      Interval for the cap, aligned to the customer's billing
                      cycle.
                required:
                  - feature_id
                  - limit
                  - interval
              description: List of hard usage caps per feature (max units per interval).
            usage_alerts:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The feature ID this alert applies to.
                  enabled:
                    type: boolean
                    default: true
                    description: Whether this usage alert is enabled.
                  threshold:
                    type: number
                    minimum: 0
                    description: >-
                      The threshold value that triggers the alert. For usage or
                      remaining, this is an absolute count. For usage_percentage
                      or remaining_percentage, this is a percentage (0-100).
                  threshold_type:
                    enum:
                      - usage
                      - usage_percentage
                      - remaining
                      - remaining_percentage
                    type: string
                    description: >-
                      Whether the threshold is an absolute count or a percentage
                      of the usage allowance or remaining balance.
                  name:
                    type: string
                    description: >-
                      Optional user-defined label to distinguish multiple alerts
                      on the same feature.
                required:
                  - threshold
                  - threshold_type
              description: List of usage alert configurations per feature.
            overage_allowed:
              type: array
              items:
                type: object
                properties:
                  feature_id:
                    type: string
                    description: The feature ID this overage allowed control applies to.
                  enabled:
                    type: boolean
                    default: false
                    description: Whether overage is allowed for this feature.
                required:
                  - feature_id
              description: >-
                List of overage allowed controls per feature. When enabled,
                usage can exceed balance.
          description: Plan-level billing controls used as customer defaults.
        metadata:
          type: object
          propertyNames:
            type: string
          additionalProperties: {}
          description: >-
            Arbitrary key-value metadata defined by you for your own use. Shared
            across all versions of the plan.
        customer_eligibility:
          type: object
          properties:
            trial_available:
              type: boolean
              description: >-
                Whether the trial on this plan is available to this customer.
                For example, if the customer used the trial in the past, this
                will be false.
            status:
              enum:
                - active
                - scheduled
              type: string
              description: >-
                The customer's current status with this plan. 'active' if
                attached, 'scheduled' if pending activation.
            canceling:
              type: boolean
              description: >-
                Whether the customer's active instance of this plan is set to
                cancel.
            trialing:
              type: boolean
              description: Whether the customer is currently on a free trial of this plan.
            attach_action:
              enum:
                - activate
                - upgrade
                - downgrade
                - none
                - purchase
              type: string
              description: >-
                The action that would occur if this plan were attached to the
                customer.
          required:
            - attach_action
      required:
        - id
        - name
        - description
        - group
        - version
        - add_on
        - auto_enable
        - price
        - items
        - created_at
        - env
        - archived
        - base_variant_id
        - config
        - metadata
    Balance:
      type: object
      properties:
        feature_id:
          type: string
          description: The feature ID this balance is for.
        feature:
          type: object
          properties:
            id:
              type: string
              description: >-
                The unique identifier for this feature, used in /check and
                /track calls.
            name:
              type: string
              description: Human-readable name displayed in the dashboard and billing UI.
            type:
              enum:
                - boolean
                - metered
                - credit_system
                - ai_credit_system
              type: string
              description: >-
                Feature type: 'boolean' for on/off access, 'metered' for
                usage-tracked features, 'credit_system' for unified credit
                pools, 'ai_credit_system' for model-based token pricing.
            consumable:
              type: boolean
              description: >-
                For metered features: true if usage resets periodically (API
                calls, credits), false if allocated persistently (seats,
                storage).
            event_names:
              type: array
              items:
                type: string
              description: >-
                Event names that trigger this feature's balance. Allows multiple
                features to respond to a single event.
            credit_schema:
              type: array
              items:
                type: object
                properties:
                  metered_feature_id:
                    type: string
                    description: >-
                      ID of the metered feature that draws from this credit
                      system.
                  credit_cost:
                    type: number
                    description: Credits consumed per unit of the metered feature.
                required:
                  - metered_feature_id
                  - credit_cost
              description: >-
                For credit_system features: maps metered features to their
                credit costs.
            model_markups:
              anyOf:
                - type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: object
                    properties:
                      markup:
                        type: number
                        minimum: -100
                      input_cost:
                        type: number
                        minimum: 0
                      output_cost:
                        type: number
                        minimum: 0
                - type: 'null'
              description: Per-model markup overrides for AI credit systems.
            default_markup:
              type: number
              minimum: -100
              description: >-
                Default percentage markup for AI credit systems. Use -100 to
                make usage free.
            provider_markups:
              anyOf:
                - type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: object
                    properties:
                      markup:
                        type: number
                        minimum: -100
                    required:
                      - markup
                - type: 'null'
              description: Per-provider default markup percentages for AI credit systems.
            display:
              type: object
              properties:
                singular:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: Singular form for UI display (e.g., 'API call', 'seat').
                plural:
                  anyOf:
                    - type: string
                    - type: 'null'
                  description: Plural form for UI display (e.g., 'API calls', 'seats').
              description: >-
                Display names for the feature in billing UI and customer-facing
                components.
            archived:
              type: boolean
              description: Whether the feature is archived and hidden from the dashboard.
          required:
            - id
            - name
            - type
            - consumable
            - archived
          description: The full feature object if expanded.
        granted:
          type: number
          description: Total balance granted (included + prepaid).
        remaining:
          type: number
          minimum: 0
          description: Remaining balance available for use.
        usage:
          type: number
          description: Total usage consumed in the current period.
        unlimited:
          type: boolean
          description: Whether this feature has unlimited usage.
        overage_allowed:
          type: boolean
          description: >-
            Whether usage beyond the granted balance is allowed (with overage
            charges).
        max_purchase:
          anyOf:
            - type: number
            - type: 'null'
          description: >-
            Maximum quantity that can be purchased as a top-up, or null for
            unlimited.
        next_reset_at:
          anyOf:
            - type: number
            - type: 'null'
          description: Timestamp when the balance will reset, or null for no reset.
        breakdown:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                default: ''
                description: The unique identifier for this balance breakdown.
              plan_id:
                anyOf:
                  - type: string
                  - type: 'null'
                description: >-
                  The plan ID this balance originates from, or null for
                  standalone balances.
              included_grant:
                type: number
                description: Amount granted from the plan's included usage.
              prepaid_grant:
                type: number
                description: Amount granted from prepaid purchases or top-ups.
              remaining:
                type: number
                description: Remaining balance available for use.
              usage:
                type: number
                description: Amount consumed in the current period.
              unlimited:
                type: boolean
                description: Whether this balance has unlimited usage.
              reset:
                anyOf:
                  - type: object
                    properties:
                      interval:
                        anyOf:
                          - enum:
                              - one_off
                              - minute
                              - hour
                              - day
                              - week
                              - month
                              - quarter
                              - semi_annual
                              - year
                            type: string
                          - const: multiple
                        description: >-
                          The reset interval (hour, day, week, month, etc.) or
                          'multiple' if combined from different intervals.
                      interval_count:
                        type: number
                        description: >-
                          Number of intervals between resets (eg. 2 for
                          bi-monthly).
                      resets_at:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: Timestamp when the balance will next reset.
                    required:
                      - interval
                      - resets_at
                  - type: 'null'
                description: Reset configuration for this balance, or null if no reset.
              price:
                anyOf:
                  - type: object
                    properties:
                      amount:
                        type: number
                        description: The per-unit price amount.
                      tiers:
                        type: array
                        items:
                          type: object
                          properties:
                            to:
                              anyOf:
                                - type: number
                                - const: inf
                            amount:
                              type: number
                            flat_amount:
                              type: number
                          required:
                            - to
                            - amount
                        description: Tiered pricing configuration if applicable.
                      tier_behavior:
                        enum:
                          - graduated
                          - volume
                        type: string
                        description: >-
                          How tiers are applied: graduated (split across bands)
                          or volume (flat rate for the matched tier).
                      billing_units:
                        type: number
                        description: >-
                          The number of units per billing increment (eg. $9 /
                          250 units).
                      billing_method:
                        enum:
                          - prepaid
                          - usage_based
                        type: string
                        description: Whether usage is prepaid or billed pay-per-use.
                      max_purchase:
                        anyOf:
                          - type: number
                          - type: 'null'
                        description: >-
                          Maximum quantity that can be purchased, or null for
                          unlimited.
                    required:
                      - billing_units
                      - billing_method
                      - max_purchase
                  - type: 'null'
                description: Pricing configuration if this balance has usage-based pricing.
              expires_at:
                anyOf:
                  - type: number
                  - type: 'null'
                description: >-
                  Timestamp when this balance expires, or null for no
                  expiration.
            required:
              - plan_id
              - included_grant
              - prepaid_grant
              - remaining
              - usage
              - unlimited
              - reset
              - price
              - expires_at
          description: >-
            Detailed breakdown of balance sources when stacking multiple plans
            or grants.
        rollovers:
          type: array
          items:
            type: object
            properties:
              balance:
                type: number
                description: Amount of balance rolled over from a previous period.
              expires_at:
                type: number
                description: Timestamp when the rollover balance expires.
            required:
              - balance
              - expires_at
          description: Rollover balances carried over from previous periods.
      required:
        - feature_id
        - granted
        - remaining
        - usage
        - unlimited
        - overage_allowed
        - max_purchase
        - next_reset_at
      examples:
        - feature_id: messages
          granted: 100
          remaining: 72
          usage: 28
          unlimited: false
          overage_allowed: false
          max_purchase: null
          next_reset_at: 1773851121437
          breakdown:
            - id: cus_ent_39qmLooixXLAqMywgXywjAz96rV
              plan_id: pro_plan
              included_grant: 100
              prepaid_grant: 0
              remaining: 72
              usage: 28
              unlimited: false
              reset:
                interval: month
                resets_at: 1773851121437
              price: null
              expires_at: null
  securitySchemes:
    secretKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````