An API can answer quickly with the wrong thing: an error object with status 200, an empty list or a login page. An HTTP(s) monitor with a custom request and a required response catches those cases.
Create the monitor
- Open Uptime monitors and choose Create monitor.
- Pick HTTP(s) and enter the endpoint URL.
- Tick the notification handlers to alert and choose the check interval.
- Open Advanced settings.
Custom request
- Request body: your own body, as form data or JSON.
- Basic auth username and password, if the endpoint needs them.
- Custom request headers, such as an API key or
Accept: application/json. - Request timeout: how long to wait before the check counts as failed.
- Follow redirects: up to five redirects are followed to the final location.
- Cache buster: adds a random query parameter so a cache cannot answer for your server.
Custom response
- Response status code(s): the codes that count as up, separated by commas, such as
200,201. - Response body: a string that must appear in the response, such as
"status":"ok". - Custom response headers that must be present.
Use a dedicated health endpoint where you can; see how to build a health check endpoint and the API monitoring checklist. More on API monitoring.