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

# Create rule

> Create an alert rule.

```http theme={null}
POST /api/v1/alerts/rules
```

A rule's `kind` is `scheduled`, `real_time`, or `anomaly`. Creating and changing rules requires
`alerts.manage`. See [Alerting](/en-US/alerting) for detector-specific fields.

<RequestExample>
  ```json body theme={null}
  {
    "name": "High error rate",
    "description": "More than 100 errors in one minute",
    "enabled": true,
    "kind": "scheduled",
    "query": {
      "language": "sql",
      "statement": "SELECT count(*) AS c FROM app WHERE level = 'error'",
      "period_secs": 60,
      "stream": { "name": "app", "stream_type": "logs" }
    },
    "trigger": {
      "operator": "gt",
      "threshold": 100,
      "for_periods": 1,
      "silence_secs": 300
    },
    "thresholds": [],
    "severity": "critical",
    "escalation_policy_id": "<policy-id>",
    "labels": { "team": "checkout" },
    "annotations": {}
  }
  ```
</RequestExample>
