---
title: "Create Custom SQL Monitor"
method: POST
path: "/api/v1/assets/{asset_id}/custom-sql-monitors"
tags: ["custom_sql"]
---

# Create Custom SQL Monitor

`POST /api/v1/assets/{asset_id}/custom-sql-monitors`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/api/v1/assets/{asset_id}/custom-sql-monitors`
- Auth: none declared

Create a new custom SQL monitor for an asset.

## Path parameters

- `asset_id` string, uuid, required

## Headers

- `Authorization` string

## Request body

- CreateCustomSqlMonitorRequest: Request to create a custom SQL monitor.
  - `name` string, required: Human-readable name for this monitor
  - `description` string, nullable: Optional description of what this monitor checks
  - `sql_query` string, required: SELECT query that returns a single numeric value
  - `table_path` string, required: Primary table being monitored (for asset association)
  - `upper_bound` number, nullable: Alert if value exceeds this threshold
  - `lower_bound` number, nullable: Alert if value drops below this threshold
  - `check_interval` string, required: How often to run (hourly, daily, weekly, or cron expression)
  - `timeout_seconds` integer: Query execution timeout in seconds
  - `enabled` boolean: Whether the monitor should be active immediately

## Response `200`

Successful Response

- StandardResponse: Standard API response wrapper.
  - `success` boolean, required
  - `data` unknown
  - `message` string, nullable
  - `error` string, nullable
  - `meta` object, nullable

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api.md) · [All operations](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api/llms.txt) · [OpenAPI document](https://skmtc.dev/anomalyarmor/apis/anomalyarmor-api/revisions/51c755fb5d0b?raw)
