---
search:
  tags:
    - Alerts
    - POST
seo:
  description: >-
    Creates an alert rule of one kind; the API checks the fields that kind
    needs. Reference for the POST /v1/me/alerts endpoint in the INVICTUS API.
sidebar:
  label: Create an alert rule.
  badge: POST
title: Create an alert rule.
type: openapi-operation
---
Creates an alert rule of one kind; the API checks the fields that kind needs.

`POST /v1/me/alerts`

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

- `kind` (string, required) — What the rule watches.
- `subject` (object | null, required) — What the rule is about; null for an account-wide rule.
- `condition` (object, required) — When the rule fires; the fields its kind needs.
- `delivery` (object, required) — How its notifications are delivered.

Request body example:

```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"
  }
}
```

**Responses**

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

Response example, 201:

```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
}
```
