Laravel
← Back to all checks

Availability

API assertion

Calls an API endpoint with the method, headers and body you choose, and checks the status, response headers, JSON values and response time against your rules.

This check is off by default. Enable it and set an endpoint under Active checks on the monitor.

How it works

Every 5 minutes (configurable), we call your endpoint with the method, headers and body you choose. We then check the response against your rules: the status code, text in the body, response headers, JSON values and the response time. A failure is confirmed from our other locations before it counts, so a single network hiccup does not alert you.

We also compare the response time with recent runs and warn you when the endpoint suddenly becomes much slower.

Settings

Setting Default What it does
Endpoint — An absolute URL, or a path on the monitored site such as /api/health. See the variables below.
Method GET The HTTP method.
Headers — Request headers, one Name: value per line.
Body — The request body. Valid JSON is sent as JSON, anything else as a form.
Expected status 200 Accepted status codes: 200, 201, 2*, 2xx, separated by commas or spaces.
Must contain / Must not contain — Text the body must or must not include.
Response headers — Required headers, one per line: Name: value, or just Name.
Assertions — JSON rules, one per line, e.g. data.status == ok or data.items.0.id exists.
Timeout seconds 10 How long to wait for a response.
Max ms 5000 Warn when the response takes longer than this.
Slowdown ratio 1.5 Warn when the response is this many times slower than recent runs.
Interval minutes 5 How often to call the endpoint.
Alert after minutes 2 How long the endpoint must fail before we alert you.

In the endpoint, headers and body, {{timestamp}}, {{uuid}} and {{random}} are replaced with fresh values on every request, which bypasses caches.

Assertion operators are ==, !=, >, >=, <, <=, contains, not contains, exists and missing.

Statuses

Status Meaning
OK The endpoint answered in time and passed every rule.
Warning The endpoint passed, but it was slower than the limit or suddenly slower than usual.
Failed The endpoint timed out, returned an unexpected status, or failed a rule, and other locations confirmed it.

By default you are notified of warnings and failures.

Fixing common problems

  • 401 or 403: the endpoint needs credentials. Add an Authorization header with a token reserved for monitoring.
  • An assertion fails: compare the path with the actual response. Paths use dots for both objects and list indexes, such as data.items.0.name.
  • Cached responses: add ?t={{timestamp}} to the endpoint so every request bypasses the cache.