# モニター API リファレンス

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

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

## フィールドに指定できる値

**モニターの地域**

| 値 | 説明 |
| ---------------- | ----------------- |
| `US_EAST_1` | 北バージニア |
| `CA_CENTRAL_1` | カナダ (モントリオール) |
| `EU_CENTRAL_1` | フランクフルト |
| `AP_NORTHEAST_1` | 東京 |

**モニターのアラートの種類**

| 値 | 説明 |
| ----------------- | --------------------- |
| `INCIDENT` | インシデントのアラート |
| `EMAIL` | メールのアラート |
| `SMS` | SMS のアラート |
| `SLACK` | Slack のアラート |
| `DISCORD` | Discord のアラート |
| `MICROSOFT_TEAMS` | Microsoft Teams のアラート |
| `PHONE_CALL` | 電話のアラート |
| `WEBHOOK` | Webhook のアラート |
| `GOOGLE_CHAT` | Google Chat のアラート |
| `WHATSAPP` | WhatsApp のアラート |

**モニターのステータス**

| 値 | 説明 |
| ---------- | --------------------------------- |
| `UP` | モニターは正常に動作しています |
| `DOWN` | モニターが失敗しました |
| `DEGRADED` | モニターに問題が発生しています |
| `UNKNOWN` | モニターの状態を判定できません |

## モニターを取得する

このエンドポイントを使うと、既存のモニターの一覧を検索したり、たどったりできます。

**エンドポイント:**

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

**クエリパラメーター**

| パラメーター | 型 | 既定値 | 説明 |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `page` | `number` | `1` | 取得するページ番号。 |
| `limit` | `number` | `100` | 1 ページあたりのモニターの件数。 |
| `search` | `string` | `null` | 結果を絞り込むための検索語。 |
| `status` | `enum` | `null` | ステータスによる絞り込み _('UP'、'DOWN'、'UNKNOWN'、'DEGRADED')_。 |

**リクエストの例**

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

**レスポンスの例**

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

## モニターを作成する

**エンドポイント:**

```bash
POST /monitors
```

**リクエストの例**

```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
  }
}
```

**レスポンスの例**

```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"
}
```

## モニターを更新する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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"
}
```

## モニターを削除する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

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

## モニターのログを取得する

**エンドポイント:**

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

# クエリパラメーター

| パラメーター | 型 | 既定値 | 説明 |
| ---------------------- | --------------------------------------- | --------------- | --------------------------------------------------------------------------------------- |
| `limit` | `number` | 100 | 1 ページあたりの件数。1000 を超えられません。 |
| `page` | `number` | 1 | 取得するページ番号。 |
| `monitorId` | `string` | - | モニターの ID。 |
| `location` | `string` | `null` | モニターの地域。 |
| `createdAt` | `string` \| `object` \| `number` | `null` | 作成日時。文字列、数値、または `gte` と `lte` を持つオブジェクトを指定できます。 |
| `isSuccessful` | `boolean` | `null` | チェックが成功したかどうか。 |
| `isSSLCheck` | `boolean` | `null` | チェックが SSL のチェックかどうか。 |
| `httpStatusCode` | `string` | `null` | レスポンスの HTTP ステータスコード。 |
| `status` | `('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')` | `null` | モニターのステータス。 |
| `dnsTime` | `string` \| `number` \| `object` | `null` | DNS の名前解決にかかった時間。 |
| `tcpTime` | `string` \| `number` \| `object` | `null` | TCP の接続にかかった時間。 |
| `tlsTime` | `string` \| `number` \| `object` | `null` | TLS のハンドシェイクにかかった時間。 |
| `firstByteTime` | `string` \| `number` \| `object` | `null` | 最初の 1 バイトを受信するまでにかかった時間。 |
| `downloadTime` | `string` \| `number` \| `object` | `null` | ダウンロードにかかった時間。 |
| `responseTime` | `string` \| `number` \| `object` | `null` | 応答時間の合計。 |
| `performanceTime` | `string` \| `number` \| `object` | `null` | パフォーマンスの時間。 |
| `accessabilityScore` | `string` \| `number` \| `object` | `null` | アクセシビリティのスコア。 |
| `seoScore` | `string` \| `number` \| `object` | `null` | SEO のスコア。 |
| `bestPracticesScore` | `string` \| `number` \| `object` | `null` | ベストプラクティスのスコア。 |
| `successfulAssertions` | `string` \| `number` \| `object` | `null` | 成功したアサーションの数。 |
| `sort` | `string` | 時系列順 | 並べ替えに使うフィールド。 |

**リクエストの例**

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

**レスポンスの例**

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

## ID を指定してモニターのチェックを実行する

**エンドポイント:**

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

**クエリパラメーター**

| パラメーター | 型 | 既定値 | 説明 |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location` | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | - | モニターの地域。指定された値のいずれかである必要があります。 |
| `retry` | `boolean` | `false` | 処理を再試行するかどうかを指定します。任意。 |
| `monitorLogId` | `string` | `null` | モニターのログの一意な識別子。任意。 |

**リクエストの例**

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

**レスポンスの例**

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

## モニターのアラートを作成する

**エンドポイント:**

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

**リクエストの例**

```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"
}
```

**レスポンスの例**

```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"
}
```

## モニターのアラートを更新する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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."
}
```

## モニターのアラートを取得する

**エンドポイント:**

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

**クエリパラメーター**

| パラメーター | 型 | 既定値 | 説明 |
| --------- | -------- | ------------- | ----------------------------- |
| `limit` | `number` | 100 | 1 ページあたりの件数。 |
| `page` | `number` | 1 | 取得するページ番号。 |

**リクエストの例**

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

**レスポンスの例**

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

## モニターのアラートを削除する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

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

## モニターのグループを作成する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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."
}
```

## モニターのグループを更新する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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."
}
```

## モニターのグループを削除する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

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

## グループにモニターを追加する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

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

## モニターのグループのチェックを実行する

**エンドポイント:**

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

**クエリパラメーター**

| パラメーター | 型 | 既定値 | 説明 |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location` | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | - | モニターの地域。指定された値のいずれかである必要があります。 |
| `retry` | `boolean` | `false` | 処理を再試行するかどうかを指定します。任意。 |
| `monitorLogId` | `string` | `null` | モニターのログの一意な識別子。任意。 |

**リクエストの例**

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

**レスポンスの例**

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

## cron モニター

cron モニターは、HTTP の ping を使ってスケジュール実行のジョブを追跡します。製品側の設定やダッシュボードでの使い方は、[cron 監視](https://instatus.com/help/ja/monitoring/cron)を参照してください。

### フィールドに指定できる値

**cron モニターのステータス**

| 値 | 説明 |
| ---------- | --------------------------------- |
| `UP` | モニターは正常に動作しています |
| `DOWN` | モニターが失敗しました |
| `DEGRADED` | モニターに問題が発生しています |
| `UNKNOWN` | モニターの状態を判定できません |

**cron モニターの状態**

| 値 | 説明 |
| -------- | ------------------------------------ |
| `ACTIVE` | モニターが有効でチェックされています |
| `PAUSED` | モニターのチェックが一時停止されています |
| `MUTED` | モニターがミュートされています (通知なし) |

**cron モニターのログのステータス**

| 値 | 説明 |
| --------- | ------------------------------------------------ |
| `SUCCESS` | ジョブが正常に完了しました |
| `FAILURE` | ジョブが明示的に失敗を報告しました |
| `MISSED` | ジョブが想定した時間内に ping を送りませんでした |
| `LATE` | ジョブが周期を過ぎてから、猶予時間内に ping を送りました |
| `STARTED` | ジョブが開始を報告しました (実行時間の計測用) |

**周期と猶予時間**

`period` と `grace` はどちらも**秒**で指定します。`period` はジョブを実行する間隔、`grace` はモニターが障害とマークされるまでに追加で許容する時間です。

### cron モニターを取得する

**エンドポイント:**

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

**クエリパラメーター**

| パラメーター | 型 | 既定値 | 説明 |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `limit` | `number` | `100` | 1 ページあたりの cron モニターの件数。最大 100 件です。 |
| `page` | `number` | `1` | ページ番号。 |
| `search` | `string` | `null` | 名前で結果を絞り込むための検索語。 |
| `status` | `enum` | `null` | ステータスによる絞り込み _('UP'、'DOWN'、'UNKNOWN'、'DEGRADED')_。 |

**リクエストの例**

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

**レスポンスの例**

```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
}
```

### cron モニターを作成する

**エンドポイント:**

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

**リクエストの例**

```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
  }
}
```

**レスポンスの例**

```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."
}
```

レスポンスには `slug` が含まれます。これを使って、ジョブ用の ping URL を組み立てます。最初の ping が成功すると、バックグラウンドのチェックジョブが予約されます。

### cron モニターを更新する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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."
}
```

### cron モニターを削除する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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."
}
```

### cron モニターのログを取得する

**エンドポイント:**

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

**クエリパラメーター**

| パラメーター | 型 | 既定値 | 説明 |
| ------------ | -------- | ------------- | -------------------------------------------------------- |
| `limit` | `number` | `100` | 1 ページあたりのログの件数。最大 127 件です。 |
| `page` | `number` | `1` | ページ番号。最大 1000 です。 |
| `startDate` | `string` | 1 年前 | ログの期間の開始日 (ISO 8601)。 |
| `endDate` | `string` | 現在 | ログの期間の終了日 (ISO 8601)。 |
| `importance` | `enum` | `null` | 重要度でログを絞り込みます _('all'、'important')_。 |

**リクエストの例**

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

**レスポンスの例**

```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
}
```

### cron モニターのサマリーを取得する

**エンドポイント:**

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

**リクエストの例**

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

**レスポンスの例**

```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 のエンドポイント

これらのエンドポイントに認証は**不要**です。モニターの `slug` がシークレットの役割を果たします。

API のベース URL、または cron 専用のホストのどちらからでも ping できます。

- **成功:** `https://cron.instatus.com/{slug}` または `GET` / `POST` / `HEAD` `/monitors/cron/{slug}`
- **失敗:** `https://cron.instatus.com/{slug}/fail` または `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/fail`
- **開始:** `https://cron.instatus.com/{slug}/start` または `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/start`

ジョブが予定どおり完了するたびに、成功の ping を送ります。実行時間を記録したい場合は、ジョブの実行前に開始の ping を送り、終了時に成功または失敗の ping を送ります。

**成功の ping の例**

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

**レスポンスの例**

```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"
}
```

slug が正しくない場合、レスポンスは次のようになります。

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