Skip to main content
An assertion is a rule that tells PulseGuard what a healthy response looks like beyond just “the server replied.” Without assertions, a monitor reports UP any time the server returns a response — even if that response is an error page, a maintenance splash screen, or a JSON payload with "status": "degraded". Assertions close that gap by letting you define exactly what the response must contain for the check to pass. When an assertion fails, PulseGuard treats the check as DOWN regardless of the HTTP status code. This catches silent failures that would otherwise go undetected: a 200 OK that contains an error message, a JSON API that returns the wrong field value, or a page that loads but doesn’t render expected content.

Assertion Types

PulseGuard supports five assertion types that you can combine in a single expectation object. All provided assertions must pass for the check to report UP.

Status Codes Check

Verify that the response returns one of the expected HTTP status codes. If the server returns any code not in the list, the check fails.
Pass an array of integers to accept multiple valid codes — for example, [200, 201] when an endpoint may return either.

Body Contains

Check that the response body includes a specific substring. The check passes only if the string is found anywhere in the body.
Use this for a quick sanity check when you know a healthy response always contains a particular word, phrase, or key.

Body Excludes

Check that the response body does not contain a specific substring. The check fails if the forbidden string is found.
This is useful for detecting error states or maintenance pages that return a 200 status code alongside error content.

Body Regex

Apply a regular expression against the full response body text. The check passes only if the regex finds a match anywhere in the body.
Body regex is useful for confirming that key content is present in an HTML page (e.g., a product name, a version string, or a specific element) or that a plain-text or JSON response contains the expected pattern.
Escape special JSON characters in your regex string. A literal " in the pattern becomes \" and a backslash becomes \\.

JSON Path Assertions

Evaluate one or more path expressions against the parsed response body and compare each result to an expected value. This is the most precise assertion type for JSON API responses. The json_path field accepts an object where each key is a dot-notation path (e.g. data.status) and each value is the string the selected field must equal.
For richer comparisons — including contains, not_equals, and not_contains operators — use json_assertions instead. Each entry specifies a JSONPath selector (with optional $. prefix), an operator, and the expected value.
Supported operators: equals (==, ===), not_equals (!=, !==), contains, not_contains.

Full Expectation Object

You can combine multiple assertion types in a single expectation object. All assertions must pass for the check to report UP.
Configure the expectation field when creating or updating a monitor via the dashboard form, the CLI pulse monitors apply command, or the REST API. When using the API, pass expectation as a JSON object in the request body.

Configuring Assertions in the Dashboard

1

Open the monitor configuration

Navigate to Monitors, click on the monitor you want to configure, and select Edit.
2

Scroll to the Assertions section

Find the Response Assertions panel below the request configuration fields.
3

Set the expected status code

Enter the HTTP status code(s) you expect (e.g., 200). Leave blank to accept any response.
4

Add a body check or JSON assertion

Enter a string in the Body Contains field, a regex pattern in Body Regex, or switch to the JSON tab to specify path-based assertions.
5

Test before saving

Use the Payload Regex Tester tool to validate your pattern against a sample response body before attaching it to a live monitor. See the Tools overview for details.
6

Save the monitor

Click Save Changes. PulseGuard applies the new assertions starting from the very next check cycle.

Assertions via the CLI

When managing monitors as code with the pulse CLI, define assertions inline in your YAML manifest:
Apply your manifest with pulse monitors apply to sync the configuration to PulseGuard.

Common Assertion Patterns

Error Reasons

When an assertion fails, PulseGuard records an errorReason alongside the DOWN status. This appears in the event log and is included in alert notifications so you can immediately distinguish an assertion failure from a connection timeout or DNS error.
Overly broad regex patterns can produce false positives if error responses happen to contain matching text. Always test your patterns with the Payload Regex Tester before deploying them on production monitors.

Overview

Full monitor configuration reference and field descriptions.

Monitor Types

Assertion support varies by monitor type — HTTP, GraphQL, WebSocket, and more.

Payload Regex Tester

Test regex patterns and JSON path selectors against live or sample payloads.