> For the complete documentation index, see [llms.txt](https://docs.groundcover.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.groundcover.com/reference/remote-access-and-apis/api-examples/legacy-monitor-reads.md).

# Legacy Monitor Read Compatibility

List monitors and read YAML definitions on backends without monitors v2.

Use [Monitors v2 API](https://docs.groundcover.com/reference/remote-access-and-apis/api-examples/monitors-v2-api.md) when the selected backend supports it. For backends without the monitors-v2 capability, the v2 routes return `404`, while the legacy list and read endpoints below remain available.

### Authentication

Use an [API key](https://docs.groundcover.com/administer/api-keys.md) with at least Viewer (`read`) permissions. Include `Authorization: Bearer <YOUR_API_KEY>` and `X-Backend-Id: <YOUR_BACKEND_ID>`. Self-hosted installations use their own API URL and an API key issued in that environment.

### List monitors

**POST** `/api/monitors/list`

Send a JSON body with optional `limit` (defaults to 1,000), `skip` (defaults to 0), and `sort` (`name` or `type`, default `name`). Optional `query` accepts gcQL filters on `monitor_name` and `type`, without pipes or aggregations. Use `conditions` for structured filters instead of `query`.

```bash
curl --request POST 'https://api.groundcover.com/api/monitors/list' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'X-Backend-Id: <YOUR_BACKEND_ID>' \
  --header 'Content-Type: application/json' \
  --data '{"limit":20,"skip":0,"sort":"name"}'
```

HTTP `200` returns a `monitors` array and a `done` flag:

```json
{
  "monitors": [
    {
      "uuid": "00000000-0000-4000-8000-000000000001",
      "title": "Checkout error logs",
      "type": "logs"
    }
  ],
  "done": true
}
```

If `done` is `false`, increase `skip` by the requested page size and repeat with the same filters and sort. This legacy response uses `title` and `monitors`; v2 search returns row objects under `data`.

### Read a definition

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

Use a UUID from the list response to retrieve the YAML definition:

```bash
curl --fail-with-body --request GET \
  'https://api.groundcover.com/api/monitors/00000000-0000-4000-8000-000000000001' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'X-Backend-Id: <YOUR_BACKEND_ID>' \
  --header 'Accept: application/x-yaml' \
  --output monitor.yaml
```

HTTP `200` returns the YAML text directly. See [Monitor YAML structure](https://docs.groundcover.com/automate/monitors/monitor-yaml-structure.md) for its fields. An unknown monitor or a monitor without a stored YAML definition returns `404`.

For a JSON response, use **GET** `/api/monitors/{uuid}/details`:

```bash
curl --request GET \
  'https://api.groundcover.com/api/monitors/00000000-0000-4000-8000-000000000001/details' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'X-Backend-Id: <YOUR_BACKEND_ID>'
```

The response contains `data` (the YAML definition as a string) and `isProvisioned` (a boolean). With `jq` installed, append `| jq -r '.data'` to display the YAML with its original line breaks. This is the legacy YAML format; use the [v2 batch-read endpoint](https://docs.groundcover.com/reference/remote-access-and-apis/api-examples/get-monitor.md) when you need a typed JSON `spec`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.groundcover.com/reference/remote-access-and-apis/api-examples/legacy-monitor-reads.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
