How to monitor an API
Monitoring an API means calling it regularly the way your app would and checking that the status code is the expected one, that the response carries the right data and that it’s fast. For flows like logging in and then placing an order, several calls are chained, passing the token from one to the next.
Published · ganyant
Why isn’t a 200 enough?
An API can answer 200 with an error inside, an empty list or stale cached data. So it’s worth also checking that the response contains something specific, like a field or text that only appears when everything works.
Which endpoint should I check?
Ideally a health endpoint (for example /health) that checks the database and the services it depends on. If you don’t have one, pick a light read call that uses those same pieces.
What if the API needs authentication?
Use a test account or key with minimum, read-only permissions. If the token expires, the monitor has to log in first and use the new token in the next call.
What is a good response time?
It depends on the API, but the trend is what matters: if it goes from 200 ms to 2 seconds, something got worse even though it still answers. Measure from the regions where your users are.
How does ganyant do it?
A ganyant HTTP monitor checks the status code, the response time and, if you want, a text the response must contain. On Agency, the multi-step API monitor chains up to 6 calls, with their own headers and body, and saves JSON values (like a token) to use in later steps.