Skip to content
AlertPing

Guides

How to monitor an API for errors, not just uptime

| Guides | 8 min read

To monitor an API for errors and not just uptime, check three things on every request: the status code, specific fields inside the JSON response body, and the response time. An endpoint can return 200 OK and still be broken: an empty array where there should be orders, a null auth token, an error object wrapped in a success envelope, or a field that quietly changed from a number to a string. A monitor that only asks “did the endpoint answer?” passes all of those. You need it to read the payload.

This matters most for the APIs your product actually depends on, the payments endpoint, the auth service, the search backend, a partner's data feed. When one of those degrades without going fully down, the failure is invisible to status-only monitoring and very visible to your users. Here is how to check the things that catch a real API problem.

The three layers of an API check

Layer Assert on Catches
Status codeExactly 200 (or 201, 204), not just “under 400”Hard failures, 5xx, redirects to a login page
Response bodyA JSON path like $.status == "ok" or $.data[0].id existsEmpty results, error objects with a 200, schema changes, null fields
Response timeUnder a threshold you set, e.g. 800 msDegradation before it becomes a timeout, a slow dependency

Assert on the status code precisely

Start with the code, but be strict. “Any 2xx or 3xx is fine” is too loose, because a 302 redirect to a login page means your auth expired, and a 204 where you expected a body means something is wrong. Assert on the exact code the endpoint should return. If your API uses 200 for success and 401 for an expired key, a check that tolerates “anything under 400” will happily pass a 401 and never tell you the key died.

Read a field inside the JSON body

This is the layer most monitoring skips, and it is where the real value is. Have the monitor parse the response and assert on a JSON path. A few patterns that pay off:

  • A success flag: assert $.status equals "ok", so an error object returned with a 200 status still fails the check.
  • A non-empty collection: assert $.data[0].id exists, so an endpoint that suddenly returns an empty list, a common silent failure after a bad deploy, gets caught.
  • A required field with the right type: assert a token or a price field is present and non-null, so a schema change that drops or renames a field surfaces immediately.

That single body assertion is the difference between finding out about a broken payload from your monitor versus from a user whose order never went through.

Watch response time, not just availability

An API rarely fails all at once. It gets slow first, as a database query degrades or a downstream dependency starts timing out. Set a response-time threshold, say 800 milliseconds, and alert when checks cross it consistently. That gives you a head start: you are looking at the problem while it is still latency, before it becomes a wall of timeouts and a real outage. If you are deciding what promise to make about that endpoint in the first place, what counts as a good API uptime SLA sets out the numbers customers actually accept.

alertping

Catch the 200 that hides a broken payload

Assert on status code, a JSON body field and response time on every check. 30-second intervals, 3-region confirmation, SMS included.

Send auth headers and a real request

Most useful endpoints need authentication, so your check has to send the right headers, a bearer token or an API key, and sometimes a specific request body for a POST. Store those on the monitor and hit a real, representative endpoint rather than a bare health-check URL that always returns “ok”. A health check that never touches the database will stay green through a database outage. Check something that exercises the actual path your users rely on. The same reasoning applies to the machine behind the endpoint, which is why a server monitoring tool watching ports and processes pairs well with request-level API checks.

Monitoring an API you do not control

Some of the endpoints your product depends on are not yours: a partner's data feed, a third-party pricing service, a public API you built a feature around. You cannot fix those, but you absolutely want to know the moment they break your integration, because your users will blame you, not the vendor. Point a monitor at the third-party endpoint with the same body and response-time assertions, so a change on their side shows up as your alert. If you are pulling structured data off pages that were never meant to be an API in the first place, a tool that turns any website into clean, structured data gives you a stable endpoint to monitor instead of a brittle scraper that breaks on every layout change.

Put it together

A properly monitored API has, for each critical endpoint: an exact status-code assertion, at least one JSON body assertion on a field that proves the response is real, a response-time threshold, the correct auth headers, and confirmation from more than one region before it pages you. Run that every 30 seconds and route it to SMS. The result is that a broken payload, an expired key or a slow dependency reaches you as an alert with enough detail to act on, long before it reaches your users. The dedicated setup lives on the API monitoring page, and it sits in the same account as your website monitoring, SSL and cron checks.

keep reading

More from the blog

· Comparisons

Checkly pricing 2026: how much does Checkly cost per check run, module by module

9 min read

· Comparisons

Grafana Cloud pricing 2026: how much does Grafana Cloud cost, meter by meter

10 min read

· Comparisons

Atlassian Statuspage pricing 2026: how much does Statuspage cost per subscriber, public and private

9 min read

· Comparisons

Opsgenie pricing 2026: how much does Opsgenie cost, and what you pay to replace it

8 min read

· Comparisons

PagerDuty pricing 2026: how much does PagerDuty cost per user, per plan and per year

8 min read

· Comparisons

Pingdom pricing 2026: how much does Pingdom cost per check, per plan and per year

8 min read

· Comparisons

Uptime monitoring software to pair with Datadog, New Relic or Dynatrace

8 min read

· Comparisons

How much does Splunk Observability Cloud cost? Hosts, editions and synthetic monitoring

8 min read

· Comparisons

How much does AppDynamics cost? Editions, cores and synthetic monitoring

8 min read

· Comparisons

How much does Dynatrace cost? Hosts, synthetic monitoring and log ingest

8 min read

· Comparisons

How much does New Relic cost? Users, data ingest and synthetic checks

9 min read

· Comparisons

Datadog synthetic monitoring pricing: what synthetics really cost per test run

9 min read

· Guides

Uptime guarantee vs uptime monitoring: why your host reports 99.9% when your site was down

9 min read

· Guides

Cloudflare uptime monitoring: health checks, origin monitoring, and the blind spots behind the proxy

11 min read

· Comparisons

Status page pricing: what a hosted status page actually costs in 2026

8 min read

· Guides

API monitoring best practices: what to check, how often, and how to keep alerts worth answering

10 min read

· Guides

SSL certificate 200 days: the new validity limit, and the 47-day lifetime coming next

9 min read

· Guides

SSL certificate expired: what happens and how to fix it

8 min read

· Guides

How often should you check website uptime?

7 min read

· SLAs

Error budget: the formula, burn rate alerts, and the policy that makes it work

11 min read

· Playbooks

Runbook template for incident response that gets used

8 min read

· Guides

What causes website downtime, and how to catch each cause

8 min read

· Playbooks

Incident postmortem template that teams actually use

8 min read

· Playbooks

On-call rotation best practices that keep engineers sane

8 min read

· SLAs

MTTR (mean time to recovery): what it is and how to cut it

7 min read

· Guides

Heartbeat monitoring: what it is and how it works

7 min read

· Guides

Status page examples and what the good ones get right

7 min read

· Guides

API uptime SLA: service credit tiers, downtime limits and what a good one costs

8 min read

· Guides

How to create a status page in 6 steps

7 min read

· Guides

Uptime SLA report: what to include, with a worked example

9 min read

· Guides

SLA service credits: what you get back and how to claim it

8 min read

· Guides

Synthetic monitoring vs uptime monitoring: what each one costs and when you need it

8 min read

· Guides

What is a status page?

6 min read

· Guides

Status page vs uptime monitoring: what is the difference?

6 min read

· Guides

What does 99.9% uptime mean?

6 min read

· Guides

What is five nines (99.999%) uptime?

8 min read

· Guides

How to calculate uptime percentage

7 min read

· Guides

SLA vs SLO vs SLI: what is the difference?

7 min read

· Guides

Downtime alerts: how to get notified by email, SMS or phone when your website goes down

7 min read

· Guides

How to monitor an online store for downtime

9 min read

· Guides

Why is my Shopify store unavailable?

8 min read

· Comparisons

Better Stack pricing: how much does Better Stack cost?

8 min read

· Comparisons

UptimeRobot pricing: how much does UptimeRobot cost?

7 min read

· Comparisons

Site24x7 pricing: how much does Site24x7 cost?

8 min read

· Guides

What is a dead man's switch in monitoring?

9 min read

· Guides

Why is my WordPress site down?

9 min read

· Guides

How to monitor WooCommerce uptime and checkout

8 min read

· Economics

How much does website downtime cost?

8 min read

· Guides

How to monitor a cron job

9 min read

· Comparisons

Synthetic monitoring vs real user monitoring

8 min read

· Benchmarks

What is a good uptime percentage?

7 min read

· SLAs

99.99 uptime meaning: SLAs and the real cost of each nine

8 min read

· Guides

How to monitor website uptime

8 min read

· Playbooks

Incident communication examples, templates and outage communication best practices

9 min read

Know the second your site goes down

Checks every 30 seconds, confirmed from 3 regions, alerts on every channel. Running in under a minute.

See pricing