Trigger an on-demand test run for a monitor Generally available; added in 9.2.0

POST /api/synthetics/monitor/test/{monitorId}

Spaces method and path for this operation:

post /s/{space_id}/api/synthetics/monitor/test/{monitorId}

Refer to Spaces for more information.

Trigger an immediate test execution for the specified monitor. The response includes the generated testRunId. If the test encounters issues in one or more service locations, an errors array is also returned with details about the failures.

Path parameters

  • monitorId string Required

    The ID (config_id) of the monitor to test.

Responses

  • 200 application/json

    Test run triggered successfully.

    Hide response attributes Show response attributes object
    • errors array[object]

      Array of errors encountered while triggering the test, one per service location.

      Hide errors attributes Show errors attributes object
      • error object Required
        Hide error attributes Show error attributes object
        • failed_monitors array[object] | null Required

          Optional list of monitors that failed at the location.

        • reason string Required

          Human-readable explanation of the failure.

        • status integer Required

          HTTP status code returned by the agent.

      • locationId string Required

        Identifier of the service location where the error occurred.

    • testRunId string Required

      Unique identifier for the triggered test run.

  • 404

    Monitor not found.

POST /api/synthetics/monitor/test/{monitorId}
curl \
 --request POST 'https://localhost:5601/api/synthetics/monitor/test/{monitorId}' \
 --header "Authorization: $API_KEY"
Response examples (200)
{
  "testRunId": "2bd506e5-4f9a-4aa6-a019-7988500afba0",
  "errors": [
    {
      "locationId": "us_central_staging",
      "error": {
        "status": 401,
        "reason": "no auth credentials provided",
        "failed_monitors": null
      }
    }
  ]
}