API Monitoring Guide: What to Check and How

A 200 with the wrong body is worse than a 500 with the right one.

API monitoring: what to check (status codes, response time, body, headers), REST vs GraphQL, OpenAPI spec import, and multi-step checks.

What to monitor on an API endpoint

API monitoring goes deeper than web monitoring because APIs have richer contracts. At minimum, check the status code (2xx for success, and be specific about which 2xx you expect), the response time (APIs are usually held to tighter latency budgets than web pages), and the response body (does it contain the expected fields, or an error payload disguised as a 200?).

Headers matter too: check that `Content-Type` is correct (a JSON endpoint returning HTML is broken even if the status is 200), that auth headers are accepted, and that rate-limit headers (`X-RateLimit-Remaining`) aren't showing you're about to be throttled. For authenticated endpoints, your monitor needs to handle auth — API key in a header, OAuth token refresh, or basic auth — and you should monitor the auth flow itself, not just skip it by checking an unauthenticated health endpoint.

REST vs GraphQL monitoring

REST endpoints are straightforward to monitor: one URL per resource, predictable status codes, and you can check each endpoint independently. Monitor the critical ones (auth, the main read endpoint, a write endpoint) at a frequency that matches their importance. A single failed endpoint in a REST API doesn't necessarily mean the whole API is down, so per-endpoint monitors give you precise signal.

GraphQL is different: one URL serves every query, so a status-code check on `/graphql` tells you almost nothing — it returns 200 even when a query fails, with the error in the response body. You have to monitor specific queries and inspect the body for the `errors` array. Keyword monitoring (alert if `"errors"` appears in the response, or if an expected data field is absent) is the right tool here. SurePing's keyword monitors work well for this: send a known-good query and assert on the response body.

OpenAPI specs and multi-step checks

If your API has an OpenAPI (Swagger) spec, use it to drive monitoring: the spec defines every endpoint, its expected status codes, and its schema, so you can generate checks from it rather than hand-configuring each one. Some monitoring tools import an OpenAPI spec and auto-create monitors per endpoint. SurePing doesn't currently auto-import OpenAPI specs — you configure each monitor manually — but the spec is still the right source of truth for deciding which endpoints to monitor and what to assert.

For critical flows (login → fetch resource → mutate resource), a multi-step check that chains requests and passes values between them catches integration failures that single-endpoint checks miss. SurePing doesn't currently support multi-step API transactions — each monitor is a single request. For chained flows, set up individual monitors per step and use a heartbeat or external orchestration to tie them together, or pair SurePing with a synthetic monitoring tool for the multi-step journeys.

Monitor this with SurePing

SurePing includes this monitor type on every plan — including the free tier.

Related