---
type: api
title: Trigger an on-demand test run for a monitor
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-synthetics-monitor-test
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-synthetics-monitor-test
products:
  - Kibana
---

# Trigger an on-demand test run for a monitor

Availability: 9.2+

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

## Paths

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

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/authentication#basicauth)

#### Path Parameters

- `monitorId` (string)
  The ID (config_id) of the monitor to test.

## Description

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.

## 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 /api/synthetics/monitor/test/{monitorId}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/synthetics/monitor/test/{monitorId}"
```

## Response Examples

#### Test now monitor response example1

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

