# Get Monitor

### Endpoint

**GET** `/api/monitors/{uuid}`

### Authentication

This endpoint requires API Key authentication via the Authorization header.

### Headers

| Header          | Required | Description                    |
| --------------- | -------- | ------------------------------ |
| `Authorization` | Yes      | Bearer token with your API key |
| `Content-Type`  | Yes      | Must be `application/json`     |
| `Accept`        | Yes      | Must be `application/json`     |

### Path Parameters

| Parameter | Type   | Required | Description                                      |
| --------- | ------ | -------- | ------------------------------------------------ |
| `uuid`    | string | Yes      | The unique identifier of the monitor to retrieve |

**Field Descriptions**

| Field                           | Type    | Description                                            |
| ------------------------------- | ------- | ------------------------------------------------------ |
| `title`                         | string  | Monitor name/title                                     |
| `display.header`                | string  | Alert header template with variable substitution       |
| `display.resourceHeaderLabels`  | array   | Labels shown in resource headers                       |
| `display.contextHeaderLabels`   | array   | Labels shown in context headers                        |
| `display.description`           | string  | Monitor description                                    |
| `severity`                      | string  | Alert severity level (e.g., `"S1"`, `"S2"`, `"S3"`)    |
| `measurementType`               | string  | Type of measurement (`"state"`, `"event"`)             |
| `model.queries`                 | array   | Query configurations for data retrieval                |
| `model.thresholds`              | array   | Threshold configurations for alerting                  |
| `executionErrorState`           | string  | State when execution fails (`"OK"`, `"ALERTING"`)      |
| `noDataState`                   | string  | State when no data is available (`"OK"`, `"ALERTING"`) |
| `evaluationInterval.interval`   | string  | How often to evaluate the monitor                      |
| `evaluationInterval.pendingFor` | string  | How long to wait before alerting                       |
| `isPaused`                      | boolean | Whether the monitor is currently paused                |

### Examples

#### Basic Request

Get monitor configuration by UUID:

```bash
curl -L \
  --url 'https://api.groundcover.com/api/monitors/xxxx-xxxx-xxx-xxxx-xxxx' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Accept: application/json'
```

#### Response Example - Metrics Monitor

```yaml
title: 'PVC usage above threshold (90%)'
display:
  header: PV usage above 90% threshold - {{ alert.labels.cluster }}, {{ alert.labels.name }}
  contextHeaderLabels:
  - cluster
  - namespace
  - env
severity: S2
measurementType: state
model:
  queries:
  - dataType: metrics
    name: threshold_input_query
    pipeline:
      function:
        name: last_over_time
        pipelines:
        - function:
            name: avg_by
            pipelines:
            - metric: groundcover_pvc_usage_percent
            args:
            - cluster
            - env
            - name
            - namespace
        args:
        - 1m
    conditions:
    - key: name
      origin: root
      type: string
      filters:
      - op: not_match
        value: object-storage-cache-groundcover-incloud-clickhouse-shard.*
  thresholds:
  - name: threshold_1
    inputName: threshold_input_query
    operator: gt
    values:
    - 90
noDataState: OK
evaluationInterval:
  interval: 1m0s
  pendingFor: 1m0s
```
