---
title: "Create alert"
method: POST
path: "/v0/alerts"
tags: ["Alerts"]
---

# Create alert

`POST /v0/alerts`

## Request

- Base URL: `https://api.formo.so`
- URL: `https://api.formo.so/v0/alerts`
- Auth: HTTP bearer

Create a new alert for the project.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `name` string, required
  - `trigger_type` 'event' | 'user', required
  - `trigger_filters` AlertFilter[], required
    - `field` string, required: Column or property targeted by this filter.
    - `op` 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte' | 'in' | 'nin' | 'startsWith' | 'endsWith' | 'contains' | 'notEmpty' | 'isEmpty', required: Canonical comparison operator token.
    - `value` string, required
    - `numericThreshold` string
  - `recipient` object[]
    - `type` 'email' | 'slack' | 'webhook'
    - `value` string[]
  - `secret` string: Webhook signing secret

## Response `201`

Alert created

- Alert
  - `id` string, required
  - `name` string, required
  - `created_at` string, date-time
  - `updated_at` string, date-time, nullable
  - `trigger_type` 'event' | 'user', required
  - `status` 'active' | 'inactive', required
  - `trigger_filters` AlertFilter[]
    - `field` string, required: Column or property targeted by this filter.
    - `op` 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte' | 'in' | 'nin' | 'startsWith' | 'endsWith' | 'contains' | 'notEmpty' | 'isEmpty', required: Canonical comparison operator token.
    - `value` string, required
    - `numericThreshold` string
  - `recipient` object[]
    - `type` 'email' | 'slack' | 'webhook', required
    - `value` string[], required
  - `project_id` string, required
  - `has_secret` boolean

## Other responses

- `400`: The request was rejected. `code` is either `INVALID_VALIDATION_REQUEST` (Zod schema mismatch; `details` carries a `{ fieldPath: message }` map) or `BAD_REQUEST` (semantic validation failure outside Zod, e.g. mismatched IDs, business-rule violations). Branch on `code`, not status, to tell the two apart.
- `409`: The request conflicts with current resource state, or an `Idempotency-Key` request with the same key is currently in flight.

---

[API](https://skmtc.dev/formo/apis/formo-public-api.md) · [All operations](https://skmtc.dev/formo/apis/formo-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/formo/apis/formo-public-api/revisions/67ada57df63c?raw)
