---
type: api
title: "Trigger an on-demand test run for a monitor"
description: "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."
url: https://www.elastic.co/elastic/docs-builder/docs/5111/api/kibana/operation/operation-post-synthetics-monitor-test
resource: https://www.elastic.co/elastic/docs-builder/docs/5111/api/kibana/operation/operation-post-synthetics-monitor-test
products:
  - Kibana
---

# Trigger an on-demand test run for a monitor

Authentication: required

Availability: Generally available since 9.2

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/synthetics/monitor/test/{monitorId}`
- `POST` `/s/{space_id}/api/synthetics/monitor/test/{monitorId}`

#### Path parameters

- `space_id` (string) — optional
  An identifier for the space. If `space_id` is not provided in the URL, the default space is used. Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.
- `monitorId` (string) — required
  The ID (config_id) of the monitor to test.

## Description

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.

## Responses

#### `200`

Test run triggered successfully.

`application/json`

- `errors` (object[])
  Array of errors encountered while triggering the test, one per service location.
  - `error` (object)
    - `failed_monitors` (object[]) — nullable
      Optional list of monitors that failed at the location.
    - `reason` (string)
      Human-readable explanation of the failure.
    - `status` (integer)
      HTTP status code returned by the agent.
  - `locationId` (string)
    Identifier of the service location where the error occurred.
- `testRunId` (string)
  Unique identifier for the triggered test run.
#### `404`

Monitor not found.

## Code examples

#### Console

```console
POST kbn:/api/synthetics/monitor/test/MONITOR_ID
```

#### curl

```curl
curl -X POST "${KIBANA_URL}/api/synthetics/monitor/test/${MONITOR_ID}" \
  -H "Authorization: ApiKey ${API_KEY}"
```

## Response examples

#### Test now monitor response example1

`application/json`

```json
{
  "testRunId": "2bd506e5-4f9a-4aa6-a019-7988500afba0",
  "errors": [
    {
      "locationId": "us_central_staging",
      "error": {
        "status": 401,
        "reason": "no auth credentials provided",
        "failed_monitors": null
      }
    }
  ]
}
```

