---
title: "SSH Monitor aktualisieren"
description: "Aktualisiert einen SSH Monitor und/oder ändert den Status."
---

`PATCH /api/ssh-monitors/:sshMonitorPublicId`

## Authentifizierung

Erfordert eine gültige Session.

- Header: `Authorization: Bearer <token>`

## Parameter

- `sshMonitorPublicId` (Pfad, erforderlich): Öffentliche UUID des SSH Monitors.

## Request Body

Alle Felder sind optional.

```json
{
 "name": "Bastion Host (Primary)",
 "hostname": "ssh.deinkunde.com",
 "port": 22,
 "status": "paused",
 "checkInterval": 60,
 "timeoutSeconds": 30,
 "allowedCheckCountryCodes": ["de", "es"],
 "sshConfig": {
  "username": "root",
  "privateKey": "-----BEGIN OPENSSH PRIVATE KEY-----..."
 }
}
```

### Hinweise

- `status` akzeptiert `active`, `maintenance`, `disabled`, `paused`, `inactive`.
 - `paused` und `inactive` werden zu `disabled` normalisiert.
- `allowedCheckCountryCodes` wird zu Uppercase ISO Codes normalisiert (z.B. `DE`, `US`). Leere Listen werden zu `null`.
- `checkMode` (string, optional): `protocol` (Standard) | `tcp`. Beim Wechsel zu `tcp` werden gespeicherte Zugangsdaten gelöscht: der Monitor führt nur eine reine TCP-Port-Erreichbarkeitsprüfung durch und `sshConfig` wird nicht gespeichert. Beim Zurückwechseln zu `protocol` läuft wieder die vollständige SSH-Login-/Handshake-Prüfung; neue Zugangsdaten über `sshConfig`/`config` mitschicken.
- SSH Config kann als `sshConfig` oder als `config` (Alias) übergeben werden. Wenn keiner der Keys vorhanden ist, bleibt die gespeicherte Config unverändert.
- Nutzer mit Rolle `readonly` können nur `status` ändern.

## cURL

```bash
curl -X PATCH "https://YOUR_DOMAIN/api/ssh-monitors/44444444-4444-4444-8444-444444444444" \
 -H "Authorization: Bearer $TOKEN" \
 -H "Content-Type: application/json" \
 -d '{
  "status": "disabled"
 }'
```

## Response

```json
{
 "id": 300,
 "organizationId": 1,
 "customerId": 10,
 "name": "Bastion Host (Primary)",
 "hostname": "ssh.deinkunde.com",
 "port": 22,
 "status": "disabled",
 "checkInterval": 60,
 "timeoutSeconds": 30,
 "notificationEmail": null,
 "notificationPhoneNumber": null,
 "lastCheckedAt": "2026-02-26T12:00:00.000Z",
 "createdAt": "2026-02-26T12:00:00.000Z",
 "updatedAt": "2026-02-26T12:01:00.000Z",
 "config": {
  "username": "root"
 },
 "sshConfig": {
  "username": "root"
 }
}
```

## Errors

- `400` SSH Monitor Public ID (UUID) erforderlich / ungültige Felder
- `401` Unauthorized
- `403` Forbidden (readonly darf nur `status` ändern; global supporters dürfen nicht updaten)
- `404` Not found

