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

# subscription.group_spend.threshold_reached

> Fired when a feature group's total metered spend on a subscription crosses an alert threshold (critical, warning, or info) for the current billing period. Doc-only for parsing.



## OpenAPI

````yaml /api-reference/openapi.json post /webhook-events/subscription.group_spend.threshold_reached
openapi: 3.0.1
info:
  title: Tirdad API
  description: Tirdad API Service
  contact:
    name: API Support
  version: '1.0'
servers:
  - url: https://api.tirdad.ai/v1
    description: Tirdad API
security: []
paths:
  /webhook-events/subscription.group_spend.threshold_reached:
    post:
      tags:
        - Webhook Events
      summary: subscription.group_spend.threshold_reached
      description: >-
        Fired when a feature group's total metered spend on a subscription
        crosses an alert threshold (critical, warning, or info) for the current
        billing period. Doc-only for parsing.
      responses:
        '200':
          description: Webhook payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/webhookDto.SpendAlertEvent'
      x-codeSamples:
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\ttirdad \"github.com/tirdad-billing/go-sdk/v2\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := tirdad.New(\n        tirdad.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n    )\n\n    res, err := s.WebhookEvents.PostWebhookEventsSubscriptionGroupSpendThresholdReached(ctx)\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.WebhookDtoSpendAlertEvent != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python
          source: |-
            from tirdad_sdk import Tirdad


            with Tirdad(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as f_client:

                res = f_client.webhook_events.post_webhook_events_subscription_group_spend_threshold_reached()

                # Handle response
                print(res)
        - lang: typescript
          label: TypeScript
          source: |-
            import { Tirdad } from "@tirdad/sdk";

            const tirdad = new Tirdad({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await tirdad.webhookEvents.postWebhookEventsSubscriptionGroupSpendThresholdReached();

              console.log(result);
            }

            run();
components:
  schemas:
    webhookDto.SpendAlertEvent:
      type: object
      properties:
        alert_status:
          $ref: '#/components/schemas/types.AlertState'
        alert_type:
          $ref: '#/components/schemas/types.AlertType'
        current_spend:
          type: string
        group_id:
          type: string
        subscription:
          $ref: '#/components/schemas/webhookDto.Subscription'
        subscription_line_item_id:
          type: string
        threshold:
          type: string
        triggered_at:
          type: string
          format: date-time
    types.AlertState:
      type: string
      enum:
        - ok
        - info
        - warning
        - in_alarm
      x-enum-varnames:
        - AlertStateOk
        - AlertStateInfo
        - AlertStateWarning
        - AlertStateInAlarm
      x-speakeasy-name-override: AlertState
    types.AlertType:
      type: string
      enum:
        - low_ongoing_balance
        - low_credit_balance
        - feature_wallet_balance
        - subscription_spend
        - subscription_line_item_spend
        - subscription_group_spend
        - entitlement_grant_threshold
        - entitlement_grant_exhausted
      x-enum-varnames:
        - AlertTypeLowOngoingBalance
        - AlertTypeLowCreditBalance
        - AlertTypeFeatureWalletBalance
        - AlertTypeSubscriptionSpend
        - AlertTypeSubscriptionLineItemSpend
        - AlertTypeSubscriptionGroupSpend
        - AlertTypeEntitlementGrantThreshold
        - AlertTypeEntitlementGrantExhausted
      x-speakeasy-name-override: AlertType
    webhookDto.Subscription:
      type: object
      properties:
        billing_cadence:
          $ref: '#/components/schemas/types.BillingCadence'
        billing_period:
          $ref: '#/components/schemas/types.BillingPeriod'
        billing_period_count:
          type: integer
        cancel_at:
          type: string
          format: date-time
        cancel_at_period_end:
          type: boolean
        cancelled_at:
          type: string
          format: date-time
        coupon_associations:
          type: array
          items:
            $ref: '#/components/schemas/webhookDto.CouponAssociation'
        currency:
          type: string
        current_period_end:
          type: string
          format: date-time
        current_period_start:
          type: string
          format: date-time
        customer:
          $ref: '#/components/schemas/webhookDto.Customer'
        customer_id:
          type: string
        end_date:
          type: string
          format: date-time
        id:
          type: string
        invoicing_customer_id:
          type: string
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/webhookDto.SubscriptionLineItem'
        lookup_key:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        parent_subscription_id:
          type: string
        pause_status:
          $ref: '#/components/schemas/types.PauseStatus'
        plan:
          $ref: '#/components/schemas/webhookDto.Plan'
        plan_id:
          type: string
        start_date:
          type: string
          format: date-time
        subscription_status:
          $ref: '#/components/schemas/types.SubscriptionStatus'
        subscription_type:
          $ref: '#/components/schemas/types.SubscriptionType'
        trial_end:
          type: string
          format: date-time
        trial_start:
          type: string
          format: date-time
    types.BillingCadence:
      type: string
      enum:
        - RECURRING
      x-enum-varnames:
        - BILLING_CADENCE_RECURRING
      x-speakeasy-name-override: BillingCadence
    types.BillingPeriod:
      type: string
      enum:
        - MONTHLY
        - ANNUAL
        - WEEKLY
        - DAILY
        - QUARTERLY
        - HALF_YEARLY
        - ONETIME
      x-enum-varnames:
        - BILLING_PERIOD_MONTHLY
        - BILLING_PERIOD_ANNUAL
        - BILLING_PERIOD_WEEKLY
        - BILLING_PERIOD_DAILY
        - BILLING_PERIOD_QUARTER
        - BILLING_PERIOD_HALF_YEAR
        - BILLING_PERIOD_ONETIME
      x-speakeasy-name-override: BillingPeriod
    webhookDto.CouponAssociation:
      type: object
      properties:
        coupon_id:
          type: string
        end_date:
          type: string
          format: date-time
        id:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        start_date:
          type: string
          format: date-time
        subscription_id:
          type: string
        subscription_line_item_id:
          type: string
    webhookDto.Customer:
      type: object
      properties:
        address_city:
          type: string
        address_country:
          type: string
        address_line1:
          type: string
        address_line2:
          type: string
        address_postal_code:
          type: string
        address_state:
          type: string
        email:
          type: string
        environment_id:
          type: string
        external_id:
          type: string
        id:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        name:
          type: string
        timezone:
          type: string
    webhookDto.SubscriptionLineItem:
      type: object
      properties:
        billing_period:
          $ref: '#/components/schemas/types.BillingPeriod'
        billing_period_count:
          type: integer
        currency:
          type: string
        display_name:
          type: string
        end_date:
          type: string
          format: date-time
        entity_id:
          type: string
        entity_type:
          $ref: '#/components/schemas/types.SubscriptionLineItemEntityType'
        id:
          type: string
        invoice_cadence:
          $ref: '#/components/schemas/types.InvoiceCadence'
        metadata:
          type: object
          additionalProperties:
            type: string
        meter_display_name:
          type: string
        meter_id:
          type: string
        plan_display_name:
          type: string
        price:
          $ref: '#/components/schemas/webhookDto.Price'
        price_id:
          type: string
        price_type:
          $ref: '#/components/schemas/types.PriceType'
        price_unit:
          type: string
        quantity:
          type: string
        start_date:
          type: string
          format: date-time
        subscription_id:
          type: string
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    types.PauseStatus:
      type: string
      enum:
        - none
        - active
        - scheduled
        - completed
        - cancelled
      x-enum-varnames:
        - PauseStatusNone
        - PauseStatusActive
        - PauseStatusScheduled
        - PauseStatusCompleted
        - PauseStatusCancelled
      x-speakeasy-name-override: PauseStatus
    webhookDto.Plan:
      type: object
      properties:
        description:
          type: string
        id:
          type: string
        lookup_key:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          type: string
        prices:
          type: array
          items:
            $ref: '#/components/schemas/webhookDto.Price'
    types.SubscriptionStatus:
      type: string
      enum:
        - active
        - paused
        - cancelled
        - incomplete
        - trialing
        - draft
      x-enum-varnames:
        - SubscriptionStatusActive
        - SubscriptionStatusPaused
        - SubscriptionStatusCancelled
        - SubscriptionStatusIncomplete
        - SubscriptionStatusTrialing
        - SubscriptionStatusDraft
      x-speakeasy-name-override: SubscriptionStatus
    types.SubscriptionType:
      type: string
      enum:
        - standalone
        - delegated_invoicing
        - parent
        - inherited
        - grouped_invoicing
      x-enum-varnames:
        - SubscriptionTypeStandalone
        - SubscriptionTypeDelegatedInvoicing
        - SubscriptionTypeParent
        - SubscriptionTypeInherited
        - SubscriptionTypeGroupedInvoicing
      x-speakeasy-name-override: SubscriptionType
    types.SubscriptionLineItemEntityType:
      type: string
      enum:
        - plan
        - addon
        - subscription
      x-enum-varnames:
        - SubscriptionLineItemEntityTypePlan
        - SubscriptionLineItemEntityTypeAddon
        - SubscriptionLineItemEntityTypeSubscription
      x-speakeasy-name-override: SubscriptionLineItemEntityType
    types.InvoiceCadence:
      type: string
      enum:
        - ARREAR
        - ADVANCE
      x-enum-varnames:
        - InvoiceCadenceArrear
        - InvoiceCadenceAdvance
      x-speakeasy-name-override: InvoiceCadence
    webhookDto.Price:
      type: object
      properties:
        amount:
          type: string
        billing_cadence:
          $ref: '#/components/schemas/types.BillingCadence'
        billing_model:
          $ref: '#/components/schemas/types.BillingModel'
        billing_period:
          $ref: '#/components/schemas/types.BillingPeriod'
        billing_period_count:
          type: integer
        currency:
          type: string
        description:
          type: string
        display_amount:
          type: string
        display_name:
          type: string
        display_price_unit_amount:
          type: string
        id:
          type: string
        invoice_cadence:
          $ref: '#/components/schemas/types.InvoiceCadence'
        lookup_key:
          type: string
        metadata:
          $ref: '#/components/schemas/price.JSONBMetadata'
        meter:
          $ref: '#/components/schemas/webhookDto.Meter'
        meter_id:
          type: string
        price_unit:
          type: string
        price_unit_amount:
          type: string
        tier_mode:
          $ref: '#/components/schemas/types.BillingTier'
        tiers:
          type: array
          items:
            $ref: '#/components/schemas/price.PriceTier'
        transform_quantity:
          $ref: '#/components/schemas/price.JSONBTransformQuantity'
        type:
          $ref: '#/components/schemas/types.PriceType'
    types.PriceType:
      type: string
      enum:
        - USAGE
        - FIXED
      x-enum-varnames:
        - PRICE_TYPE_USAGE
        - PRICE_TYPE_FIXED
      x-speakeasy-name-override: PriceType
    types.BillingModel:
      type: string
      enum:
        - FLAT_FEE
        - PACKAGE
        - TIERED
      x-enum-varnames:
        - BILLING_MODEL_FLAT_FEE
        - BILLING_MODEL_PACKAGE
        - BILLING_MODEL_TIERED
      x-speakeasy-name-override: BillingModel
    price.JSONBMetadata:
      type: object
      additionalProperties:
        type: string
    webhookDto.Meter:
      type: object
      properties:
        aggregation:
          $ref: '#/components/schemas/meter.Aggregation'
        event_name:
          type: string
        id:
          type: string
        name:
          type: string
        reset_usage:
          $ref: '#/components/schemas/types.ResetUsage'
    types.BillingTier:
      type: string
      enum:
        - VOLUME
        - SLAB
      x-enum-varnames:
        - BILLING_TIER_VOLUME
        - BILLING_TIER_SLAB
      x-speakeasy-name-override: BillingTier
    price.PriceTier:
      type: object
      properties:
        flat_amount:
          type: string
          description: >-
            flat_amount is the flat amount for the given tier (optional)

            Applied on top of unit_amount*quantity. Useful for cases like "2.7$
            + 5c"
        unit_amount:
          type: string
          description: unit_amount is the amount per unit for the given tier
        up_to:
          type: integer
          description: >-
            up_to is the quantity up to which this tier applies. It is null for
            the last tier.

            IMPORTANT: Tier boundaries are INCLUSIVE.

            - If up_to is 1000, then quantity less than or equal to 1000 belongs
            to this tier

            - This behavior is consistent across both VOLUME and SLAB tier modes
    price.JSONBTransformQuantity:
      type: object
      properties:
        divide_by:
          type: integer
          description: Divide quantity by this number
        round:
          $ref: '#/components/schemas/types.RoundType'
    meter.Aggregation:
      type: object
      properties:
        bucket_size:
          $ref: '#/components/schemas/types.WindowSize'
        expression:
          type: string
          description: >-
            Expression is an optional CEL expression to compute per-event
            quantity from event.properties.

            When set, it replaces Field-based extraction. Property names are
            used directly (e.g., token * duration * pixel).
        field:
          type: string
          description: >-
            Field is the key in $event.properties on which the aggregation is to
            be applied

            For ex if the aggregation type is sum for API usage, the field could
            be "duration_ms"

            Ignored when Expression is set.
        group_by:
          type: string
          description: >-
            GroupBy is the property name in event.properties to group by before
            aggregating.

            Requires MAX aggregation. Windowing comes from the price, so this no
            longer

            implies a meter-level bucket_size.

            When set, aggregation is applied per unique value of this property
            within each bucket,

            then the per-group results are summed to produce the bucket total.
        multiplier:
          type: string
          description: >-
            Multiplier is the multiplier for the aggregation

            For ex if the aggregation type is sum_with_multiplier for API usage,
            the multiplier could be 1000

            to scale up by a factor of 1000. If not provided, it will be null.
        type:
          $ref: '#/components/schemas/types.AggregationType'
    types.ResetUsage:
      type: string
      enum:
        - BILLING_PERIOD
        - NEVER
      x-enum-varnames:
        - ResetUsageBillingPeriod
        - ResetUsageNever
      x-speakeasy-name-override: ResetUsage
    types.RoundType:
      type: string
      enum:
        - up
        - down
      x-enum-varnames:
        - ROUND_UP
        - ROUND_DOWN
      x-speakeasy-name-override: RoundType
    types.WindowSize:
      type: string
      enum:
        - MINUTE
        - 15MIN
        - 30MIN
        - HOUR
        - 3HOUR
        - 6HOUR
        - 12HOUR
        - DAY
        - WEEK
        - MONTH
      x-enum-varnames:
        - WindowSizeMinute
        - WindowSize15Min
        - WindowSize30Min
        - WindowSizeHour
        - WindowSize3Hour
        - WindowSize6Hour
        - WindowSize12Hour
        - WindowSizeDay
        - WindowSizeWeek
        - WindowSizeMonth
      x-speakeasy-name-override: WindowSize
    types.AggregationType:
      type: string
      enum:
        - COUNT
        - SUM
        - AVG
        - COUNT_UNIQUE
        - LATEST
        - SUM_WITH_MULTIPLIER
        - MAX
        - WEIGHTED_SUM
      x-enum-comments:
        AggregationSumWithMultiplier: Sum with a multiplier - [sum(value) * multiplier]
      x-enum-varnames:
        - AggregationCount
        - AggregationSum
        - AggregationAvg
        - AggregationCountUnique
        - AggregationLatest
        - AggregationSumWithMultiplier
        - AggregationMax
        - AggregationWeightedSum
      x-speakeasy-name-override: AggregationType

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.