## The alert object

### Example

```
{
  "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
  "lago_organization_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
  "external_subscription_id": "sub_1234567890",
  "external_customer_id": "cus_0987654321",
  "billable_metric": {
    "lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
    "name": "Storage",
    "code": "storage",
    "recurring": false,
    "created_at": "2022-09-14T16:35:31Z",
    "aggregation_type": "sum_agg",
    "description": "GB of storage used in my application",
    "rounding_function": "round",
    "rounding_precision": 2,
    "expression": "round((ended_at - started_at) * units)",
    "field_name": "gb",
    "weighted_interval": "seconds",
    "filters": [
      {
        "key": "region",
        "values": [
          "us-east-1"
        ]
      }
    ]
  },
  "alert_type": "billable_metric_current_usage_amount",
  "code": "storage_threshold_alert",
  "name": "Storage Usage Alert",
  "previous_value": 1000,
  "last_processed_at": "2025-05-19T10:04:21Z",
  "thresholds": [
    {
      "code": "warn",
      "recurring": false,
      "value": "99.0"
    }
  ],
  "created_at": "2025-03-20T10:00:00Z",
  "lago_wallet_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
  "wallet_code": "wallet_code",
  "direction": "increasing"
}
```

### Schema fields
#### `lago_id`
- **Type**: string<uuid>
- **Required**: Yes
- **Description**: Unique identifier of the alert, created by Lago.
- **Example**: 
`"1a901a90-1a90-1a90-1a90-1a901a901a90"`

#### `lago_organization_id`
- **Type**: string<uuid>
- **Required**: Yes
- **Description**: Unique identifier of the organization, created by Lago.
- **Example**: 
`"1a901a90-1a90-1a90-1a90-1a901a901a90"`

#### `external_subscription_id`
- **Type**: string | null
- **Required**: Yes
- **Description**: The subscription external unique identifier (provided by your own application).
- **Example**: 
`"sub_1234567890"`

#### `external_customer_id`
- **Type**: string
- **Required**: Yes
- **Description**: The customer external unique identifier (provided by your own application).
- **Example**: 
`"cus_0987654321"`

#### `billable_metric`
- **Type**: object
- **Required**: Yes
- **Description**: The billable metric associated with the alert. Only for alerts based on a billable metric.

#### `alert_type`
- **Type**: enum<string>
- **Required**: Yes
- **Description**: The type of alert.
- **Available options**: `current_usage_amount`, `billable_metric_current_usage_amount`, `billable_metric_current_usage_units`, `lifetime_usage_amount`
- **Example**: 
`"billable_metric_current_usage_amount"`

#### `code`
- **Type**: string
- **Required**: Yes
- **Description**: Unique code used to identify the alert.
- **Example**: 
`"storage_threshold_alert"`

#### `name`
- **Type**: string | null
- **Required**: Yes
- **Description**: The name of the alert.
- **Example**: 
`"Storage Usage Alert"`

#### `previous_value`
- **Type**: number
- **Required**: Yes
- **Description**: When the system checked if this alert should be triggered, this value was retrieved and checked against the thresholds.
- **Example**: 
`1000`

#### `last_processed_at`
- **Type**: string<date-time> | null
- **Required**: Yes
- **Description**: The date and time in UTC (ISO 8601) when the system checked if this alert should be triggered. Null until it's processed for the first time.
- **Example**: 
`"2025-05-19T10:04:21Z"`

#### `thresholds`
- **Type**: object[]
- **Required**: Yes
- **Description**: Array of thresholds associated with the alert.

#### `created_at`
- **Type**: string<date-time>
- **Required**: Yes
- **Description**: The date and time in UTC (ISO 8601) when the alert was created.
- **Example**: 
`"2025-03-20T10:00:00Z"`

#### `lago_wallet_id`
- **Type**: string | null
- **Description**: Unique identifier of the wallet, created by Lago.
- **Example**: 
`"1a901a90-1a90-1a90-1a90-1a901a901a90"`

#### `wallet_code`
- **Type**: string | null
- **Description**: The wallet external unique identifier (provided by your own application).
- **Example**: 
`"wallet_code"`

#### `direction`
- **Type**: enum<string>
- **Description**: Indicates whether the alert is triggered when the monitored metric goes above or below the threshold.
- **Available options**: `increasing`, `decreasing`
- **Example**: 
`"increasing"`
