API monitoring: check that your API works, not just that it responds
A 200 OK can still hide an error, an empty list or stale data. What to check in an API, how to design a health endpoint worth monitoring, and how to set up JSON assertions.
· 4 min read · By the Spot Downtime team
A basic uptime check asks one question: did the server answer? For an API, that's not nearly enough. An endpoint can return 200 OK with an error message in the body, an empty list where there should be data, or a stale value from a cache that stopped updating hours ago. Your monitoring says green; your customers' integrations are failing.
Real API monitoring checks that the API works: that it returns the right data, in the right shape, fast enough.
“Up” versus “working”
Here's a response that passes any status-code check:
HTTP/1.1 200 OK
{
"status": "degraded",
"data": { "orders": [] },
"error": "database read replica unavailable"
}Plenty of frameworks and gateways return 200 for errors like this. To catch it, the monitor has to read the body and check specific values.
What to check
1. The status code you expect
Not just “any success”: if creating a resource should return 201, check for 201. A different code means the behaviour changed.
2. Values in the response body
Assertions on the JSON are where API monitoring earns its keep. Useful ones:
| Check | Catches |
|---|---|
status equals "ok" | Self-reported problems in a health endpoint |
data.items.length greater than 0 | Empty results from a broken query or a failed sync |
error does not exist | Errors wrapped in a success response |
data.version equals "2.4.1" | A deploy that didn't roll out everywhere |
data.queue_depth less than 1000 | Background workers falling behind |
3. Response time
A payment API that takes 9 seconds is, for its callers, broken. Watch response time over time; a steady climb usually comes before an outage.
4. Authentication
Monitor authenticated endpoints too, with a dedicated read-only API key sent as a header. Expired keys, broken token validation and permission bugs only show up on authenticated requests.
Design a health endpoint worth monitoring
A /health endpoint that always returns {"status":"ok"} without checking anything is the most common false sense of security. A useful one checks the things your API needs, quickly, and says which part failed:
{
"status": "ok",
"checks": {
"database": "ok",
"cache": "ok",
"queue": "ok"
},
"version": "2.4.1"
}- Keep it fast: each dependency check should be a trivial query with a short timeout.
- Return a non-200 status (such as
503) when a critical dependency is down, and say which one in the body. - Don't expose secrets, hostnames or stack traces: the endpoint is often public.
- Then monitor it with assertions on each check, e.g.
checks.database equals "ok", so the alert tells you what broke.
Monitor real endpoints, too
Setting up an API monitor in Spot Downtime
API monitors are included in every plan, including Free:
- Choose Add monitor → API and enter the URL.
- Pick the method (
GET,POST,PUT,PATCH,DELETEorHEAD), add up to 20 headers (like anAuthorizationheader) and, if needed, a request body. - Optionally set the exact status code to expect. Without one, any 2xx or 3xx counts as success.
- Add up to 20 assertions on the JSON response. Paths use dot or bracket notation, like
data.items[0].id, and.lengthworks on lists and strings. Operators: equals, not equals, contains, exists, not exists, greater than, less than.
Every failure is retried once after 2 seconds before it counts, and the alert includes which assertion failed, so you know where to look before you open a laptop. See the details on the API monitoring page.
A few practical tips
- Use test data that never changes. Assert on a fixed test record (a known product or a test account) rather than live data that can legitimately change.
- Be careful with writes. A
POSTmonitor runs every minute or so. Point it at an idempotent endpoint, or a test mode that doesn't create real orders, emails or charges. - One monitor per critical flow. Separate monitors for login, search and checkout make alerts specific.
- Watch third-party APIs you depend on. If your product breaks when a payment or shipping API breaks, monitor their endpoints too, so you know whose problem it is in seconds.
Create a free account and set up your first API monitor in a couple of minutes. Pair it with a heartbeat for the background jobs behind it.
Keep reading
- Uptime · SLAsWhat 99.9% uptime really means (with a downtime table)99.9% sounds close to perfect, but it allows 43 minutes of downtime a month. Here's what each common uptime target allows, why your real uptime is lower than any one provider's, and how to pick an SLA you can keep.October 2, 2026 · 5 min read
- Cron jobs · HeartbeatsHow to monitor cron jobs and catch the ones that silently stopCron jobs fail without telling anyone. Learn the heartbeat pattern: the job checks in when it finishes, and you get alerted when it doesn't, with examples for crontab, GitHub Actions and Kubernetes.October 2, 2026 · 5 min read