Availability API
The Availability API provides detailed availability metrics for monitors on your status page, including uptime percentage, MTBF (Mean Time Between Failures), and MTTR (Mean Time To Recovery).
Endpoint
GET https://statuspage.me/api/status-pages/{slug}/monitors/{monitorID}/availability
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
period | string | 30d | Time period: 24h, 7d, 30d, 90d, 1y |
Example Request
curl "https://statuspage.me/api/status-pages/your-slug/monitors/123/availability?period=30d"
Example Response
{
"monitor_id": 123,
"monitor_name": "API Server",
"period": "30d",
"availability": {
"uptime_percentage": 99.95,
"downtime_seconds": 1296,
"total_seconds": 2592000,
"mtbf_seconds": 518400,
"mttr_seconds": 432,
"incident_count": 5
},
"daily_breakdown": [
{
"date": "2025-12-09",
"uptime_percentage": 100,
"downtime_seconds": 0
},
{
"date": "2025-12-08",
"uptime_percentage": 99.5,
"downtime_seconds": 432
}
]
}
Response Fields
Main Fields
| Field | Type | Description |
|---|---|---|
monitor_id | integer | The monitor ID |
monitor_name | string | Human-readable monitor name |
period | string | Requested time period |
Availability Object
| Field | Type | Description |
|---|---|---|
uptime_percentage | float | Overall uptime as percentage (0-100) |
downtime_seconds | integer | Total downtime in seconds |
total_seconds | integer | Total period in seconds |
mtbf_seconds | integer | Mean Time Between Failures |
mttr_seconds | integer | Mean Time To Recovery |
incident_count | integer | Number of downtime incidents |
Daily Breakdown
Array of daily uptime data for charting.
Time Periods
| Period | Description |
|---|---|
24h | Last 24 hours |
7d | Last 7 days |
30d | Last 30 days (default) |
90d | Last 90 days |
1y | Last 365 days |
Understanding MTBF and MTTR
MTBF (Mean Time Between Failures)
Average time between the end of one outage and the start of the next.
Formula: Total Uptime / Number of Failures
Example: If your service had 5 outages over 30 days:
- MTBF = (30 days - total downtime) / 5 = ~6 days between failures
MTTR (Mean Time To Recovery)
Average time to recover from an outage.
Formula: Total Downtime / Number of Failures
Example: If total downtime was 2 hours across 5 incidents:
- MTTR = 2 hours / 5 = 24 minutes average recovery time
JavaScript Example
async function getAvailability(slug, monitorId, period = '30d') {
const url = `https://statuspage.me/api/status-pages/${slug}/monitors/${monitorId}/availability?period=${period}`;
const response = await fetch(url);
const data = await response.json();
console.log(`Uptime: ${data.availability.uptime_percentage}%`);
console.log(`MTBF: ${formatDuration(data.availability.mtbf_seconds)}`);
console.log(`MTTR: ${formatDuration(data.availability.mttr_seconds)}`);
// Chart daily breakdown
renderUptimeChart(data.daily_breakdown);
return data;
}
function formatDuration(seconds) {
if (seconds < 60) return `${seconds}s`;
if (seconds < 3600) return `${Math.round(seconds / 60)}m`;
if (seconds < 86400) return `${Math.round(seconds / 3600)}h`;
return `${Math.round(seconds / 86400)}d`;
}
Building an SLA Dashboard
async function buildSLADashboard(slug, monitors) {
const dashboard = document.getElementById('sla-dashboard');
for (const monitor of monitors) {
const data = await getAvailability(slug, monitor.id, '30d');
// Check against SLA target (e.g., 99.9%)
const slaTarget = 99.9;
const isMeetingSLA = data.availability.uptime_percentage >= slaTarget;
dashboard.innerHTML += `
<div class="sla-card ${isMeetingSLA ? 'green' : 'red'}">
<h3>${data.monitor_name}</h3>
<div class="uptime">${data.availability.uptime_percentage.toFixed(2)}%</div>
<div class="status">${isMeetingSLA ? '✓ Meeting SLA' : '✗ Below SLA'}</div>
<div class="mttr">Avg Recovery: ${formatDuration(data.availability.mttr_seconds)}</div>
</div>
`;
}
}
CORS Support
This endpoint supports CORS for browser-based requests. Include appropriate headers:
fetch(url, {
headers: {
'Accept': 'application/json'
}
})
Error Responses
| Status | Error | Cause |
|---|---|---|
| 404 | not found | Status page or monitor not found |
| 400 | invalid period | Unsupported time period |
| 403 | forbidden | Private page without auth token |
Private Status Pages
For private status pages, include the auth_token parameter:
curl "https://statuspage.me/api/status-pages/your-slug/monitors/123/availability?period=30d&auth_token=your-token"
Configure auth tokens in your status page settings.
What’s Next?
- Embed Status API for overall status
- Understanding uptime and SLA
- SLA Reports feature