Logo
Status Page

Status Page Documentation

Common troubleshooting topics: Creating a status page, setting up a monitor, incident management, etc.

Availability API

StatusPage.me Dec 9, 2025 API

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

ParameterTypeDefaultDescription
periodstring30dTime 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

FieldTypeDescription
monitor_idintegerThe monitor ID
monitor_namestringHuman-readable monitor name
periodstringRequested time period

Availability Object

FieldTypeDescription
uptime_percentagefloatOverall uptime as percentage (0-100)
downtime_secondsintegerTotal downtime in seconds
total_secondsintegerTotal period in seconds
mtbf_secondsintegerMean Time Between Failures
mttr_secondsintegerMean Time To Recovery
incident_countintegerNumber of downtime incidents

Daily Breakdown

Array of daily uptime data for charting.


Time Periods

PeriodDescription
24hLast 24 hours
7dLast 7 days
30dLast 30 days (default)
90dLast 90 days
1yLast 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

StatusErrorCause
404not foundStatus page or monitor not found
400invalid periodUnsupported time period
403forbiddenPrivate 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?

Was this article helpful?

Share this article: