# API-Referenz für Monitore

Source: https://instatus.com/help/de/api/monitors

- [Monitors](https://instatus.com/help/de/api/monitors#get-monitors): Check the uptime of your websites, APIs, and services
- [Cron Monitors](https://instatus.com/help/de/api/monitors#cron-monitors): Monitor your scheduled jobs via HTTP pings

## Mögliche Werte für Felder

**Monitorstandort**

| Wert             | Beschreibung      |
| ---------------- | ----------------- |
| `US_EAST_1`      | Nord-Virginia     |
| `CA_CENTRAL_1`   | Kanada (Montreal) |
| `EU_CENTRAL_1`   | Frankfurt         |
| `AP_NORTHEAST_1` | Tokio             |

**Monitor-Alarmtypen**

| Wert              | Beschreibung          |
| ----------------- | --------------------- |
| `INCIDENT`        | Vorfallsalarm         |
| `EMAIL`           | E-Mail-Alarm          |
| `SMS`             | SMS-Alarm             |
| `SLACK`           | Slack-Alarm           |
| `DISCORD`         | Discord-Alarm         |
| `MICROSOFT_TEAMS` | Microsoft-Teams-Alarm |
| `PHONE_CALL`      | Telefonanruf-Alarm    |
| `WEBHOOK`         | Webhook-Alarm         |
| `GOOGLE_CHAT`     | Google-Chat-Alarm     |
| `WHATSAPP`        | WhatsApp-Alarm        |

**Monitorstatus**

| Wert       | Beschreibung                          |
| ---------- | --------------------------------- |
| `UP`       | Monitor läuft normal                  |
| `DOWN`     | Monitor ist ausgefallen               |
| `DEGRADED` | Monitor hat Probleme                  |
| `UNKNOWN`  | Monitorzustand nicht bestimmbar       |

## Monitore abrufen

Über diesen Endpunkt finden und durchblättern Sie eine Liste aller vorhandenen Monitore.

**Endpunkt:**

```bash
GET /:page_id/monitors
```

**Query-Parameter**

| Parameter | Typ      | Standardwert  | Beschreibung                                           |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `page`    | `number` | `1`           | Die abzurufende Seitennummer.                          |
| `limit`   | `number` | `100`         | Anzahl der Monitore pro Seite.                         |
| `search`  | `string` | `null`        | Suchbegriff zum Filtern der Ergebnisse.                |
| `status`  | `enum`   | `null`        | Statusfilter _('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')_.  |

**Beispielanfrage**

```bash
GET /1/monitors?limit=3&page=2&status=DOWN
```

**Beispielantwort**

```json
{
  "monitors": [{ "...": "monitor objects" }],
  "total": 10,
  "page": 3,
  "totalPages": 5,
  "limit": 2
}
```

## Einen Monitor erstellen

**Endpunkt:**

```bash
POST /monitors
```

**Beispielanfrage**

```json
{
  "pageId": "page123",
  "url": "https://example.com",
  "httpMethod": "GET",
  "body": null,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer token"
  },
  "queryParams": {
    "search": "test",
    "limit": "10"
  },
  "basicAuth": {
    "username": "user",
    "password": "password"
  },
  "type": "HTTP",
  "assertions": [
    {
      "type": "STATUSCODE",
      "comparison": "EQUALS",
      "selector": null,
      "target": "200"
    }
  ],
  "alerts": ["alert-id-1", "alert-id-2"],
  "name": "Example Monitor",
  "locations": "US_EAST_1",
  "checksInterval": 300,
  "createComponent": true,
  "createMetric": true,
  "onFail": {
    "createIncident": true,
    "createOutageDuration": true,
    "publishIncident": true,
    "notifySubscribers": true
  },
  "onRecover": {
    "resolveIncident": true,
    "resolveOutageDuration": true,
    "publishIncident": true,
    "notifySubscribers": true
  }
}
```

**Beispielantwort**

```json
{
  "monitor": {
    "pageId": "page123",
    "url": "https://example.com",
    "httpMethod": "GET",
    "body": null,
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
    },
    "queryParams": {
      "search": "test",
      "limit": "10"
    },
    "basicAuth": {
      "username": "user",
      "password": "password"
    },
    "type": "HTTP",
    "assertions": [
      {
        "id": "assertion1",
        "type": "STATUSCODE",
        "comparison": "EQUALS",
        "selector": null,
        "target": "200"
      }
    ],
    "alerts": ["alert1", "alert2"],
    "name": "Example Monitor",
    "locations": "US_EAST_1",
    "checksInterval": 300,
    "createComponent": true,
    "createMetric": true,
    "onFail": {
      "createIncident": true,
      "createOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "onRecover": {
      "resolveIncident": true,
      "resolveOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z"
  },
  "message": "Monitor created successfully"
}
```

## Einen Monitor aktualisieren

**Endpunkt:**

```bash
PUT /monitors/:id
```

**Beispielanfrage**

```json
{
  "url": "https://updated.com",
  "name": "Updated Monitor Name"
}
```

**Beispielantwort**

```json
{
  "monitor": {
    "pageId": "page123",
    "url": "https://updated.com",
    "httpMethod": "GET",
    "body": null,
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
    },
    "queryParams": {
      "search": "test",
      "limit": "10"
    },
    "basicAuth": {
      "username": "user",
      "password": "password"
    },
    "type": "HTTP",
    "assertions": [
      {
        "id": "assertion1",
        "type": "STATUSCODE",
        "comparison": "EQUALS",
        "selector": null,
        "value": "200"
      }
    ],
    "alerts": ["alert1", "alert2"],
    "name": "Updated Monitor Name",
    "locations": "US_EAST_1",
    "checksInterval": 300,
    "createComponent": true,
    "createMetric": true,
    "onFail": {
      "createIncident": true,
      "createOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "onRecover": {
      "resolveIncident": true,
      "resolveOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z"
  },
  "message": "Monitor updated successfully"
}
```

## Einen Monitor löschen

**Endpunkt:**

```bash
DELETE /monitors/:id
```

**Beispielanfrage**

```bash
DELETE /monitors/monitor-id-1
```

**Beispielantwort**

```json
{
  "message": "Monitor deleted successfully."
}
```

## Monitor-Logs abrufen

**Endpunkt:**

```bash
GET /monitors/:id/logs
```

# Query-Parameter

| Parameter              | Typ                                     | Standardwert    | Beschreibung                                                                            |
| ---------------------- | --------------------------------------- | --------------- | --------------------------------------------------------------------------------------- |
| `limit`                | `number`                                | 100             | Anzahl der Einträge pro Seite. Darf 1000 nicht überschreiten.                           |
| `page`                 | `number`                                | 1               | Die abzurufende Seitennummer.                                                           |
| `monitorId`            | `string`                                | -               | Die ID des Monitors.                                                                    |
| `location`             | `string`                                | `null`          | Der Standort des Monitors.                                                              |
| `createdAt`            | `string` \| `object` \| `number`        | `null`          | Das Erstellungsdatum. String, Zahl oder Objekt mit den Feldern `gte` und `lte`.         |
| `isSuccessful`         | `boolean`                               | `null`          | Ob die Prüfung erfolgreich war.                                                         |
| `isSSLCheck`           | `boolean`                               | `null`          | Ob die Prüfung eine SSL-Prüfung ist.                                                    |
| `httpStatusCode`       | `string`                                | `null`          | Der HTTP-Statuscode der Antwort.                                                        |
| `status`               | `('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')` | `null`          | Der Status des Monitors.                                                                |
| `dnsTime`              | `string` \| `number` \| `object`        | `null`          | Dauer der DNS-Auflösung.                                                                |
| `tcpTime`              | `string` \| `number` \| `object`        | `null`          | Dauer des TCP-Verbindungsaufbaus.                                                       |
| `tlsTime`              | `string` \| `number` \| `object`        | `null`          | Dauer des TLS-Handshakes.                                                               |
| `firstByteTime`        | `string` \| `number` \| `object`        | `null`          | Dauer bis zum Empfang des ersten Bytes.                                                 |
| `downloadTime`         | `string` \| `number` \| `object`        | `null`          | Dauer des Downloads.                                                                    |
| `responseTime`         | `string` \| `number` \| `object`        | `null`          | Gesamte Antwortzeit.                                                                    |
| `performanceTime`      | `string` \| `number` \| `object`        | `null`          | Performance-Zeit.                                                                       |
| `accessabilityScore`   | `string` \| `number` \| `object`        | `null`          | Barrierefreiheits-Score.                                                                |
| `seoScore`             | `string` \| `number` \| `object`        | `null`          | SEO-Score.                                                                              |
| `bestPracticesScore`   | `string` \| `number` \| `object`        | `null`          | Best-Practices-Score.                                                                   |
| `successfulAssertions` | `string` \| `number` \| `object`        | `null`          | Anzahl erfolgreicher Prüfungen.                                                         |
| `sort`                 | `string`                                | chronologisch   | Feld, nach dem sortiert wird.                                                           |

**Beispielanfrage**

```bash
GET /monitors/monitor-id-1/logs?limit=100&page=1
```

**Beispielantwort**

```json
{
  "monitorLogs": [
    // {monitor log object},
    // {monitor log object 2}
  ],
  "total": 478,
  "page": 1,
  "totalPages": 5,
  "limit": 100
}
```

## Monitorprüfung per ID ausführen

**Endpunkt:**

```bash
GET /monitors/:id/run
```

**Query-Parameter**

| Parameter      | Typ                                                                               | Standardwert  | Beschreibung                                                      |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location`     | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | -             | Der Standort des Monitors. Muss einer der genannten Werte sein.   |
| `retry`        | `boolean`                                                                         | `false`       | Gibt an, ob der Vorgang wiederholt werden soll. Optional.         |
| `monitorLogId` | `string`                                                                          | `null`        | Die eindeutige Kennung des Monitor-Logs. Optional.                |

**Beispielanfrage**

```bash
GET /monitors/monitor-id-1/run?monitorId=abc123&location=US_EAST_1&retry=true&monitorLogId=log456
```

**Beispielantwort**

```json
{
  "status": "success",
  "message": "Monitor check run successfully."
}
```

## Monitor-Alarm erstellen

**Endpunkt:**

```bash
POST /monitor-alerts
```

**Beispielanfrage**

```json
{
  "type": "EMAIL",
  "pageId": "page123",
  "recipient": "user@example.com",
  "recipientWorkspace": "workspace123",
  "whenFails": true,
  "whenRecovers": true,
  "whenDegrades": false,
  "whenSslExpires": true,
  "sslExpiresInDays": 30,
  "monitors": ["monitor1", "monitor2"],
  "metadata": "Additional information about the alert"
}
```

**Beispielantwort**

```json
{
  "monitor": {
    "id": "alert123",
    "siteId": "site123",
    "type": "EMAIL",
    "recipient": "user@example.com",
    "whenFails": true,
    "whenRecovers": true,
    "whenDegrades": false,
    "whenSslExpires": true,
    "sslExpiresInDays": 30,
    "monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z",
    "metadata": "Additional information about the alert"
  },
  "message": "Monitor Alert created successfully"
}
```

## Monitor-Alarm aktualisieren

**Endpunkt:**

```bash
PUT /monitor-alerts/:id
```

**Beispielanfrage**

```json
{
  "type": "EMAIL",
  "monitors": ["monitor-1-id", "monitor-2-id", "monitor-3-id"]
}
```

**Beispielantwort**

```json
{
  "monitor": {
    "type": "EMAIL",
    "pageId": "page123",
    "recipient": "user@example.com",
    "recipientWorkspace": "workspace123",
    "whenFails": true,
    "whenRecovers": true,
    "whenDegrades": false,
    "whenSslExpires": true,
    "sslExpiresInDays": 30,
    "monitors": ["monitor-1-id", "monitor-2-id"],
    "metadata": "Additional information about the alert"
  },
  "message": "Monitor alert updated successfully."
}
```

## Monitor-Alarme abrufen

**Endpunkt:**

```bash
GET /:page_id/monitor-alerts
```

**Query-Parameter**

| Parameter | Typ      | Standardwert  | Beschreibung                  |
| --------- | -------- | ------------- | ----------------------------- |
| `limit`   | `number` | 100           | Anzahl der Einträge pro Seite.|
| `page`    | `number` | 1             | Die abzurufende Seitennummer. |

**Beispielanfrage**

```bash
GET /1/monitor-alerts?limit=2&page=3
```

**Beispielantwort**

```json
{
  "monitorAlerts": [
    {...monitor alert objects}
  ],
  "total": 27,
  "page": 3,
  "totalPages": 14,
  "limit": 2
}
```

## Monitor-Alarm löschen

**Endpunkt:**

```bash
DELETE /monitor-alerts/:id
```

**Beispielanfrage**

```bash
DELETE /monitor-alerts/alert-id-1
```

**Beispielantwort**

```json
{
  "message": "Monitor alert deleted successfully."
}
```

## Monitorgruppe erstellen

**Endpunkt:**

```bash
POST /monitors-groups
```

**Beispielanfrage**

```json
{
  "pageId": "page123",
  "name": "Example Name",
  "childId": "child456"
}
```

**Beispielantwort**

```json
{
  "monitor": {
    "id": "group123",
    "name": "Example Name",
    "siteId": "site123",
    "collapsed": false,
    "monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
    "groupId": "parentGroup123",
    "children": [
      { "id": "childGroup1", "name": "Child Group 1" },
      { "id": "childGroup2", "name": "Child Group 2" }
    ],
    "order": 1,
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z",
    "parents": ["parent1", "parent2"],
    "componentId": "component123"
  },
  "message": "Monitor group created successfully."
}
```

## Monitorgruppe aktualisieren

**Endpunkt:**

```bash
PUT /monitors-groups/:id
```

**Beispielanfrage**

```json
{
  "name": "Updated Monitor Group Name"
}
```

**Beispielantwort**

```json
{
  "monitor": {
    "id": "group123",
    "name": "Updated Monitor Group Name",
    "siteId": "site123",
    "collapsed": true,
    "monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
    "groupId": "parentGroup123",
    "children": [
      { "id": "childGroup1", "name": "Child Group 1" },
      { "id": "childGroup2", "name": "Child Group 2" }
    ],
    "order": 1,
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z",
    "parents": ["parent1", "parent2"],
    "componentId": "component123"
  },
  "message": "Monitor group updated successfully."
}
```

## Monitorgruppe löschen

**Endpunkt:**

```bash
DELETE /monitors-groups/:id
```

**Beispielanfrage**

```bash
DELETE /monitors-groups/group-id-1
```

**Beispielantwort**

```json
{
  "message": "Monitor group deleted successfully."
}
```

## Monitore zu einer Gruppe hinzufügen

**Endpunkt:**

```bash
POST /monitors-groups/:id/monitors
```

**Beispielanfrage**

```json
{
  "monitors": ["monitor1", "monitor2", "monitor3"]
}
```

**Beispielantwort**

```json
{
  "message": "Monitors added to the group successfully."
}
```

## Prüfung einer Monitorgruppe ausführen

**Endpunkt:**

```bash
GET /monitors-groups/:id/run
```

**Query-Parameter**

| Parameter      | Typ                                                                               | Standardwert  | Beschreibung                                                      |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location`     | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | -             | Der Standort des Monitors. Muss einer der genannten Werte sein.   |
| `retry`        | `boolean`                                                                         | `false`       | Gibt an, ob der Vorgang wiederholt werden soll. Optional.         |
| `monitorLogId` | `string`                                                                          | `null`        | Die eindeutige Kennung des Monitor-Logs. Optional.                |

**Beispielanfrage**

```bash
GET /monitors-groups/group-id-1/run
```

**Beispielantwort**

```json
{
  "result": "OK",
  "monitorLogId": "monitor-log-id-1"
}
```

## Cron-Monitore

Cron-Monitore verfolgen geplante Jobs über HTTP-Pings. Zur Einrichtung im Produkt und zur Nutzung im Dashboard siehe [Cron-Monitoring](https://instatus.com/help/de/monitoring/cron).

### Mögliche Werte für Felder

**Status des Cron-Monitors**

| Wert       | Beschreibung                          |
| ---------- | --------------------------------- |
| `UP`       | Monitor läuft normal                  |
| `DOWN`     | Monitor ist ausgefallen               |
| `DEGRADED` | Monitor hat Probleme                  |
| `UNKNOWN`  | Monitorzustand nicht bestimmbar       |

**Zustand des Cron-Monitors**

| Wert     | Beschreibung                         |
| -------- | ------------------------------------ |
| `ACTIVE` | Monitor wird aktiv geprüft           |
| `PAUSED` | Monitorprüfungen sind pausiert       |
| `MUTED`  | Monitor ist stummgeschaltet (keine Benachrichtigungen) |

**Log-Status des Cron-Monitors**

| Wert      | Beschreibung                                     |
| --------- | ------------------------------------------------ |
| `SUCCESS` | Job wurde erfolgreich abgeschlossen              |
| `FAILURE` | Job hat ausdrücklich einen Fehler gemeldet       |
| `MISSED`  | Job hat nicht im erwarteten Fenster gepingt      |
| `LATE`    | Job pingte nach dem Zeitraum, aber in der Karenzzeit |
| `STARTED` | Job hat seinen Start gemeldet (Ausführungszeit)  |

**Zeitraum und Karenzzeit**

`period` und `grace` werden beide in **Sekunden** angegeben. `period` gibt an, wie oft der Job laufen soll; `grace` ist die zusätzliche Zeit, bevor der Monitor als ausgefallen markiert wird.

### Cron-Monitore abrufen

**Endpunkt:**

```bash
GET /:page_id/monitors/cron
```

**Query-Parameter**

| Parameter | Typ      | Standardwert  | Beschreibung                                           |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `limit`   | `number` | `100`         | Anzahl der Cron-Monitore pro Seite. Maximal 100.       |
| `page`    | `number` | `1`           | Die Seitennummer.                                      |
| `search`  | `string` | `null`        | Suchbegriff zum Filtern der Ergebnisse nach Name.      |
| `status`  | `enum`   | `null`        | Statusfilter _('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')_.  |

**Beispielanfrage**

```bash
GET /page123/monitors/cron?limit=10&page=1&status=DOWN
```

**Beispielantwort**

```json
{
  "cronMonitors": [
    {
      "id": "cron-abc123",
      "name": "Daily backup",
      "slug": "my-page-x7k2m9n4p1q8w3e5",
      "period": 86400,
      "grace": 3600,
      "status": "UP",
      "state": "ACTIVE",
      "siteId": "page123",
      "order": 1,
      "groupId": null,
      "componentId": "component-id-1",
      "onFailCreateIncident": true,
      "onFailCreateOutageDuration": false,
      "onFailPublishIncident": true,
      "onFailNotifySubscribers": true,
      "onRecoverResolveIncident": true,
      "onRecoverResolveOutageDuration": false,
      "onRecoverPublishIncident": true,
      "onRecoverNotifySubscribers": true,
      "createTemplateId": null,
      "resolveTemplateId": null,
      "createdAt": "2024-01-15T08:00:00.000Z",
      "updatedAt": "2024-01-15T08:00:00.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "totalPages": 1,
  "limit": 10
}
```

### Einen Cron-Monitor erstellen

**Endpunkt:**

```bash
POST /monitors/cron
```

**Beispielanfrage**

```json
{
  "pageId": "page123",
  "name": "Daily backup",
  "period": 86400,
  "grace": 3600,
  "alerts": ["alert-id-1", "alert-id-2"],
  "createComponent": true,
  "onFail": {
    "createIncident": true,
    "createOutageDuration": false,
    "publishIncident": true,
    "notifySubscribers": true
  },
  "onRecover": {
    "resolveIncident": true,
    "resolveOutageDuration": false,
    "publishIncident": true,
    "notifySubscribers": true
  }
}
```

**Beispielantwort**

```json
{
  "cronMonitor": {
    "id": "cron-abc123",
    "name": "Daily backup",
    "slug": "my-page-x7k2m9n4p1q8w3e5",
    "period": 86400,
    "grace": 3600,
    "status": "UP",
    "state": "ACTIVE",
    "siteId": "page123",
    "order": 1,
    "groupId": null,
    "componentId": "component-id-1",
    "onFailCreateIncident": true,
    "onFailCreateOutageDuration": false,
    "onFailPublishIncident": true,
    "onFailNotifySubscribers": true,
    "onRecoverResolveIncident": true,
    "onRecoverResolveOutageDuration": false,
    "onRecoverPublishIncident": true,
    "onRecoverNotifySubscribers": true,
    "createTemplateId": null,
    "resolveTemplateId": null,
    "createdAt": "2024-01-15T08:00:00.000Z",
    "updatedAt": "2024-01-15T08:00:00.000Z"
  },
  "message": "Cron monitor created successfully."
}
```

Die Antwort enthält einen `slug`. Damit bauen Sie die Ping-URLs für Ihren Job. Der erste erfolgreiche Ping plant den Hintergrund-Prüfjob ein.

### Einen Cron-Monitor aktualisieren

**Endpunkt:**

```bash
PUT /monitors/cron/:id
```

**Beispielanfrage**

```json
{
  "name": "Daily backup (updated)",
  "period": 43200,
  "grace": 1800,
  "state": "PAUSED",
  "alerts": ["alert-id-1"],
  "onFail": {
    "notifySubscribers": false
  }
}
```

**Beispielantwort**

```json
{
  "cronMonitor": {
    "id": "cron-abc123",
    "name": "Daily backup (updated)",
    "slug": "my-page-x7k2m9n4p1q8w3e5",
    "period": 43200,
    "grace": 1800,
    "status": "UP",
    "state": "PAUSED",
    "siteId": "page123",
    "order": 1,
    "groupId": null,
    "componentId": "component-id-1",
    "onFailCreateIncident": true,
    "onFailCreateOutageDuration": false,
    "onFailPublishIncident": true,
    "onFailNotifySubscribers": false,
    "onRecoverResolveIncident": true,
    "onRecoverResolveOutageDuration": false,
    "onRecoverPublishIncident": true,
    "onRecoverNotifySubscribers": true,
    "createTemplateId": null,
    "resolveTemplateId": null,
    "alerts": [
      {
        "id": "alert-id-1",
        "type": "EMAIL",
        "recipient": "ops@example.com"
      }
    ],
    "createdAt": "2024-01-15T08:00:00.000Z",
    "updatedAt": "2024-01-16T10:30:00.000Z"
  },
  "message": "Cron monitor updated successfully."
}
```

### Einen Cron-Monitor löschen

**Endpunkt:**

```bash
DELETE /monitors/cron/:id
```

**Beispielanfrage**

```bash
DELETE /monitors/cron/cron-abc123
```

**Beispielantwort**

```json
{
  "cronMonitor": {
    "id": "cron-abc123",
    "name": "Daily backup",
    "slug": "my-page-x7k2m9n4p1q8w3e5",
    "period": 86400,
    "grace": 3600,
    "status": "UP",
    "state": "ACTIVE",
    "siteId": "page123",
    "order": 1,
    "groupId": null,
    "componentId": "component-id-1",
    "onFailCreateIncident": true,
    "onFailCreateOutageDuration": false,
    "onFailPublishIncident": true,
    "onFailNotifySubscribers": true,
    "onRecoverResolveIncident": true,
    "onRecoverResolveOutageDuration": false,
    "onRecoverPublishIncident": true,
    "onRecoverNotifySubscribers": true,
    "createTemplateId": null,
    "resolveTemplateId": null,
    "createdAt": "2024-01-15T08:00:00.000Z",
    "updatedAt": "2024-01-15T08:00:00.000Z"
  },
  "message": "Cron monitor deleted successfully."
}
```

### Logs eines Cron-Monitors abrufen

**Endpunkt:**

```bash
GET /monitors/cron/:id/logs
```

**Query-Parameter**

| Parameter    | Typ      | Standardwert  | Beschreibung                                             |
| ------------ | -------- | ------------- | -------------------------------------------------------- |
| `limit`      | `number` | `100`         | Anzahl der Logs pro Seite. Maximal 127.                  |
| `page`       | `number` | `1`           | Die Seitennummer. Maximal 1000.                          |
| `startDate`  | `string` | vor 1 Jahr    | ISO-8601-Startdatum für den Log-Zeitraum.                |
| `endDate`    | `string` | jetzt         | ISO-8601-Enddatum für den Log-Zeitraum.                  |
| `importance` | `enum`   | `null`        | Logs nach Wichtigkeit filtern _('all', 'important')_.    |

**Beispielanfrage**

```bash
GET /monitors/cron/cron-abc123/logs?limit=50&page=1&importance=important
```

**Beispielantwort**

```json
{
  "logs": [
    {
      "id": "log-xyz789",
      "monitorId": "cron-abc123",
      "status": "SUCCESS",
      "requestType": "GET",
      "agent": "curl/8.4.0",
      "ipAddress": "203.0.113.10",
      "createdAt": "2024-01-16T06:00:00.000Z",
      "startedAt": "2024-01-16T05:59:58.000Z"
    }
  ],
  "page": 1
}
```

### Zusammenfassung eines Cron-Monitors abrufen

**Endpunkt:**

```bash
GET /monitors/cron/:id/summary
```

**Beispielanfrage**

```bash
GET /monitors/cron/cron-abc123/summary
```

**Beispielantwort**

```json
{
  "summary": {
    "totalLogs": 120,
    "totalFailedLogs": 3,
    "availability": 97.5,
    "oneDayAvailability": 100,
    "previousDayAvailability": 100,
    "sevenDayAvailability": 98.2,
    "previousSevenDayAvailability": 96.1,
    "thirtyDayAvailability": 97.5,
    "previousThirtyDayAvailability": 95.8,
    "lastSuccess": "2024-01-16T06:00:00.000Z",
    "lastFailure": "2024-01-10T06:00:00.000Z",
    "lastStarted": null,
    "upSince": "2024-01-10T07:00:00.000Z",
    "downSince": null
  }
}
```

### Ping-Endpunkte

Diese Endpunkte erfordern **keine** Authentifizierung. Der `slug` des Monitors dient als Secret.

Sie können über die Basis-URL der API oder über den dedizierten Cron-Host pingen:

- **Erfolg:** `https://cron.instatus.com/{slug}` oder `GET` / `POST` / `HEAD` `/monitors/cron/{slug}`
- **Fehler:** `https://cron.instatus.com/{slug}/fail` oder `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/fail`
- **Start:** `https://cron.instatus.com/{slug}/start` oder `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/start`

Senden Sie jedes Mal einen Erfolgs-Ping, wenn Ihr Job planmäßig abschließt. Senden Sie vor dem Lauf einen Start-Ping und danach einen Erfolgs- oder Fehler-Ping, um die Ausführungszeit zu erfassen.

**Beispiel für einen Erfolgs-Ping**

```bash
curl https://cron.instatus.com/my-page-x7k2m9n4p1q8w3e5
```

**Beispielantwort**

```json
{
  "id": "log-xyz789",
  "monitorId": "cron-abc123",
  "status": "SUCCESS",
  "requestType": "GET",
  "agent": "curl/8.4.0",
  "ipAddress": "203.0.113.10",
  "createdAt": "2024-01-16T06:00:00.000Z"
}
```

Ist der Slug ungültig, lautet die Antwort:

```json
{
  "message": "Monitor not found"
}
```
