---
type: api
title: Bulk create monitors
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-synthetic-monitors-bulk-create
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/operation/operation-post-synthetic-monitors-bulk-create
products:
  - Kibana
---

# Bulk create monitors

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

## Paths

- `POST` `/api/synthetics/monitors/_bulk_create`
- `POST` `/s/{space_id}/api/synthetics/monitors/_bulk_create`

- [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)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Create up to 1000 monitors in one request. Every monitor is validated before any monitor is persisted. The API creates the Saved Objects and synchronizes Fleet once for the batch.
You must have `all` privileges for the Synthetics feature in the Observability section of the Kibana feature privileges. If a monitor is shared to additional spaces, you must also have create privileges in each of those spaces.
This is a versioned public API (`elastic-api-version: 2023-10-31`).

## Request Body

`application/json`

- `monitors` ([] union oneOf · min: 1 · max: 1000) — required
  A non-empty list of monitor configurations, up to 1000 monitors.
  - **Synthetics_browserMonitorFields**
    - `alert` (object) — optional
      The alert configuration. The default is `{ status: { enabled: true }, tls: { enabled: true } }`.
    - `enabled` (boolean · default: true) — optional
      Specify whether the monitor is enabled.
    - `labels` (map string to string) — optional
      Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
    - `locations` ([] string) — optional
      The location to deploy the monitor.
Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.
To list available locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Management* and click *Create monitor*. Locations will be listed in *Locations*.
    - `name` (string) — required
      The monitor name.
    - `namespace` (string · default: default) — optional
      The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: `*`, `\`, `/`, `?`, `"`, `<`, `>`, `|`, whitespace, `,`, `#`, `:`, or `-`.
    - `params` (string) — optional
      The monitor parameters.
    - `private_locations` ([] string) — optional
      The private locations to which the monitors will be deployed.
These private locations refer to locations hosted and managed by you, whereas `locations` are hosted by Elastic.
You can specify a private location using the location's name.
To list available private locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Settings* and click *Private locationsr*. Private locations will be listed in the table.

> info
> You can provide `locations` or `private_locations` or both. At least one is required.
    - `retest_on_failure` (boolean · default: true) — optional
      Turn retesting for when a monitor fails on or off. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created and if configured, an alert sent. The monitor will then resume running according to the defined schedule. Using `retest_on_failure` can reduce noise related to transient problems.
    - `schedule` (number) — optional
      The monitor's schedule in minutes. Supported values are `1`, `3`, `5`, `10`, `15`, `30`, `60`, `120`, and `240`. The default value is `3` minutes for HTTP, TCP, and ICMP monitors. The default value is `10` minutes for Browser monitors.
    - `service.name` (string) — optional
      The APM service name.
    - `tags` ([] string) — optional
      An array of tags.
    - `timeout` (number · default: 16) — optional
      The monitor timeout in seconds. The monitor will fail if it doesn't complete within this time.

For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts are only applied when the monitor runs on private locations. If a browser monitor specifies a timeout but has no private locations configured, the timeout will have no effect and a warning will be returned in the response.
    - `certificate_error_spki_allowlist` ([] string · default: []) — optional
      PEM certificates whose public keys (SPKI) are allowlisted so Chromium bypasses certificate errors for matching presented certificates. This does not add a CA to Chromium's trust store.
    - `ignore_https_errors` (boolean · default: false) — optional
      Ignore HTTPS errors.
    - `inline_script` (string) — required
      The inline script.
    - `playwright_options` (object) — optional
      Playwright options.
    - `screenshots` (enum  · default: on) — optional
      The screenshot option.
      Values: `on`, `off`, `only-on-failure`
    - `synthetics_args` ([] string) — optional
      Synthetics agent CLI arguments.
    - `type` (enum) — required
      The monitor type.
      Values: `browser`
  - **Synthetics_httpMonitorFields**
    - `alert` (object) — optional
      The alert configuration. The default is `{ status: { enabled: true }, tls: { enabled: true } }`.
    - `enabled` (boolean · default: true) — optional
      Specify whether the monitor is enabled.
    - `labels` (map string to string) — optional
      Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
    - `locations` ([] string) — optional
      The location to deploy the monitor.
Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.
To list available locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Management* and click *Create monitor*. Locations will be listed in *Locations*.
    - `name` (string) — required
      The monitor name.
    - `namespace` (string · default: default) — optional
      The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: `*`, `\`, `/`, `?`, `"`, `<`, `>`, `|`, whitespace, `,`, `#`, `:`, or `-`.
    - `params` (string) — optional
      The monitor parameters.
    - `private_locations` ([] string) — optional
      The private locations to which the monitors will be deployed.
These private locations refer to locations hosted and managed by you, whereas `locations` are hosted by Elastic.
You can specify a private location using the location's name.
To list available private locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Settings* and click *Private locationsr*. Private locations will be listed in the table.

> info
> You can provide `locations` or `private_locations` or both. At least one is required.
    - `retest_on_failure` (boolean · default: true) — optional
      Turn retesting for when a monitor fails on or off. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created and if configured, an alert sent. The monitor will then resume running according to the defined schedule. Using `retest_on_failure` can reduce noise related to transient problems.
    - `schedule` (number) — optional
      The monitor's schedule in minutes. Supported values are `1`, `3`, `5`, `10`, `15`, `30`, `60`, `120`, and `240`. The default value is `3` minutes for HTTP, TCP, and ICMP monitors. The default value is `10` minutes for Browser monitors.
    - `service.name` (string) — optional
      The APM service name.
    - `tags` ([] string) — optional
      An array of tags.
    - `timeout` (number · default: 16) — optional
      The monitor timeout in seconds. The monitor will fail if it doesn't complete within this time.

For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts are only applied when the monitor runs on private locations. If a browser monitor specifies a timeout but has no private locations configured, the timeout will have no effect and a warning will be returned in the response.
    - `check` (object) — optional
      The check request settings.
      - `request` (object) — optional
        An optional request to send to the remote host.
        - `body` (string) — optional
          Optional request body content.
        - `headers` (object) — optional
          A dictionary of additional HTTP headers to send. By default, Synthetics will set the User-Agent header to identify itself.
        - `method` (enum) — optional
          The HTTP method to use.
          Values: `HEAD`, `GET`, `POST`, `OPTIONS`
      - `response` (object) — optional
        The expected response.
        - `body` (object) — optional
        - `headers` (object) — optional
          A dictionary of expected HTTP headers. If the header is not found, the check fails.
    - `ipv4` (boolean · default: true) — optional
      If `true`, ping using the ipv4 protocol.
    - `ipv6` (boolean · default: true) — optional
      If `true`, ping using the ipv6 protocol.
    - `max_redirects` (number · default: 0) — optional
      The maximum number of redirects to follow.
    - `mode` (enum  · default: any) — optional
      The mode of the monitor. If it is `all`, the monitor pings all resolvable IPs for a hostname. If it is `any`, the monitor pings only one IP address for a hostname. If you're using a DNS-load balancer and want to ping every IP address for the specified hostname, you should use `all`.
      Values: `all`, `any`
    - `password` (string) — optional
      The password for authenticating with the server. The credentials are passed with the request.
    - `proxy_headers` (object) — optional
      Additional headers to send to proxies during CONNECT requests.
    - `proxy_url` (string) — optional
      The URL of the proxy to use for this monitor.
    - `response` (object) — optional
      Controls the indexing of the HTTP response body contents to the `http.response.body.contents field`.
    - `ssl` (object) — optional
      The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
    - `type` (enum) — required
      The monitor type.
      Values: `http`
    - `url` (string) — required
      The URL to monitor.
    - `username` (string) — optional
      The username for authenticating with the server. The credentials are passed with the request.
  - **Synthetics_icmpMonitorFields**
    - `alert` (object) — optional
      The alert configuration. The default is `{ status: { enabled: true }, tls: { enabled: true } }`.
    - `enabled` (boolean · default: true) — optional
      Specify whether the monitor is enabled.
    - `labels` (map string to string) — optional
      Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
    - `locations` ([] string) — optional
      The location to deploy the monitor.
Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.
To list available locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Management* and click *Create monitor*. Locations will be listed in *Locations*.
    - `name` (string) — required
      The monitor name.
    - `namespace` (string · default: default) — optional
      The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: `*`, `\`, `/`, `?`, `"`, `<`, `>`, `|`, whitespace, `,`, `#`, `:`, or `-`.
    - `params` (string) — optional
      The monitor parameters.
    - `private_locations` ([] string) — optional
      The private locations to which the monitors will be deployed.
These private locations refer to locations hosted and managed by you, whereas `locations` are hosted by Elastic.
You can specify a private location using the location's name.
To list available private locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Settings* and click *Private locationsr*. Private locations will be listed in the table.

> info
> You can provide `locations` or `private_locations` or both. At least one is required.
    - `retest_on_failure` (boolean · default: true) — optional
      Turn retesting for when a monitor fails on or off. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created and if configured, an alert sent. The monitor will then resume running according to the defined schedule. Using `retest_on_failure` can reduce noise related to transient problems.
    - `schedule` (number) — optional
      The monitor's schedule in minutes. Supported values are `1`, `3`, `5`, `10`, `15`, `30`, `60`, `120`, and `240`. The default value is `3` minutes for HTTP, TCP, and ICMP monitors. The default value is `10` minutes for Browser monitors.
    - `service.name` (string) — optional
      The APM service name.
    - `tags` ([] string) — optional
      An array of tags.
    - `timeout` (number · default: 16) — optional
      The monitor timeout in seconds. The monitor will fail if it doesn't complete within this time.

For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts are only applied when the monitor runs on private locations. If a browser monitor specifies a timeout but has no private locations configured, the timeout will have no effect and a warning will be returned in the response.
    - `host` (string) — required
      The host to ping.
    - `type` (enum) — required
      The monitor type.
      Values: `icmp`
    - `wait` (number · default: 1) — optional
      The wait time in seconds.
  - **Synthetics_tcpMonitorFields**
    - `alert` (object) — optional
      The alert configuration. The default is `{ status: { enabled: true }, tls: { enabled: true } }`.
    - `enabled` (boolean · default: true) — optional
      Specify whether the monitor is enabled.
    - `labels` (map string to string) — optional
      Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
    - `locations` ([] string) — optional
      The location to deploy the monitor.
Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.
To list available locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Management* and click *Create monitor*. Locations will be listed in *Locations*.
    - `name` (string) — required
      The monitor name.
    - `namespace` (string · default: default) — optional
      The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: `*`, `\`, `/`, `?`, `"`, `<`, `>`, `|`, whitespace, `,`, `#`, `:`, or `-`.
    - `params` (string) — optional
      The monitor parameters.
    - `private_locations` ([] string) — optional
      The private locations to which the monitors will be deployed.
These private locations refer to locations hosted and managed by you, whereas `locations` are hosted by Elastic.
You can specify a private location using the location's name.
To list available private locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Settings* and click *Private locationsr*. Private locations will be listed in the table.

> info
> You can provide `locations` or `private_locations` or both. At least one is required.
    - `retest_on_failure` (boolean · default: true) — optional
      Turn retesting for when a monitor fails on or off. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created and if configured, an alert sent. The monitor will then resume running according to the defined schedule. Using `retest_on_failure` can reduce noise related to transient problems.
    - `schedule` (number) — optional
      The monitor's schedule in minutes. Supported values are `1`, `3`, `5`, `10`, `15`, `30`, `60`, `120`, and `240`. The default value is `3` minutes for HTTP, TCP, and ICMP monitors. The default value is `10` minutes for Browser monitors.
    - `service.name` (string) — optional
      The APM service name.
    - `tags` ([] string) — optional
      An array of tags.
    - `timeout` (number · default: 16) — optional
      The monitor timeout in seconds. The monitor will fail if it doesn't complete within this time.

For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts are only applied when the monitor runs on private locations. If a browser monitor specifies a timeout but has no private locations configured, the timeout will have no effect and a warning will be returned in the response.
    - `host` (string) — required
      The host to monitor; it can be an IP address or a hostname. The host can include the port using a colon, for example "example.com:9200".
    - `proxy_url` (string) — optional
      The URL of the SOCKS5 proxy to use when connecting to the server. The value must be a URL with a scheme of `socks5://`. If the SOCKS5 proxy server requires client authentication, then a username and password can be embedded in the URL. When using a proxy, hostnames are resolved on the proxy server instead of on the client. You can change this behavior by setting the `proxy_use_local_resolver` option.
    - `proxy_use_local_resolver` (boolean · default: false) — optional
      Specify that hostnames are resolved locally instead of being resolved on the proxy server. If `false`, name resolution occurs on the proxy server.
    - `ssl` (object) — optional
      The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
    - `type` (enum) — required
      The monitor type.
      Values: `tcp`
  - **Synthetics_apiMonitorFields**
    - `alert` (object) — optional
      The alert configuration. The default is `{ status: { enabled: true }, tls: { enabled: true } }`.
    - `enabled` (boolean · default: true) — optional
      Specify whether the monitor is enabled.
    - `labels` (map string to string) — optional
      Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
    - `locations` ([] string) — optional
      The location to deploy the monitor.
Monitors can be deployed in multiple locations so that you can detect differences in availability and response times across those locations.
To list available locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Management* and click *Create monitor*. Locations will be listed in *Locations*.
    - `name` (string) — required
      The monitor name.
    - `namespace` (string · default: default) — optional
      The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters: `*`, `\`, `/`, `?`, `"`, `<`, `>`, `|`, whitespace, `,`, `#`, `:`, or `-`.
    - `params` (string) — optional
      The monitor parameters.
    - `private_locations` ([] string) — optional
      The private locations to which the monitors will be deployed.
These private locations refer to locations hosted and managed by you, whereas `locations` are hosted by Elastic.
You can specify a private location using the location's name.
To list available private locations you can:

- Run the `elastic-synthetics locations` command with the deployment's Kibana URL.
- Go to *Synthetics > Settings* and click *Private locationsr*. Private locations will be listed in the table.

> info
> You can provide `locations` or `private_locations` or both. At least one is required.
    - `retest_on_failure` (boolean · default: true) — optional
      Turn retesting for when a monitor fails on or off. By default, monitors are automatically retested if the monitor goes from "up" to "down". If the result of the retest is also "down", an error will be created and if configured, an alert sent. The monitor will then resume running according to the defined schedule. Using `retest_on_failure` can reduce noise related to transient problems.
    - `schedule` (number) — optional
      The monitor's schedule in minutes. Supported values are `1`, `3`, `5`, `10`, `15`, `30`, `60`, `120`, and `240`. The default value is `3` minutes for HTTP, TCP, and ICMP monitors. The default value is `10` minutes for Browser monitors.
    - `service.name` (string) — optional
      The APM service name.
    - `tags` ([] string) — optional
      An array of tags.
    - `timeout` (number · default: 16) — optional
      The monitor timeout in seconds. The monitor will fail if it doesn't complete within this time.

For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts are only applied when the monitor runs on private locations. If a browser monitor specifies a timeout but has no private locations configured, the timeout will have no effect and a warning will be returned in the response.
    - `certificate_error_spki_allowlist` ([] string · default: []) — optional
      PEM certificates whose public keys (SPKI) are allowlisted so the API request context bypasses certificate errors for matching presented certificates. This does not add a CA to the trust store.
    - `ignore_https_errors` (boolean · default: false) — optional
      Ignore HTTPS errors.
    - `inline_script` (string) — required
      The inline API Journey script.
    - `playwright_options` (object) — optional
      Playwright API request context options.
    - `synthetics_args` ([] string) — optional
      Synthetics agent CLI arguments.
    - `type` (enum) — required
      The monitor type.
      Values: `api`

## Responses

#### `200`

A successful response. `created: false` indicates an individual Saved Object creation or Fleet synchronization failure; see `error`. Batch-level Fleet synchronization errors are returned in `errors`.

`application/json`

- `errors` ([] object)
  Optional service-level errors from the bulk sync.
- `result` ([] object)
  - `created` (boolean)
    Whether the monitor Saved Object was created.
  - `error` (string)
    Present when `created` is `false`.
  - `id` (string)
    The config ID of the created monitor.
#### `400`

Bad request. Returned when the batch is empty or too large, a monitor configuration is invalid, or two monitors use the same name.

## Code Examples

#### Console

```console
POST /api/synthetics/monitors/_bulk_create
{
  "monitors": [
    {
      "type": "http",
      "name": "Storefront",
      "url": "https://example.com",
      "locations": ["united_kingdom"]
    },
    {
      "type": "http",
      "name": "Documentation",
      "url": "https://docs.example.com",
      "locations": ["united_kingdom"]
    }
  ]
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/synthetics/monitors/_bulk_create" \
  -H "Content-Type: application/json" \
  -d '{
  "monitors": [
    {
      "type": "http",
      "name": "Storefront",
      "url": "https://example.com",
      "locations": ["united_kingdom"]
    },
    {
      "type": "http",
      "name": "Documentation",
      "url": "https://docs.example.com",
      "locations": ["united_kingdom"]
    }
  ]
}'
```

## Response Examples

#### Bulk create response example1

```json
{
  "result": [
    {
      "id": "monitor1-id",
      "created": true
    },
    {
      "id": "monitor2-id",
      "created": true
    }
  ]
}
```

