Bulk create monitors

POST /api/synthetics/monitors/_bulk_create

Spaces method and path for this operation:

post /s/{space_id}/api/synthetics/monitors/_bulk_create

Refer to 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.

[Required authorization] Route required privileges: uptime-read AND uptime-write.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

Body

  • monitors array[object] Required

    Create a synthetics monitor. Required and default fields vary by type (HTTP, TCP, ICMP, browser, or API).

    At least 1 but not more than 1000 elements.

    Create a synthetics monitor. Required and default fields vary by type (HTTP, TCP, ICMP, browser, or API).

    One of:

Responses

  • 200 application/json

    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.

    Hide response attributes Show response attributes object
    • errors array

      Optional service-level errors from the bulk sync.

    • result array[object] Required
      Hide result attributes Show result attributes object
      • created boolean Required

        Whether the monitor Saved Object was created.

      • error string

        Present when created is false.

      • id string Required

        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.

POST /api/synthetics/monitors/_bulk_create
curl \
  -X POST "${KIBANA_URL}/api/synthetics/monitors/_bulk_create" \
  -H "Authorization: ApiKey ${API_KEY}" \
  -H "kbn-xsrf: true" \
  -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"]}]}'
POST kbn://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"]}]}
Request example
Run `POST /api/synthetics/monitors/_bulk_create` to create several monitors in one request.
{
  "monitors": [
    {
      "locations": [
        "united_kingdom"
      ],
      "name": "Storefront",
      "type": "http",
      "url": "https://example.com"
    },
    {
      "locations": [
        "united_kingdom"
      ],
      "name": "Documentation",
      "type": "http",
      "url": "https://docs.example.com"
    }
  ]
}
Response examples (200)
A response from successfully creating two monitors.
{
  "result": [
    {
      "created": true,
      "id": "monitor1-id"
    },
    {
      "created": true,
      "id": "monitor2-id"
    }
  ]
}