---
search:
  tags:
    - Alerts
    - PATCH
seo:
  description: >-
    Changes an alert rule; the revision must be the current one, or the answer
    is 409… Reference for the PATCH /v1/me/alerts/{id} endpoint in the INVICTUS
    API.
sidebar:
  label: Change an alert rule by revision.
  badge: PATCH
title: Change an alert rule by revision.
type: openapi-operation
---
Changes an alert rule; the revision must be the current one, or the answer is 409 `stale_revision`.

`PATCH /v1/me/alerts/{id}`

**Request body** (`application/json`, required)

- `revision` (integer, required) — The revision the change was made on; a stale one is 409 stale\_revision.
- `enabled` (boolean) — Switch the rule on or off.
- `mutedUntil` (integer | null) — Mute the rule until this Unix time in seconds; null unmutes it.
- `condition` (object) — The new condition.
- `delivery` (object) — The new delivery.

Request body example:

```json
{
  "revision": 0,
  "enabled": true,
  "mutedUntil": 1793145600,
  "condition": {
    "thresholdPercent": "1234.56",
    "levelUsd": "1234.56",
    "direction": "up",
    "windowSeconds": 300,
    "metric": "fee-apr"
  },
  "delivery": {
    "channels": [
      "inbox"
    ],
    "cooldownSeconds": 0,
    "quietHours": {
      "from": "string",
      "to": "string",
      "timeZone": "Asia/Jakarta"
    },
    "digest": "off"
  }
}
```

**Responses**

- `200` — Success.
- `400` — Invalid input; \`errors\` names the fields.
- `401` — No session, or it ended.
- `404` — Not found, or not yours.
- `409` — In conflict with the current state.
- `429` — Too many requests; \`retryAfterSeconds\` says when to ask again.
- `500` — Server error.

Response example, 200:

```json
{
  "kind": "out-of-range",
  "subject": {
    "type": "pool",
    "id": "string"
  },
  "condition": {
    "thresholdPercent": "1234.56",
    "levelUsd": "1234.56",
    "direction": "up",
    "windowSeconds": 300,
    "metric": "fee-apr"
  },
  "delivery": {
    "channels": [
      "inbox"
    ],
    "cooldownSeconds": 0,
    "quietHours": {
      "from": "string",
      "to": "string",
      "timeZone": "Asia/Jakarta"
    },
    "digest": "off"
  },
  "id": "Xq3v9Kp2LmN8RtY4",
  "enabled": true,
  "mutedUntil": 1793145600,
  "lastFiredAt": 1793145600,
  "revision": 0
}
```
