---
title: "Trigger an on-demand test run for a monitor"
method: POST
path: "/api/synthetics/monitor/test/{monitorId}"
tags: ["synthetics"]
---

# Trigger an on-demand test run for a monitor

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

**Spaces method and path for this operation:**

<div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/synthetics/monitor/test/{monitorId}</span></div>

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-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

## Response `200`

Test run triggered successfully.

- object
  - `errors` object[] — Array of errors encountered while triggering the test, one per service location.
    - `error` object, required
      - `failed_monitors` object[], nullable, 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.

## Other responses

- `404` — Monitor not found.

---

[API](https://skmtc.net/elastic/apis/kibana-apis.md) · [All operations](https://skmtc.net/elastic/apis/kibana-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/elastic/kibana-apis/versions/531c9e2a7d23/schema)
