Reliability

How to detect API failures before your customers do

When an API breaks, its consumers know within one request. Whether you know depends entirely on what you were watching. Here is what to watch.

API endpoint metrics trending toward failure

Detecting API failures before customers means monitoring each critical endpoint individually — availability, status codes, latency percentiles against a measured baseline, and timeout rate — and alerting on confirmed failures and significant deviations rather than waiting for a hard outage. APIs rarely die suddenly. They degrade: p95 latency climbs, a trickle of 5xx starts on one route, timeouts creep upward as a pool saturates. Each stage is measurable from the outside, which means the difference between finding out from your monitoring and finding out from an angry integration partner is mostly a matter of instrumentation choices.

Key takeaways
  • APIs fail per endpoint, so they must be monitored per endpoint — /health says nothing about /orders.
  • Most API outages are preceded by a measurable prodrome: latency climb, error trickle, rising timeouts.
  • Baselines make degradation visible: 3× this endpoint's normal p95 is a signal no fixed threshold would catch fairly.
  • Assert status and content, because the worst API failure is a 200 with a wrong body.
  • Your customers effectively monitor your API continuously — the question is whether your tooling is faster than their patience.

Why API failures are a special category

When a page breaks, one user has a bad session. When an API breaks, every consumer built on it breaks simultaneously — customer integrations, mobile apps, partner systems, your own frontend. The blast radius is multiplied by everything downstream, and so is the reputational cost: an integration partner who got paged because of your API remembers it at renewal time.

API consumers are also unforgiving reporters. Humans retry and shrug; software retries on a schedule, fails its own SLAs, and generates support escalations with timestamps attached. There is no ambiguity about when your API went bad — their logs have it to the second. The only open question is whether your monitoring had it first.

The failure sequence: how APIs actually break

Hard failures — the API fully down — are the minority and the easy case; any uptime check catches them. The common sequence is gradual, and each stage is independently detectable:

  1. Latency drift. A query slows as a table grows, a downstream dependency degrades, a pool starts queueing. p95 moves first, then p50. Nothing errors yet. This stage can last days — it is the cheapest possible moment to intervene.
  2. Timeout onset. The slowest requests start dying at the client deadline. Timeout rate is the single most predictive API metric: it means requests are stalling inside the service, which is how resource exhaustion looks from outside.
  3. Error trickle. 5xx begins on some inputs or some fraction of traffic — the pool rejects connections, a dependency circuit opens. Aggregate availability still looks fine; the affected route does not.
  4. Saturation. The failure generalises: most requests error or time out. This is the stage that gets called "the outage", and it is typically hours downstream of stage 1.

Detection at stage 1–2 is a warning to investigate; at stage 3 it is an incident; at stage 4 it is public. The entire value of API monitoring design is moving detection leftward in that sequence.

What to monitor, per endpoint

Choose the endpoints that map to money and core journeys — auth, the main reads, the writes that matter, checkout — and give each:

Judging by baseline, not threshold

Fixed latency thresholds fail the fairness test across a real API surface. 400ms is an emergency for the autocomplete endpoint and a Tuesday for the report generator. Set the threshold loose enough for the slow endpoint and the fast one can triple silently; tight enough for the fast one and the slow one pages daily. The escape is per-endpoint baselines:

Error rates get the same treatment: most endpoints' baseline error rate rounds to zero, so a floor matters (two failures in an hour is a pattern; one is weather), and the comparison is always against this endpoint's history, not the fleet average.

Wiring detection into response

Detection is only half the mean-time-to-recovery equation. The handoff matters:

Quick reference

Monitor granularityPer endpoint — the endpoints mapping to money and core user journeys
The failure sequenceLatency drift → timeout onset → 5xx trickle → saturation ("the outage")
Most predictive metricTimeout rate — requests stalling inside the service signal resource exhaustion
Baseline ruleAlert at ratio + absolute deviation from the endpoint's own p95 (e.g. ≥1.8× and ≥150ms)
ConfirmationTwo consecutive failed checks before an incident — single blips are network weather
Worst failure modeHTTP 200 with a wrong body — caught only by content assertions
Check interval1–5 minutes outside-in; 1 minute where a strict SLA applies

Frequently asked questions

How does API monitoring work?

API monitoring sends requests to each critical endpoint on a fixed interval from outside your infrastructure, validates the response status and optionally its content, records latency, and tracks failures. Failures are confirmed across consecutive checks before an incident is raised, and latency is compared against the endpoint's own measured baseline so degradation is caught before hard failure.

Why isn't a /health endpoint enough?

Health endpoints typically return a static success without exercising the database, dependencies or business logic, so they stay green through most real failures. Meaningful API monitoring checks the endpoints consumers actually call, with the assertions those calls depend on.

What API metrics predict failure earliest?

Latency percentile drift against the endpoint's own baseline is the earliest signal — p95 rises before errors appear. Timeout rate is the most predictive of imminent failure, because timeouts mean requests are stalling inside the service, the external signature of pool or queue exhaustion. Error-rate deviation, especially any 5xx on a normally clean endpoint, is the confirmation.

How do I monitor API latency properly?

Record response time on every check and keep percentiles per endpoint — p50 for the typical case, p95 for the degradation-sensitive tail. Compare current values against a trailing baseline (one to two weeks) and alert when deviation is both proportionally and absolutely significant. Averages alone hide tail degradation; fixed thresholds cannot be fair to endpoints with different natural speeds.

What causes API downtime most often?

Common causes include resource exhaustion (connection pools, memory, worker queues) building up gradually, database performance degrading as data grows, downstream dependency failures propagating upward, expired TLS certificates, DNS misconfiguration, and regressions shipped in deployments. Most give measurable warning — latency drift, timeout onset, error trickles — before becoming outages, which is what per-endpoint baseline monitoring is designed to catch.

Should API monitoring assert response content?

Yes, for critical endpoints. Status-only checks miss the failure mode where an API returns 200 with a wrong, empty or stale body — often the most damaging failure because nothing anywhere signals an error. Asserting that a stable field or value exists in the response catches it from the outside.

How Merik handles it

Merik monitors APIs endpoint by endpoint, exactly on this model. Each registered endpoint gets outside-in checks with status validation and optional content assertions, two-failure confirmation, and latency recorded into its own 14-day p50/p95/p99 baseline. Failures are classified by stage — DNS, TLS, request, response — so the incident says where in the path it died, and timeout-shaped failures are distinguished from refusals.

Latency drift against baseline, error-rate deviation and budget burn feed early warnings with risk, confidence and the evidence list — the stage-1-and-2 detection this article argues for. When an incident does open, it arrives assigned to the endpoint's owner with recent deploys correlated on the timeline, alerts exactly once, and the stored checks roll into monthly uptime and error-budget health for the SLA conversation later. Detection leftward, response pre-wired.

Create your workspace →

Or talk to us about your team →