Short answer
To monitor an API, run external HTTP checks against a dedicated health endpoint and your most important real endpoints, asserting on the status code, response time and specific fields in the JSON body. Authenticate with a read-only token stored as an encrypted secret, avoid endpoints with side effects, and use multi-step checks for flows such as log in, then fetch data. A good /health endpoint verifies critical dependencies and returns a small, stable JSON response.
API monitoring means regularly sending real requests to your API from outside and verifying that the responses are correct, not just that the server answered. APIs fail in ways a homepage check never sees: a database error behind a cached frontend, an expired upstream token, a schema change that breaks mobile clients, or an authentication service that is down.
What to monitor
| Target | Purpose | Suggested interval |
|---|---|---|
/health or /healthz | Service and dependencies are working | 30 s to 1 min |
| Key read endpoints | Real responses have the right shape and data | 1 min |
| Authentication endpoint | Clients can obtain tokens | 1 min |
| Multi-step flow | Login, then use the token, works end to end | 1 to 5 min |
| Public API docs or status | Developer-facing pages are reachable | 5 min |
| gRPC services | Standard gRPC health protocol reports SERVING | 1 min |
What a good /health endpoint returns
A good health endpoint answers one question: can this service do its job right now? It should check the dependencies the service cannot work without and return a clear status code.
GET /health
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
{
"status": "ok",
"version": "2026.10.1",
"checks": {
"database": "ok",
"cache": "ok",
"queue": "ok"
}
}
Design rules:
- Return 200 when healthy and 503 when a critical dependency is down, so monitors can rely on the status code alone.
- Run a real but cheap query against each critical dependency, such as
SELECT 1, with a short timeout. - Respond quickly, well under a second, and never call slow external APIs synchronously.
- Send
Cache-Control: no-storeand bypass CDN caching, or you will be monitoring a cached response. - Do not expose secrets, hostnames, stack traces or detailed version information on a public endpoint.
- Separate liveness (the process is running) from readiness (it can serve traffic). External monitors should use readiness.
- Decide which dependencies are critical. If a non-critical one fails, report
"degraded"but still return 200.
Assertions: checking more than the status code
A 200 response with an empty array or an error object inside is still a failure from the client's point of view. Use assertions:
- Status code: exact (200) or range (2xx).
- Response time: alert when the endpoint becomes unusably slow.
- Substring: the body contains
"status":"ok". - Regex: a field matches a pattern, such as a version string.
- JSONPath:
$.statusequalsok, or$.itemsis not empty. - Header: content type is
application/json.
Keep assertions on fields that are stable. Asserting on timestamps, counts or other changing values creates false alerts.
Authentication and secrets
Many endpoints require credentials. Monitor them safely:
- Create a dedicated, read-only API key or service account for monitoring. Never use a personal or admin token.
- Store it as an encrypted secret in the monitoring tool and reference it from the
Authorizationheader, rather than pasting it into URLs where it can end up in logs. - Scope the account to a test tenant or test data where possible.
- Rotate the key on a schedule, and update the monitor at the same time.
GET /v1/orders?limit=1
Host: api.example.com
Authorization: Bearer {{secret:monitoring_token}}
Accept: application/json
The placeholder syntax differs between tools; the principle is the same.
Avoid side effects
A monitor that runs every minute sends more than 40,000 requests a month, so every side effect is multiplied. Do not monitor endpoints that create orders, charge cards, send emails or write data, unless they are designed for it (for example, a sandbox that discards writes). Prefer GET requests. If you must test a write path, use a dedicated test account and an endpoint that cleans up after itself.
Multi-step API checks
Some failures only show up across several calls. A multi-step check, also called an API workflow or transaction check, runs requests in sequence and passes values between them:
POST /auth/tokenwith test credentials; extractaccess_tokenfrom the response.GET /v1/mewith the token; assert the account ID matches.GET /v1/projects; assert the list is not empty.
This catches broken token issuance, permission errors and data-layer problems that individual checks miss.
API monitoring in Uptime Tracker
Uptime Tracker covers APIs at several levels. Basic HTTP(S) checks on every plan assert on status codes and keywords and record a DNS, connect, TLS and time-to-first-byte breakdown. Advanced HTTP checks (Starter and above) support any method, custom headers, request bodies up to 64 KiB, encrypted secrets referenced from headers (dropped on cross-origin redirects), and substring, RE2 regex and JSONPath assertions; the editor warns about methods with side effects. The Team plan adds API workflows of up to 10 chained requests that pass extracted values such as auth tokens between steps, plus gRPC health checks. See API monitoring.
Interpreting failures
| Symptom | Likely cause |
|---|---|
| Timeout, no response | Server overloaded, hung worker, network problem |
| Slow DNS phase | DNS provider issue or misconfiguration |
| TLS error | Expired or misconfigured certificate |
| 401 or 403 | Monitoring token expired, rotated or blocked by a firewall |
| 429 | Rate limiting is applied to the monitor; allow it or slow the interval |
| 500 or 503 | Application error or failed dependency |
| 200 but assertion failed | Wrong data, schema change, or error object in the body |
Checklist
- A readiness-style
/healthendpoint that checks critical dependencies and returns 200 or 503. - Monitors on the health endpoint and the most important real endpoints.
- Assertions on status, response time and stable JSON fields.
- A read-only monitoring token stored as an encrypted secret.
- No monitors on endpoints with side effects.
- A multi-step check for authentication flows.
- Alerts routed by severity; see reducing false positives.
Frequently asked questions
What should a health check endpoint return?
It should return HTTP 200 with a small JSON body such as {"status": "ok"} when the service and its critical dependencies are working, and HTTP 503 when a critical dependency is down. It should respond quickly, not be cached, and not expose secrets or internal details.
How do I monitor an API that requires authentication?
Create a dedicated read-only API key or service account, store it as an encrypted secret in your monitoring tool, and send it in the Authorization header. Avoid personal or admin tokens and rotate the monitoring key on a schedule.
What is the difference between API monitoring and uptime monitoring?
Uptime monitoring checks that a service responds. API monitoring goes further by sending specific requests, often with authentication and custom methods, and asserting on the response body, headers and timing, sometimes across multiple chained requests.
How often should I check my API?
Every 30 seconds to 1 minute for production health endpoints and critical customer-facing endpoints, and every 1 to 5 minutes for multi-step flows and less critical endpoints. Shorter intervals detect outages sooner.
Should a health check verify the database?
Yes, if the service cannot work without it. Run a cheap query such as SELECT 1 with a short timeout. Return 503 when it fails, so external monitors detect database outages even when the web server itself is still responding.
What is a multi-step API check?
A multi-step API check runs several requests in sequence and passes values between them, such as logging in to obtain a token and then using that token to call protected endpoints. It verifies end-to-end flows rather than single endpoints.