# 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 (MetricsQL, uses `rollup`)

```yaml
title: 'PVC usage above threshold (90%)'
display:
  header: PV usage above 90% threshold - {{ labels.cluster }}, {{ labels.name }}
  contextHeaderLabels:
  - cluster
  - namespace
  - env
severity: S2
measurementType: state
model:
  queries:
  - name: threshold_input_query
    dataType: metrics
    expression: >
      avg by (cluster, env, name, namespace) (
        groundcover_pvc_usage_percent{name!~"object-storage-cache-groundcover-incloud-clickhouse-shard.*"}
      )
    datasourceType: prometheus
    queryType: instant
    rollup:
      function: avg
      time: 5m
  thresholds:
  - name: threshold_1
    inputName: threshold_input_query
    operator: gt
    values:
    - 90
noDataState: OK
evaluationInterval:
  interval: 1m0s
  pendingFor: 1m0s
```

#### Response Example - Traces Monitor (gcQL, uses `instantRollup`)

```yaml
title: gRPC API Errors Monitor
display:
  header: gRPC API Error {{ labels.status_code }}
  resourceHeaderLabels:
  - span_name
  - role
  contextHeaderLabels:
  - env
  - cluster
  - namespace
  - workload
severity: S3
measurementType: event
model:
  queries:
  - name: threshold_input_query
    dataType: traces
    expression: >
      span_type:grpc status_code:!=0 status:error source:ebpf
      | stats by (env, cluster, namespace, workload, status_code, span_name, role) count() errors_total
    instantRollup: 1 minutes
  thresholds:
  - name: threshold_1
    inputName: threshold_input_query
    operator: gt
    values:
    - 0
executionErrorState: OK
noDataState: OK
evaluationInterval:
  interval: 1m
  pendingFor: 0s
```

The query language is [MetricsQL](https://docs.victoriametrics.com/metricsql/) for `dataType: metrics`/`infra` and [gcQL](/use-groundcover/querying-your-groundcover-data/groundcover-query-language/groundcover-query-language-gcql-reference.md) for `logs`/`traces`/`events`/`rum`/`entities`/`issues`. The two examples also show the two different rollup fields: `rollup` (object with `function` + `time`) is for MetricsQL, and `instantRollup` (a duration string) is for gcQL. See [Monitor YAML structure](/use-groundcover/monitors/monitor-yaml-structure.md) for the full schema reference.


---

# 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://docs.groundcover.com/use-groundcover/remote-access-and-apis/api-examples/get-monitor.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.
