---
title: "Create an alert rule"
method: POST
path: "/api/v1/platform/alerts/{session_id}"
tags: ["alert_rules"]
---

# Create an alert rule

`POST /api/v1/platform/alerts/{session_id}`

## Request

- Base URL: `https://api.smith.langchain.com`
- URL: `https://api.smith.langchain.com/api/v1/platform/alerts/{session_id}`
- Auth: one of:
  - API key in header `X-API-Key`
  - API key in header `X-Tenant-Id`
  - HTTP bearer

Creates a new alert rule. The request body must be a JSON-encoded alert rule object that follows the CreateAlertRuleRequest schema.

## Path parameters

- `session_id` string, required

## Request body

- AlertsCreateAlertRuleRequest
  - `actions` AlertsAlertActionBase[], required
    - `alert_rule_id` string
    - `config` object, required
    - `id` string
    - `target` 'pagerduty' | 'webhook' | 'dynatrace' | 'slack', required
  - `rule` AlertsAlertRuleBase, required
    - `aggregation` 'avg' | 'sum' | 'pct', required
    - `attribute` 'latency' | 'error_count' | 'feedback_score' | 'run_latency' | 'run_count' | 'total_cost', required
    - `denominator_filter` string
    - `description` string, required
    - `filter` string
    - `id` string
    - `name` string, required
    - `operator` 'gte' | 'lte' | 'gt' | 'lt', required
    - `threshold` number
    - `threshold_multiplier` number
    - `threshold_window_minutes` integer
    - `type` 'threshold' | 'change', required
    - `window_minutes` integer, required: 1-60 minutes for alert rule

## Response `201`

Alert rule created

- AlertsAlertRuleResponse
  - `actions` AlertsAlertAction[]
    - `alert_rule_id` string
    - `config` object, required
    - `created_at` string
    - `id` string
    - `is_suspended` boolean
    - `suspended_at` string
    - `suspended_reason` string
    - `suspended_status_code` integer
    - `target` 'pagerduty' | 'webhook' | 'dynatrace' | 'slack', required
    - `updated_at` string
  - `rule` AlertsAlertRule
    - `aggregation` 'avg' | 'sum' | 'pct', required
    - `attribute` 'latency' | 'error_count' | 'feedback_score' | 'run_latency' | 'run_count' | 'total_cost', required
    - `created_at` string
    - `denominator_filter` string
    - `description` string, required
    - `filter` string
    - `id` string
    - `name` string, required
    - `operator` 'gte' | 'lte' | 'gt' | 'lt', required
    - `session_id` string
    - `session_name` string
    - `threshold` number
    - `threshold_multiplier` number
    - `threshold_window_minutes` integer
    - `type` 'threshold' | 'change', required
    - `updated_at` string
    - `window_minutes` integer, required: 1-60 minutes for alert rule

## Other responses

- `400`: Bad request
- `403`: Forbidden
- `429`: Alert Rule Limit Reached
- `500`: Internal server error
- `503`: Service unavailable

## Changes

- **2026-10-17** `c141773e30b5`: 4 info
  - added the optional property `actions/items/is_suspended` to the response with the `201` status
  - added the optional property `actions/items/suspended_at` to the response with the `201` status
  - added the optional property `actions/items/suspended_reason` to the response with the `201` status
  - added the optional property `actions/items/suspended_status_code` to the response with the `201` status
- **2026-10-16** `1a8ee9358d81`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/langchain-ai/apis/langsmith/changes/api/v1/platform/alerts/:session_id/post.md)

---

[API](https://skmtc.dev/langchain-ai/apis/langsmith.md) - [All operations](https://skmtc.dev/langchain-ai/apis/langsmith/llms.txt) - [OpenAPI document](https://skmtc.dev/langchain-ai/apis/langsmith/revisions/7a01c01f75e8?raw)
