# What the drift monitor last found for the domain, and what was done

> get connection monitor: reference page for this CustomDomain™ API operation in the monitor group. Covers parameters, request body, responses and error codes.

Source: https://docs.customdomain.ai/docs/api-reference/monitor/getConnectionMonitor

## `GET https://api.customdomain.ai/v1/connections/{id}/monitor`

Every live domain is checked against its records once an hour. This returns the last check (when, the result, the drifted records with expected and observed values), what was done about drift (put back automatically with the continuous access CustomDomain™ holds, or left for the tenant because the record was changed rather than removed, because there is no continuous access, or because automatic repair is not switched on), whether repairs are automatic for this domain and why, the records it is held to, and the drift history. An end user's widget token (scope `connect`) reads this only when it is bound to the domain and minted with the connection's own `end_user_ref`; use an API key otherwise.

Automatic repair runs only where the deployment switched it on (`MONITOR_AUTO_REPAIR`; `repair.paused` is true otherwise). It puts back only the record sets that disappeared, from the records CustomDomain™ wrote (a kept Domain Connect authorization re-applies its template, the only write it allows), and only for drift that began after a clean check. A record missing since monitoring started is left for the tenant. Repairs are paced and capped per hourly pass and per provider account, and after 3 repairs of a domain within 24 hours the monitor stops and reports `fix_failed`.

### Authentication

`widgetJWT`, `apiKey`

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes |  |

### Responses

| Status | Description |
| --- | --- |
| `200` | The monitoring state |
| `401` | Error envelope: {code, title, details}. |
| `403` | Error envelope: {code, title, details}. |
| `404` | Error envelope: {code, title, details}. |

### `200` response body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connection_id` | string | yes |  |
| `domain` | string | yes |  |
| `watched` | boolean | yes |  |
| `active` | boolean | yes |  |
| `every` | string | yes | How often the domain is checked (hour). |
| `last_checked_at` | string or null | yes |  |
| `next_check_at` | string | no |  |
| `result` | `ok`, `drift`, `inconclusive`, `unconfirmed`, `not_checked`, `not_watched` | yes | The last check. `drift` is only reported after a second, independent look at the zone's own nameservers confirmed it; `inconclusive` means the lookup did not answer and the previous finding stands; `unconfirmed` means the first lookup saw a change the zone's own nameservers could not be asked to confirm (see `reason`): earlier drift stands and nothing is restored. |
| `reason` | `ns_lookup_failed`, `timeout`, `all_servers_refused`, `no_server_answered`, `delegated`, `unsupported_type` | no | Set when `result` is `unconfirmed`, why the nameservers could not confirm. |
| `unconfirmed_checks` | integer | no | Set when `result` is `unconfirmed`, how many checks in a row. At 3 the workspace gets one inbox entry. |
| `drift_since` | string | no |  |
| `drift` | array of object | yes |  |
| `checked` | integer | yes | Records compared in the last check. |
| `error` | string | no |  |
| `action` | object | no | What was done about the drift: `auto_fixed` (put back), `fix_failed` (the repair failed, did not hold, or the records were put back 3 times in 24 hours and disappeared again) or `action_required` (left for the tenant). |
| `attention` | `action_required`, `fix_failed`, `drift` | no | Set while drift needs the tenant (action_required, fix_failed) or is being repaired (drift). |
| `repair` | object | yes |  |
| `alerts` | object | yes |  |
| `watching` | array of object | no | The records the domain is held to. |
| `history` | array of object | no |  |

The full specification is served at `GET https://api.customdomain.ai/v1/openapi.json`.
