API monitoring
An API that returns 200 with an error body is still broken. PostDeploy API checks let you set the request, expect a status code, and assert on the response body, so a check fails when the answer is wrong rather than only when the server is unreachable.
Checking the answer, not just the connection
The useful question for an API is rarely whether the port is open. It is whether a request that should return data returns the right data. A health endpoint that reports its dependencies is a better check target than the root URL, because it fails when the database is gone rather than when the web tier is.
PostDeploy API checks set the method, headers and request body, then assert on the status code. A keyword check adds an assertion on the response body: it must contain, or must not contain, a string. Pointing a keyword check at a health endpoint and asserting on the healthy marker catches the case where the endpoint answers but reports a failure.
A practical health endpoint check
Assert on something that can only be true when the dependencies are reachable. Asserting that the body contains "ok" is weaker than it looks if your error page also contains the word; prefer a distinctive marker.
Verify what the check will see before you rely on it, with the same request the monitor will make.
# Confirm what the check will assert against.
curl -i -H 'Accept: application/json' https://api.example.com/health
# Expect: HTTP/1.1 200 and a body containing "database":"up"
Authentication and secrets
Send a token in a request header on the check. Use a credential scoped to read-only health data rather than a production admin key, because a monitoring credential is stored to be replayed on a schedule forever.
There is no browser-based login. If reaching the endpoint requires completing an interactive flow, PostDeploy cannot check it.
What PostDeploy does not assert
There is no JSON path assertion, no schema validation and no chained multi-step request. Checks are one request with a status expectation and an optional substring assertion on the body. If you need to assert that a specific JSON field holds a specific value, expose that condition in an endpoint your check can read as a substring, or use a tool built for it.
Questions
Can PostDeploy assert on a JSON field?
Not directly. Assertions are substring matches on the response body, so you can assert on a distinctive fragment such as "database":"up", but there is no JSON path expression or schema validation.
Does an API check count against uptime monitors or cron jobs?
Uptime monitors. API and uptime checks share one allowance, 100 on the trial. Cron and heartbeat jobs are counted separately.
Can I monitor a POST endpoint?
Yes. You can set the method, headers and request body. Point it at something idempotent: the check will replay that request on every interval, indefinitely.
Ship your next project with one toolkit, not three.
Sign up and every feature described on this page is yours on the trial. No credit card.
Create an API check