# Monitors

***

## Endpoints

| Method   | Path                   | Permission        | Description                                 |
| -------- | ---------------------- | ----------------- | ------------------------------------------- |
| `GET`    | `/api/monitors`        | `monitors:read`   | List monitors (filter by `assetId`)         |
| `GET`    | `/api/monitors/:id`    | `monitors:read`   | Get monitor by ID                           |
| `POST`   | `/api/monitors`        | `monitors:write`  | Create a monitor                            |
| `PUT`    | `/api/monitors/:id`    | `monitors:write`  | Update monitor configuration                |
| `DELETE` | `/api/monitors/:id`    | `monitors:delete` | Delete a monitor                            |
| `POST`   | `/api/monitors/deploy` | `monitors:write`  | Bulk deploy standard monitors for assets    |
| `PATCH`  | `/api/monitors/bulk`   | `monitors:write`  | Bulk update monitors across multiple assets |

***

## Monitor Types

| Type           | Description                         |
| -------------- | ----------------------------------- |
| `record_count` | Row count tracking                  |
| `freshness`    | Data recency via timestamp column   |
| `completeness` | Non-null ratio for selected columns |
| `schema`       | Structural change detection         |
| `custom_sql`   | User-defined T-SQL with threshold   |

***

## GET /api/monitors

List monitors. Use `?assetId=<uuid>` to filter to a single asset.

**Query parameters:** `assetId`, `page`, `pageSize`

**Response (200):**

```json
{
  "data": [
    {
      "id": "uuid",
      "assetId": "uuid",
      "type": "record_count",
      "config": {
        "cronSchedule": "0 */6 * * *",
        "threshold": { "type": "percentage_change", "value": 20 },
        "alertChannelId": "uuid",
        "impact": "high",
        "enabled": true
      },
      "enabled": true,
      "nextRun": "2026-03-24T12:00:00Z",
      "createdAt": "2026-03-01T10:00:00Z",
      "updatedAt": "2026-03-24T08:00:00Z"
    }
  ]
}
```

***

## POST /api/monitors

Create a single monitor.

**Request:**

```json
{
  "assetId": "uuid",
  "type": "completeness",
  "config": {
    "cronSchedule": "0 */6 * * *",
    "selectedAttributes": ["customer_id", "email"],
    "threshold": { "type": "min", "value": 95 },
    "alertChannelId": "uuid",
    "impact": "high"
  }
}
```

**Monitor-specific config fields:**

| Type           | Config Fields                                                                                  |
| -------------- | ---------------------------------------------------------------------------------------------- |
| `record_count` | `threshold` (type: `static`\|`percentage_change`\|`anomaly`, value)                            |
| `freshness`    | `timestampColumn`, `threshold` (max staleness in hours)                                        |
| `completeness` | `selectedAttributes` (column names), `threshold` (min %)                                       |
| `schema`       | `ignoreNewAttributes` (bool), `schemaMonitoredAttributes` (columns), `schemaForcedTypes` (map) |
| `custom_sql`   | `customSql` (T-SQL string), `threshold` (type + value), `columnName`                           |

**Response (201):** Monitor object.

***

## PUT /api/monitors/:id

Update monitor configuration. Send the full `config` object.

**Response (200):** Updated monitor object.

***

## POST /api/monitors/deploy

Bulk deploy the 4 standard monitors (`record_count`, `freshness`, `completeness`, `schema`) for one or more assets.

**Request:**

```json
{
  "projectId": "uuid",
  "assetIds": ["uuid-1", "uuid-2"]
}
```

**Response (200):**

```json
{
  "data": {
    "total": 2,
    "succeeded": 2,
    "failed": 0,
    "results": [
      {
        "assetId": "uuid-1",
        "status": "success",
        "monitors": [
          { "id": "uuid", "type": "record_count" },
          { "id": "uuid", "type": "freshness" },
          { "id": "uuid", "type": "completeness" },
          { "id": "uuid", "type": "schema" }
        ]
      }
    ]
  }
}
```

***

## PATCH /api/monitors/bulk

Update a common setting across all monitors for a set of assets.

**Request:**

```json
{
  "assetIds": ["uuid-1", "uuid-2"],
  "updates": {
    "cronSchedule": "0 0 * * *",
    "alertChannelId": "uuid",
    "jiraEnabled": true
  }
}
```

**Response (200):**

```json
{
  "data": { "updated": 8 }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fabric-docs.telm.ai/api-reference/monitors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
