# Create Alert

Creates a new alert configuration for AutoStopping events. Alerts can notify users via email or Slack when specific events occur, such as warmup failures, cooldown failures, or rule lifecycle changes.

Endpoint: POST /gateway/lw/api/accounts/{account_id}/alerts
Version: 1.0
Security: x-api-key

## Path parameters:

  - `account_id` (string, required)
    Unique identifier of the Harness account
    Example: "px7xd_BFRCi-pfWPYXVjvw"

## Query parameters:

  - `accountIdentifier` (string, required)
    Account Identifier for authentication and authorization
    Example: "px7xd_BFRCi-pfWPYXVjvw"

## Request fields (application/json):

  - `id` (string)
    Unique identifier of the alert. Required for update operations.

  - `name` (string, required)
    Name of the alert
    Example: "demo-alert-all-rules"

  - `enabled` (boolean)
    Whether the alert is enabled
    Example: true

  - `entity_type` (string, required)
    Type of entity the alert is associated with
    Enum: "autostopping_rule"

  - `recipients` (array, required)
    List of notification recipients. At least one recipient is required.
    Example: [{"type":"email","ids":["user@example.com"]}]

  - `recipients.type` (string, required)
    Type of notification channel
    Enum: "email", "slack"

  - `recipients.ids` (array, required)
    List of recipient identifiers. For email: email addresses. For slack: Slack channel IDs or webhook URLs.
    Example: ["user@example.com"]

  - `events` (array, required)
    List of events that trigger the alert. At least one event is required.
    Example: [{"id":"event-created","event":"autostopping_rule_created"},{"id":"event-updated","event":"autostopping_rule_updated"},{"id":"event-deleted","event":"autostopping_rule_deleted"},{"id":"event-warmup-failed","event":"autostopping_warmup_failed"},{"id":"event-cooldown-failed","event":"autostopping_cooldown_failed"}]

  - `events.id` (string, required)
    Unique identifier for this event configuration. Can be any string to identify this event entry.
    Example: "event-warmup-failed"

  - `events.event` (string, required)
    Type of event that triggers the alert
    Enum: "autostopping_warmup_failed", "autostopping_cooldown_failed", "autostopping_rule_created", "autostopping_rule_updated", "autostopping_rule_deleted"

  - `associated_entities` (array, required)
    List of entities associated with this alert. Use relation_type 'all' to apply to all AutoStopping rules, or 'specific' with entity_id to target specific rules.
    Example: [{"relation_type":"all"}]

## Response 200 fields (application/json):

  - `response` (string, required)
    ID of the created alert


## Response 400 fields
