API monitoring that checks the answer, not only the status
An API can return 200 and still hand back wrong data. Uptimecat can check the body as well.
What you can check
Use the HTTP(s) monitor with the method, headers and body your endpoint needs. Set which status codes count as healthy. For JSON responses, a JSON query monitor evaluates an expression on the body and compares it with the value you expect.
That lets you test that a field such as status equals ok, or that a list is not empty, without writing code.
Monitor an endpoint
- Add a monitor. Choose HTTP(s) with JSON Query, or plain HTTP(s) if status is enough.
- Enter the URL and select GET, POST or another method.
- Add an Authorization header with a read-only token if needed.
- Set the JSON query and expected value, for example a health field equal to ok.
- Pick channels and save.
Example response and rule
GET https://api.example.com/health
{"status":"ok","db":"up"}
JSON query: status
Expected value: okTips
- Create a health endpoint that tests dependencies, and monitor it.
- Use a token with the minimum scope, and rotate it on a schedule.
- Avoid side effects. Monitor read-only calls.
- Add a response time view to spot slow degradation.
Automation
You can read monitor state and send heartbeats with an API key or push URL. See the API page and the developer guide.
Designing checks that last
Prefer a dedicated health route over a business endpoint. A health route can check the database, the cache and queues, and return one clear answer. Business endpoints change with features and break your monitors by surprise.
Keep tokens in the monitor's header settings, and give them the smallest scope possible. If a token leaks from a monitor, it should only be able to read a health status.
Watch for slow failures. An endpoint that answers in 20 seconds is down for most clients. Set a timeout that reflects what your clients tolerate. See response time monitoring for how to read the trend.
Test the failure path too. Occasionally call your health route with a broken dependency in staging and confirm that it returns an error and that the monitor alerts. A health check that always returns ok is worse than none, because it gives false confidence. Review it whenever you add a new dependency.
Frequently asked questions
Can I send a POST body?
Yes. Choose the method and enter the body and content type.
Does it support GraphQL?
Send a POST with your query as the body and check a field in the JSON response.
Can it run multi-step flows?
No. Each monitor is a single request.
What if my API needs OAuth?
Use a long-lived read-only token in a header, or expose a protected health route.
Related
Open the dashboard
Sign in with your Google account to add a monitor and pick an alert channel. Access is currently limited to Moruk accounts; open sign-up is not available yet.