Monitoring assertions that catch wrong responses
Uptimia tests the status, headers, JSON fields, body text and response time you choose on every run, so a 200 with the wrong content still fails. The alert names the step, the rule that broke and the value that came back.
Step breakdown
All 4 steps passedFailed at step 31.66 s · Jul 28 · 14:271.38 s · Jul 28 · 14:327-day averagesLast runAssertions — step 3
3/3 assertions1/3 assertionsStep 3 — last run
passed · 624 msfailed · 612 msCheck log
last 7 days, newest first
Singaporefailed · step 31.44 s
New Yorkfailed · step 31.41 s
Frankfurtfailed · step 31.38 s
Londonpassed1.66 s
Sydneypassed1.71 s
New Yorkpassed1.58 s
Tokyopassed1.64 sWhat a status check lets through
All five responses below answered HTTP 200, and a status-code check passed every one. Four of them are broken, and in each case one rule on the part that went wrong fails the check.
Customers see all four as outages. Sign-in never completes, the order list is empty, the stock page shows a maintenance notice, and search stalls before it answers. With one rule per endpoint, each of those runs fails the check. On an API monitor the incident records the rule and the value it got, so whoever picks it up starts at the field that changed.
Response parts you can assert on
Each rule reads one part of the response and compares it with one of the conditions listed below. Put a rule on every part your app depends on, so that when one breaks, the alert names it.
-
1
Status codeConditionsis · is one of · is 2xx
Status code · is · 200Catches the 500 from the app, the 502 from the proxy and the 401 after someone rotated a key.
-
2
HeaderConditionsexists · equals · contains
Header · x-request-id · existsFails when a proxy serves an HTML error page with a 200 status, or when a cache or gateway strips a header your app relies on.
-
3
JSON bodyConditionsexists · equals · contains · is one of
JSON body · $.status · equals · paidCatches a field that went null, a changed status word or an empty list where orders belong. A rule can read any field a JSONPath expression reaches.
-
4
Body textConditionscontains · does not contain
Body text · does not contain · "exception"Catches a stack trace or an error banner inside an otherwise well-formed response. You can require a phrase to be present, or ban one from appearing anywhere in the body.
-
5
Response timeConditionsunder (ms)
Response time · under (ms) · 800A correct answer that arrives after the budget still fails the step. You set the budget in milliseconds, per step.
Where assertion results appear
Each rule shows pass or fail from the first test run through to the exported incident report.
Test runs while you write rules
Use Run test, or Run to step N, before you save. Each step shows its assertion checklist with pass or fail and the value received, plus the response body with extracted values highlighted and a timing tab.
Check log and run detail
Every run is listed as passed or failed at step N, with the error, the location and the duration. Open one for a card per step with its HTTP code, response size, assertion tally and timing split.
Incident page and report export
The incident carries the failing step, the rule and what came back, and the alert email lists the checkpoints that saw it. Export the report later and the failing-step detail is still there.
Get alerts that namethe rule that failed.
Website monitors include keyword rules, and every step of an API monitor takes JSON and header rules.
Alerts that name the failing rule
When an assertion fails, the incident and every alert sent for it name the step, the rule and the value that came back.
The incident line names the rule
One line gives the step number, the method and path, the rule that broke and the value it got. It appears on the incident page, in the incident list, and in chat and SMS alerts.
Expected and received values in the email
One sentence covers the step, the request it sent, the server's answer and what the rule expected. Below it, the email lists every checkpoint that saw the failure, with its flag and error.
Failures confirmed from other locations first
Before anyone is paged, other locations repeat the failed run. You choose how many checks must agree; at 1, the first failed run alerts.
- Every location that saw it. The alert email lists each checkpoint with its flag, name, error and status.
- The failing step stays on record. A closed incident's report export still names the step and the rule.
- Recovery goes to the same people. When every step passes again, everyone who was alerted gets the recovery notice on the same channels.
Assertions by monitor type
Each monitor type takes its own kind of rule. Whichever you use, a broken rule fails the check and alerts you the same way an outage does.
- Website monitors take required and banned keywords on the HTML of a page, and port checks take a send-and-expect string for services that speak their own TCP protocol.
- API monitors take status, header, JSON, body-text and response-time rules on every step of a chain of up to 15 requests.
- Transaction monitors verify a page in a real browser, including text drawn by JavaScript, an element's state and the URL a journey ends on.
Common assertion mistakes
A rule that pins an id or a timestamp pages you as soon as that value moves. Loose matching causes the reverse problem, where a broken response passes the check. Each case below shows the brittle rule beside its fix.
Pinning an id that changes
Ids, timestamps, ETags and request ids change on every run. Assert that the field exists, or is one of a known set, and extract the value if a later step needs it.
Header equals fails on a charset
Equals compares the whole header value, case included. When the server appends a charset or a boundary, use contains.
A substring that matches too much
Body text is a substring test on the raw body, so a short word like ok matches inside broken. A JSON rule on the field compares the whole value.
Also included
Masked secret variables
Keep client secrets and API keys in a locked variable and reference it in any step. The value is masked in logs and response snippets, and any token requested with it is fetched fresh on each run.
Recovery notices
Once every step passes again, the recovery notice says how long the endpoint was failing.
Maintenance windows
If a release changes responses on purpose, pause the checks for the deploy window and nobody gets paged.
Optional steps
Mark a cleanup or best-effort step optional. Its failure is recorded and the rest of the chain keeps running.
Checks from chosen regions
Bind a monitor to a built-in location profile such as Europe, North America or Asia, so its rules run where your users are.
One dashboard for everything
Your assertion rules sit in the same account as your SSL, domain and server monitors and alert the same contacts.
Rule sets for common endpoints
Each example below pairs a failure with the monitor settings that catch it and what you see when it fails.
Login returns 200 with an error body
Sign-in starts rate-limiting real users. The endpoint still answers HTTP 200 quickly, with "ok": false and no token. A status check marks that healthy, so the first report comes from a customer writing to support.
What you see and what happens →
- What you see
- The check log marks the run failed at step 1. Open the run and the step card shows HTTP 200, 1 of 3 assertions passed, and the response body with the failing value.
- What happens
- The run counts as an outage. Other locations repeat it first, then the incident opens with step 1, assertion 2, the operator (json equals) and the value it got: false.
Login token reused in the orders call
Step 1 signs in with a client secret and pulls the access token out of the response. Step 2 calls the orders API with that token and checks that the first order has an id, which is the same sequence your app follows.
What you see and what happens →
- What you see
- Run test shows both steps with every rule ticked, and the body of step 1 highlights the extracted token. The secret is masked in logs and alerts.
- What happens
- While both steps pass, nobody is paged. If the login breaks, step 1 fails and step 2 is marked not run. The incident names step 1, so you know the login broke and the orders API was never called.
Search response over its 600 ms budget
The search endpoint returns all 38 results with every field correct, in 1,730 ms. A shopper typing into the search box sees nothing for well over a second.
What you see and what happens →
- What you see
- The run detail splits the step into DNS, connect, TLS, wait and receive, so you can see whether the time went to the network or to the server preparing its answer. The step breakdown shows average and p95 time per step, which lets you set the budget from measured numbers.
- What happens
- The first run over 600 ms fails the step. With outage confirmation above 1, other locations repeat the chain before anyone is paged, so a single slow route cannot open an incident.
Product page missing its cart button
The catalogue service behind the shop stops answering. The page still renders with HTTP 200 and a heading, but where the cart button belongs, a notice says the item is unavailable.
What you see and what happens →
- What you see
- The check log shows the failed check with its location and the keyword error. Click the row for the probe, the URL and the error text.
- What happens
- The failed check is confirmed from other locations by default, then you are alerted. Keyword rules read the HTML as the server sent it. Text that JavaScript adds later needs a transaction monitor, which loads the page in a real browser.
Put a rule on the fieldyour app depends on.
Run test shows each rule passing or failing before you save the monitor.
How monitoring assertions work
An assertion is a rule a response must satisfy, such as required text, a status code, a header, a JSON field or a millisecond budget, and Uptimia checks it on every run. When a rule breaks, the failure is confirmed from other locations by default and the alert names what failed (for an API rule, the step, the rule and the value that came back); when the run passes again, a recovery notice follows.
01What is an assertion in website monitoring?+
02What can I assert on an API response?+
03Which monitors take assertions?+
04How do I pass a value from one step to the next?+
05Why does my assertion fail on a healthy API?+
06How exact are the comparisons?+
07Can I compare a JSON number against a threshold?+
08Which JSONPath syntax is supported?+
09Can I use variables inside an assertion?+
10Can I assert on the SSL certificate's issuer or TLS version?+
11Are assertions a paid add-on?+
Assertions for API and website monitors
Add rules on content, JSON fields, headers and response time, and a response has to be correct to count as healthy.