DevOpsJanuary 31, 2026 8 min read

How to Monitor API Response Time and Performance

Learn how to set up API response time monitoring. Track latency, detect slow endpoints, and get alerts when API performance degrades.

WizStatus Team
Author

Slow APIs frustrate users and lose business. Here's how to set up comprehensive API response time monitoring to catch performance issues before they impact users.

Why Monitor API Response Time?

The Cost of Slow APIs

  • User experience - Slow APIs = slow apps = frustrated users
  • Conversion rates - Every 100ms delay reduces conversions by 1%
  • SEO impact - Core Web Vitals affected by slow backends
  • SLA compliance - Many contracts require <200ms response times
  • Revenue - Amazon found 100ms = 1% sales loss

What to Monitor

MetricDescriptionTarget
Response timeTime to first byte (TTFB)<200ms
P50 latencyMedian response time<100ms
P95 latency95th percentile<500ms
P99 latency99th percentile<1000ms
Error rateFailed requests<0.1%

External Monitoring Setup

HTTP Endpoint Monitoring

Set up checks from multiple locations:

# Example monitoring configuration
monitors:
  - name: "API - Get Users"
    url: "https://api.example.com/v1/users"
    method: GET
    headers:
      Authorization: "Bearer ${API_KEY}"
    interval: 60
    timeout: 10000
    locations:
      - us-east
      - eu-west
      - asia-pacific
    alerts:
      response_time: 500
      status_not: 200

Critical Endpoints to Monitor

Prioritize these:

  • Authentication endpoints
  • Core business logic APIs
  • Payment processing
  • Third-party integrations
  • Health check endpoints

Synthetic API Testing

Create Test Scenarios

// API test scenario
const testUserFlow = async () => {
  const start = Date.now();

  // Step 1: Authenticate
  const auth = await fetch('/api/auth/login', {
    method: 'POST',
    body: JSON.stringify({ email: 'test@example.com', password: 'test' })
  });

  // Step 2: Get user data
  const token = (await auth.json()).token;
  const user = await fetch('/api/user/profile', {
    headers: { Authorization: `Bearer ${token}` }
  });

  // Step 3: Update something
  await fetch('/api/user/settings', {
    method: 'PATCH',
    headers: { Authorization: `Bearer ${token}` },
    body: JSON.stringify({ theme: 'dark' })
  });

  return Date.now() - start;
};

Application-Level Monitoring

Instrument Your API

Node.js/Express:

const responseTime = require('response-time');

app.use(responseTime((req, res, time) => {
  // Log to your metrics system
  metrics.timing('api.response_time', time, {
    endpoint: req.route?.path,
    method: req.method,
    status: res.statusCode
  });
}));

Python/FastAPI:

import time
from fastapi import Request

@app.middleware("http")
async def add_response_time(request: Request, call_next):
    start = time.time()
    response = await call_next(request)
    duration = time.time() - start

    # Log metrics
    metrics.timing("api.response_time", duration * 1000, tags={
        "endpoint": request.url.path,
        "method": request.method,
        "status": response.status_code
    })

    response.headers["X-Response-Time"] = str(duration)
    return response

Setting Up Alerts

Alert Thresholds

SeverityConditionAction
WarningP95 > 500msSlack notification
HighP95 > 1000msSlack + Email
CriticalP95 > 2000msPagerDuty + SMS
EmergencyError rate > 5%All channels

Anomaly Detection

Don't just use static thresholds:

# Detect anomalies based on historical baseline
def is_anomaly(current_latency, historical_avg, historical_std):
    z_score = (current_latency - historical_avg) / historical_std
    return abs(z_score) > 3  # More than 3 standard deviations

Performance Debugging

Slow Endpoint Analysis

When response times spike:

  1. Check database queries - Slow queries often cause slow APIs
  2. Review recent deployments - New code might have issues
  3. Check external dependencies - Third-party APIs slowing you down
  4. Analyze traffic patterns - Load spike?
  5. Review resource usage - CPU/Memory constraints

Distributed Tracing

Use tracing to find bottlenecks:

// OpenTelemetry example
const span = tracer.startSpan('api.get_users');
try {
  span.setAttribute('user.count', users.length);
  return users;
} finally {
  span.end();
}

API Monitoring Dashboard

Key Visualizations

  1. Response time trend - Line chart over time
  2. Percentile distribution - P50, P95, P99 comparison
  3. Error rate - Separate line or bar chart
  4. Endpoint heatmap - Which endpoints are slowest?
  5. Geographic breakdown - Performance by region

Example Dashboard Layout

┌─────────────────────────────────────────┐
│         Response Time (24h)              │
│   [Line chart: P50, P95, P99]           │
├─────────────────────┬───────────────────┤
│   Error Rate        │   Requests/sec    │
│   [Gauge: 0.05%]    │   [Gauge: 1,234]  │
├─────────────────────┴───────────────────┤
│         Slowest Endpoints               │
│   1. POST /api/reports     892ms        │
│   2. GET /api/analytics    456ms        │
│   3. POST /api/uploads     234ms        │
└─────────────────────────────────────────┘

API Monitoring Checklist

  • Critical endpoints identified
  • External monitoring configured
  • Multiple monitoring locations
  • Response time thresholds set
  • Error rate alerts configured
  • Application instrumented
  • Dashboard created
  • Team notified of alerts
  • Runbook for incidents
  • Regular performance reviews
WizStatus monitors your API endpoints from 6+ global locations. Get instant alerts when response times exceed your thresholds, with detailed latency metrics and historical trends.

Related Articles

API Monitoring Best Practices: Complete 2026 Guide
Monitoring

API Monitoring Best Practices: Complete 2026 Guide

Master API monitoring with strategies for REST, GraphQL, gRPC, and WebSocket APIs. Ensure reliability and performance across your services.
18 min read
API Rate Limiting Monitoring: Protect Your Services
Monitoring

API Rate Limiting Monitoring: Protect Your Services

Monitor API rate limits to balance protection and availability. Track limit usage, violations, and impact on legitimate traffic.
9 min read
API Response Time Optimization: Performance Monitoring
Best Practices

API Response Time Optimization: Performance Monitoring

Optimize API response times with performance monitoring. Identify bottlenecks, set SLOs, and implement systematic improvement strategies.
13 min read

Start monitoring your infrastructure today

Put these insights into practice with WizStatus monitoring.

Try WizStatus Free