Test a Monitor
Use the API to test a monitor in your workspace.
Testing a monitor runs its checks once without storing the result or opening an incident. This is useful for verifying that the monitor is set up correctly, and for seeing which criteria failed and why.
Required Permissions
monitors.read
Example Request
If the provided ID is valid, this request will return the details of the monitor.
curl -X GET "https://status.example.com/api/v1/monitor/pAbfD8udMmgzPdXx/test" \
-H "x-api-key: YOUR_API_KEY"Response
If the API key is valid, hasn't expired, and has the monitors.read permission, the API will return a JSON response with the details of the monitor.
{
"error": false,
"message": "All checks passed for Website.",
"result": {
"success": true,
"status": 200,
"latency": 143,
"error": null,
"assertions": {
"passed": true,
"groups": [
{
"passed": true,
"rules": [
{
"source": "status",
"operator": "equals",
"value": "200",
"passed": true,
"actual": "200"
}
]
}
]
}
}
}Each rule reports actual, which is what the response held. A rule that couldn't be evaluated at all also carries a reason:
{
"source": "json",
"key": "name",
"operator": "greaterThan",
"value": "3",
"passed": false,
"actual": "miru",
"reason": "Cannot compare numerically: response value miru is not a number"
}Failed Response
error describes the API call, not the monitor. A monitor that fails its checks is a
successful test with a failing result, so read result.success for the verdict.
If the request never got a response, assertions is null and result.error explains why. No criteria are evaluated.
{
"error": false,
"message": "Request timed out",
"result": {
"success": false,
"status": null,
"latency": 2006,
"assertions": null,
"error": "Request timed out"
}
}Error Response
If there is a problem with the request itself, or the monitoring service cannot be reached, the API will return a JSON response with an error message.
{
"error": true,
"message": "Missing monitors permissions: read"
}Types
The API will return a JSON response that can include the following values:
Response
Prop
Type