> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uptimeio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Monitor Statistics

> Retrieve uptime, response time and check counts for one monitor

## Overview

Return availability and performance statistics for a single monitor over the last 7, 30 or 90 days.

```
GET https://api.uptimeio.com/api/monitors/{id}/stats
```

## Authentication

| Header | Required | Description |
| - | - | - |
| `X-API-Key` | Yes (or a Bearer token) | Any API key, including read-only keys. See [Authentication](/api-reference/authentication). |
| `X-Project-ID` | No | Project that contains the monitor. Defaults to your organization's default project. |

## Path and query parameters

| Parameter | In | Type | Default | Description |
| - | - | - | - | - |
| `id` | path | UUID | required | Monitor ID. |
| `period` | query | enum | `30d` | `7d`, `30d` or `90d`. Any other value returns `INVALID_PERIOD`. |

## Response

### 200 OK

```json theme={null}
{
  "success": true,
  "data": {
    "uptime_percentage": 99.95,
    "avg_response_time": 184.2,
    "total_checks": 43200,
    "failed_checks": 0,
    "last_check_at": 1767090000000,
    "last_failure_at": 1766900000000,
    "last_success_at": 1767090000000,
    "runtime_status": "up"
  }
}
```

| Field | Type | Description |
| - | - | - |
| `uptime_percentage` | number | Availability over the period, 0-100, weighted by how long the monitor was actually in each state. |
| `avg_response_time` | number | Average response time in milliseconds. |
| `total_checks` | integer | Checks recorded in the period. |
| `failed_checks` | integer | Failed-check counter. It may be reported as `0`; rely on `uptime_percentage` and `last_failure_at` for availability. |
| `last_check_at` | integer \| null | Time of the latest check, Unix milliseconds. |
| `last_success_at` | integer \| null | Time of the latest successful check, Unix milliseconds. |
| `last_failure_at` | integer \| null | Time of the latest failed check, Unix milliseconds. |
| `runtime_status` | enum | The monitor's **current** health: `up`, `down`, `degraded` or `unknown`. It reflects open incidents and the latest result, not the period average. |
| `current_incident` | object \| null | Optional. When present: `id`, `started_at`, `downtime_minutes`, `status` (`open` or `acknowledged`), `severity` (`critical`, `major`, `minor`, `warning`). |

## Errors

| Code | Status | Meaning |
| - | - | - |
| `INVALID_PERIOD` | 400 | `period` is not `7d`, `30d` or `90d`. |
| `AUTHENTICATION_REQUIRED` / `MISSING_AUTH` / `INVALID_API_KEY` | 401 | Missing or invalid credentials. |
| `INSUFFICIENT_PERMISSIONS` | 403 | Your role cannot view monitors. |
| `MONITOR_NOT_FOUND` | 404 | No monitor with this ID in the project. |
| `STATS_NOT_FOUND` | 404 | No statistics are available for the monitor. |
| `STATS_FETCH_FAILED` | 500 | The statistics could not be computed. |

## Examples

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.uptimeio.com/api/monitors/MONITOR_ID/stats?period=7d" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const res = await fetch(
    'https://api.uptimeio.com/api/monitors/MONITOR_ID/stats?period=7d',
    { headers: { 'X-API-Key': process.env.UPTIMEIO_API_KEY } },
  );
  const { data } = await res.json();
  console.log(`${data.uptime_percentage}% uptime`);
  ```

  ```python Python theme={null}
  import os
  import requests

  res = requests.get(
      "https://api.uptimeio.com/api/monitors/MONITOR_ID/stats",
      headers={"X-API-Key": os.environ["UPTIMEIO_API_KEY"]},
      params={"period": "7d"},
  )
  print(res.json()["data"]["uptime_percentage"])
  ```
</CodeGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.