# Replace a check

`PUT /api/v1/checks/{checkId}`

Replaces every setting of the check. To keep a stored header secret, send `{"kind": "secret", "secretId": …}` for it. Changing the target, the assertions, the timeout or the locations starts a new run of decisions: results of the old settings no longer count. With a token, a different `escalationPolicyId`, or none, also needs `alerts:write`.

Sign-in: a dashboard session, an API token with `checks:write` or the `monitorly` CLI's sign-in with `checks:write`.

Section: Checks. Operation id in openapi.json: `replace_check`.

## Parameters

| Name | In | Required | Type | Description |
|---|---|---|---|---|
| `checkId` | path | yes | string (uuid) | The check's id. |

## Request body

Required: yes.

`application/json`: CheckInput

| Field | Type | Required | Description |
|---|---|---|---|
| `downAfter` | integer | no |  |
| `escalationPolicyId` | string (uuid) \| null | no | The escalation policy of the check's incidents instead of the project's; absent or null: the project's. |
| `intervalSecs` | integer \| null | no | Required except for heartbeat checks, whose schedule is `kind.periodSecs`. |
| `kind` | KindDto | yes |  |
| `muted` | boolean | no |  |
| `name` | string | yes |  |
| `nodes` | array of string (uuid) | no | Nodes that run the check; none for heartbeat checks. |
| `quorum` | QuorumDto | no |  |
| `timeoutMs` | integer | no |  |
| `upAfter` | integer | no |  |

Example:

```json
{
  "intervalSecs": 60,
  "kind": {
    "assertions": [
      {
        "op": "eq",
        "target": "status",
        "value": 200
      },
      {
        "op": "equals",
        "path": "$.db",
        "target": "json",
        "value": "ok"
      }
    ],
    "maxRedirects": 0,
    "method": "GET",
    "type": "http",
    "url": "https://api.acme.io/healthz"
  },
  "name": "payments-health",
  "nodes": [
    "NODE_ID_HEL",
    "NODE_ID_FRA",
    "NODE_ID_AMS"
  ],
  "timeoutMs": 5000
}
```

## Responses

Errors are `application/problem+json` (`Problem`); branch on `type`.

### 200

The check as stored.

`application/json`: CheckSaved

| Field | Type | Required | Description |
|---|---|---|---|
| `check` | CheckView | yes |  |
| `pingUrl` | string \| null | no |  |

Example:

```json
{
  "check": {
    "createdAt": "2026-11-02T09:14:00Z",
    "downAfter": 2,
    "epoch": 2,
    "escalationPolicyId": null,
    "id": "CHECK_ID",
    "intervalSecs": 60,
    "kind": {
      "assertions": [
        {
          "op": "eq",
          "target": "status",
          "value": 200
        },
        {
          "op": "equals",
          "path": "$.db",
          "target": "json",
          "value": "ok"
        }
      ],
      "maxRedirects": 0,
      "method": "GET",
      "type": "http",
      "url": "https://api.acme.io/healthz"
    },
    "managedBy": "ui",
    "muted": false,
    "name": "payments-health",
    "nodes": [
      "NODE_ID_HEL",
      "NODE_ID_FRA",
      "NODE_ID_AMS"
    ],
    "paused": false,
    "projectId": "PROJECT_ID",
    "quorum": {
      "mode": "half"
    },
    "timeoutMs": 5000,
    "upAfter": 2,
    "updatedAt": "2026-11-27T15:00:00Z"
  }
}
```

### 400

Bad Request.

- `request.malformed`: the body or a parameter is not of the expected shape
- `auth.credentials_conflict`: the request carries both a session cookie and a token

### 401

Unauthorized.

- `auth.unauthenticated`, `auth.session_expired`: no session, or it ended
- `token.invalid`: the token is malformed, unknown, revoked or expired, or its creator left the workspace

### 403

Forbidden.

- `auth.forbidden`: your role is too low for this
- `token.scope_missing`: the token lacks the scope this needs; `detail` names it
- `request.origin_mismatch`, `request.header_required`: a changing request with a session comes from another site or lacks `X-Monitorly-Request: 1`

### 404

Not Found.

- `request.not_found`: it does not exist, or you cannot see it

### 413

Payload Too Large.

- `request.too_large`: the body is larger than 256 KiB

### 422

Unprocessable Entity.

- `field.required`, `field.too_long`, `field.invalid`: a field breaks a rule; `errors` points at it
- `quota.interval_too_short`: the interval (a heartbeat's period) is shorter than the plan allows; the shortest is in `params.min`. Existing checks keep theirs
- `check.node_unavailable`: node does not exist, is revoked, or is a private node of another workspace
- `check.secret_unknown`: `secretId` does not belong to this check
- `check.secret_host_changed`: the URL's scheme, host or port changed, or a stored secret moved to a header with another name, while the header keeps its stored secret: enter the value again
- `check.target_blocked`: the check runs on a platform node and its target is blocked on Monitorly Cloud; the pointer is on the target's field
- `check.server_taken`: another server check already watches this node (`/kind/nodeId`)
- `escalation_policy.unknown`: `escalationPolicyId` is not a policy of this workspace

### 429

Too Many Requests.

- `token.rate_limited`: more than 10 requests a second with this token
- `session.rate_limited`: more than 5 changes a second from your sessions

Schemas named above are listed with their fields in [the schema list](https://docs.monitorly.cloud/api/reference/schemas.md).
