> ## 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.

# Create alert settings

> Configure a subscription, line item, or group spend alert.



## OpenAPI

````yaml /api-reference/openapi.json post /alerts/setting
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:
  /alerts/setting:
    post:
      tags:
        - AlertSettings
      summary: Create alert settings
      description: Configure a subscription, line item, or group spend alert.
      operationId: createAlertSettings
      requestBody:
        description: Alert settings
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAlertSettingsRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AlertSettingsResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
      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\"github.com/tirdad-billing/go-sdk/v2/models/types\"\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.AlertSettings.CreateAlertSettings(ctx, types.CreateAlertSettingsRequest{\n        Config: types.AlertSettings{},\n        EntityID: \"<id>\",\n        EntityType: types.AlertEntityTypeFeature,\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.AlertSettingsResponse != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python
          source: |-
            from tirdad_sdk import Tirdad, models


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

                res = f_client.alert_settings.create_alert_settings(config=models.AlertSettings(), entity_id="<id>", entity_type="feature")

                # 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.alertSettings.createAlertSettings({
                config: {},
                entityId: "<id>",
                entityType: "feature",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    CreateAlertSettingsRequest:
      required:
        - config
        - entity_id
        - entity_type
      type: object
      properties:
        config:
          $ref: '#/components/schemas/types.AlertSettings'
        entity_id:
          type: string
          description: >-
            entity_id is the id of the monitored entity: subscription id,
            subscription_line_item id, or

            group id, matching entity_type.
        entity_type:
          $ref: '#/components/schemas/types.AlertEntityType'
        parent_entity_id:
          type: string
          description: >-
            parent_entity_id is the subscription id that owns a line-item or
            group alert. Required when

            entity_type is "subscription_line_item" or "group"; omitted for
            subscription-level alerts.
        parent_entity_type:
          $ref: '#/components/schemas/types.AlertEntityType'
    AlertSettingsResponse:
      type: object
      properties:
        config:
          $ref: '#/components/schemas/types.AlertSettings'
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        enabled:
          type: boolean
        entity_id:
          type: string
        entity_type:
          $ref: '#/components/schemas/types.AlertEntityType'
        environment_id:
          type: string
        id:
          type: string
        parent_entity_id:
          type: string
        parent_entity_type:
          type: string
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
    errors.ErrorResponse:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/errors.ErrorCode'
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.AlertSettings:
      type: object
      properties:
        alert_enabled:
          type: boolean
        alert_threshold_type:
          $ref: '#/components/schemas/types.AlertThresholdType'
        critical:
          $ref: '#/components/schemas/types.AlertThreshold'
        info:
          $ref: '#/components/schemas/types.AlertThreshold'
        warning:
          $ref: '#/components/schemas/types.AlertThreshold'
      x-speakeasy-name-override: AlertSettings
    types.AlertEntityType:
      type: string
      enum:
        - wallet
        - feature
        - subscription
        - subscription_line_item
        - group
        - entitlement_grant
      x-enum-varnames:
        - AlertEntityTypeWallet
        - AlertEntityTypeFeature
        - AlertEntityTypeSubscription
        - AlertEntityTypeSubscriptionLineItem
        - AlertEntityTypeGroup
        - AlertEntityTypeEntitlementGrant
      x-speakeasy-name-override: AlertEntityType
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    errors.ErrorCode:
      type: string
      enum:
        - http_client_error
        - system_error
        - internal_error
        - not_found
        - already_exists
        - version_conflict
        - validation_error
        - invalid_operation
        - permission_denied
        - database_error
        - service_unavailable
        - too_many_requests
        - not_implemented
      x-enum-varnames:
        - ErrCodeHTTPClient
        - ErrCodeSystemError
        - ErrCodeInternalError
        - ErrCodeNotFound
        - ErrCodeAlreadyExists
        - ErrCodeVersionConflict
        - ErrCodeValidation
        - ErrCodeInvalidOperation
        - ErrCodePermissionDenied
        - ErrCodeDatabase
        - ErrCodeServiceUnavailable
        - ErrCodeTooManyRequests
        - ErrCodeNotImplemented
      x-speakeasy-name-override: ErrorCode
    types.AlertThresholdType:
      type: string
      enum:
        - absolute
        - percentage
      x-enum-varnames:
        - AlertThresholdTypeAbsolute
        - AlertThresholdTypePercentage
      x-speakeasy-name-override: AlertThresholdType
    types.AlertThreshold:
      type: object
      properties:
        condition:
          $ref: '#/components/schemas/types.AlertCondition'
        threshold:
          type: string
      x-speakeasy-name-override: AlertThreshold
    types.AlertCondition:
      type: string
      enum:
        - above
        - below
      x-enum-varnames:
        - AlertConditionAbove
        - AlertConditionBelow
      x-speakeasy-name-override: AlertCondition
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````

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