# Get a monitor

> One monitor, with its schedule and health: `current_interval_seconds`, `next_check_at`, `consecutive_failures`, `last_error`, and `enabled` with `disabled_reason` when it was switched off.

Source: https://docs.spicrawl.com/api-reference/monitors/monitors-get

## GET /v1/monitors/{monitorID}

Operation ID: `monitorsGet`. API key scope: `monitors`.

One monitor, with its schedule and health: `current_interval_seconds`, `next_check_at`,
`consecutive_failures`, `last_error`, and `enabled` with `disabled_reason` when it was switched off.
Scope `monitors` (or `read`).

### Example

```bash
curl "https://api.spicrawl.com/v1/monitors/{monitorID}" \
  -H "Authorization: Bearer $SPICRAWL_API_KEY"
```

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `monitorID` | path | string | yes | The monitor `id` returned by `POST /v1/monitors`. An id of another organization answers 404. |

### Responses

#### 200

The monitor.

Headers: `X-Request-Id`.

`application/json`.

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |
| `name` | string | yes | Defaults to the host of `url`. |
| `url` | string (uri) | yes |  |
| `selector` | string \| null | yes | CSS selector. Every element it matches is watched, as its text, in document order. Null watches the main content of the page. |
| `js_render` | boolean | yes | Render the page in a browser before reading it. Costs more credits; see the Monitors section of the API reference. |
| `interval_seconds` | integer | yes | The interval you asked for. Defaults to the plan minimum. |
| `current_interval_seconds` | integer | yes | The interval in force now. It moves between the plan minimum and `interval_seconds` as the page changes or stays put. |
| `confirm_checks` | integer | yes | A change must be seen on this many checks in a row before it is reported. 1 reports the first change. |
| `webhook_endpoint_id` | string \| null | yes | The endpoint that receives `monitor.changed` and `monitor.failed`. Null when none is set. |
| `enabled` | boolean | yes | False once the monitor was disabled, by repeated failures, by running out of credits, or by `enabled: false`. |
| `disabled_reason` | string \| null | yes | Why the monitor is disabled, when it is. Null while enabled. |
| `last_error` | string \| null | yes | A short description of the most recent failed check. Cleared by a successful check and by re-enabling. |
| `last_checked_at` | string \| null (date-time) | yes |  |
| `last_changed_at` | string \| null (date-time) | yes |  |
| `next_check_at` | string \| null (date-time) | yes |  |
| `consecutive_failures` | integer | yes | Failed checks in a row. A success resets it. The monitor disables itself when it reaches the limit. |
| `created_at` | string (date-time) | yes |  |
| `updated_at` | string (date-time) | yes |  |
| `scope` | string: `page`, `site` | yes | `page` watches one URL. `site` watches every page the start URL leads to on its exact host. Set at create; it cannot be changed. |
| `max_pages` | integer \| null | yes | Site monitors only. The most pages a run considers. Null for page monitors. |
| `include_paths` | array of string | yes | Site monitors only. Path patterns a page must match to be kept. Empty keeps every path. |
| `exclude_paths` | array of string | yes | Site monitors only. Path patterns that drop a page. A page that matches one is dropped even when it matches `include_paths`. The start URL is exempt from both lists. |
| `max_credits_per_run` | integer \| null | yes | Site monitors only. A run stops fetching when the next fetch would exceed this many credits, discovery included. A fetch that costs more than expected can overrun it by about one fetch. Null for no cap. |
| `pages_tracked` | integer \| null | yes | Site monitors only. Pages the monitor currently tracks, not counting removed ones. Null for page monitors. |
| `last_run` |  | yes | Site monitors only. Counts of the most recent run. Null until a run has finished, and for page monitors. |

#### 401

Missing, invalid, revoked or expired key. Not retryable with the same key.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 403

The key lacks the scope this route requires (`ERR::AUTH::INSUFFICIENT_SCOPE`), or the action is not permitted.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 404

No such resource for this key's organization.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

#### 500

Internal error. Retryable when `retryable` is true.

Headers: `X-Request-Id`.

`application/problem+json` (`Problem` schema).

Full OpenAPI spec: https://docs.spicrawl.com/openapi.yaml
