Spaces method and path for this operation:
Refer to Spaces for more information.
Create a new monitor with the specified attributes. A monitor can be one of the following types: HTTP, TCP, ICMP, or Browser. The required and default fields may vary based on the monitor type.
You must have all privileges for the Synthetics feature in the Observability section of the Kibana feature privileges.
[Required authorization] Route required privileges: uptime-read AND uptime-write.
Query parameters
-
A custom ID for the new monitor. Generated if omitted.
Maximum length is
1024. -
If
true, store thenamespaceas sent. Otherwise, adefaultnamespace is replaced with one derived from the space ID.Values are
trueorfalse.
Create a synthetics monitor. Required and default fields vary by type (HTTP, TCP, ICMP, browser, or API).
-
The alert configuration. The default is
{ status: { enabled: true }, tls: { enabled: true } }.Additional properties are allowed.
Hide alert attributes Show alert attributes object
-
The check request settings, as nested
requestandresponseobjects. -
Optional request body content.
-
A dictionary of additional HTTP headers to send. By default, Synthetics sets the User-Agent header to identify itself.
-
The HTTP method to use:
HEAD,GET,POST, orOPTIONS. -
A dictionary of expected HTTP headers. If the header is not found, the check fails.
-
Specify whether the monitor is enabled. Defaults to
true. -
If
true, ping using the ipv4 protocol. Defaults totrue. -
If
true, ping using the ipv6 protocol. Defaults totrue. -
Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
-
The Elastic-managed locations to deploy the monitor to. 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, run the
elastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Management and click Create monitor.You can provide
locationsorprivate_locationsor both. At least one is required.Not more than
1000elements. -
The IDs of the maintenance windows to apply to the monitor.
Not more than
1000elements. Maximum length of each is1024. -
The mode of the monitor. If it is
all, the monitor pings all resolvable IPs for a hostname. If it isany, 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, useall. Defaults toany.Values are
anyorall. -
The monitor name.
Maximum length is
4096. -
The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters:
*,\,/,?,",<,>,|, whitespace,,,#,:, or-. Defaults todefault. -
The password for authenticating with the server. The credentials are passed with the request.
-
The private locations to deploy the monitor to. These locations are hosted and managed by you, whereas
locationsare hosted by Elastic. You can specify a private location using the location's name. To list available private locations, run theelastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Settings and click Private locations.Not more than
1000elements. -
Additional headers to send to proxies during CONNECT requests.
-
The URL of the proxy to use for this monitor.
-
Controls the indexing of the HTTP response body contents to the
http.response.body.contentsfield. -
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 is created and, if configured, an alert is sent. Using
retest_on_failurecan reduce noise related to transient problems. -
The APM service name.
-
The IDs of additional spaces to make the monitor available in, besides the current space.
Not more than
1000elements. Maximum length of each is1024. -
The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
- timeout
string | null | number The monitor timeout in seconds. The monitor fails if it doesn't complete within this time. Defaults to
16.For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts only apply on private locations; on public locations the timeout has no effect and the response includes a warning.
-
The monitor type.
Value is
http. -
The URL to monitor.
Maximum length is
4096. -
The username for authenticating with the server. The credentials are passed with the request.
-
The alert configuration. The default is
{ status: { enabled: true }, tls: { enabled: true } }.Additional properties are allowed.
Hide alert attributes Show alert attributes object
-
The check request settings, as nested
requestandresponseobjects. -
Specify whether the monitor is enabled. Defaults to
true. -
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".
Maximum length is
4096. -
If
true, ping using the ipv4 protocol. Defaults totrue. -
If
true, ping using the ipv6 protocol. Defaults totrue. -
Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
-
The Elastic-managed locations to deploy the monitor to. 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, run the
elastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Management and click Create monitor.You can provide
locationsorprivate_locationsor both. At least one is required.Not more than
1000elements. -
The IDs of the maintenance windows to apply to the monitor.
Not more than
1000elements. Maximum length of each is1024. -
The mode of the monitor. If it is
all, the monitor pings all resolvable IPs for a hostname. If it isany, 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, useall. Defaults toany.Values are
anyorall. -
The monitor name.
Maximum length is
4096. -
The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters:
*,\,/,?,",<,>,|, whitespace,,,#,:, or-. Defaults todefault. -
The private locations to deploy the monitor to. These locations are hosted and managed by you, whereas
locationsare hosted by Elastic. You can specify a private location using the location's name. To list available private locations, run theelastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Settings and click Private locations.Not more than
1000elements. -
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, 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, unlessproxy_use_local_resolveris set. -
Specify that hostnames are resolved locally instead of being resolved on the proxy server. If
false, name resolution occurs on the proxy server. Defaults tofalse. -
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 is created and, if configured, an alert is sent. Using
retest_on_failurecan reduce noise related to transient problems. -
The APM service name.
-
The IDs of additional spaces to make the monitor available in, besides the current space.
Not more than
1000elements. Maximum length of each is1024. -
The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
- timeout
string | null | number The monitor timeout in seconds. The monitor fails if it doesn't complete within this time. Defaults to
16.For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts only apply on private locations; on public locations the timeout has no effect and the response includes a warning.
-
The monitor type.
Value is
tcp.
-
The alert configuration. The default is
{ status: { enabled: true }, tls: { enabled: true } }.Additional properties are allowed.
Hide alert attributes Show alert attributes object
-
Specify whether the monitor is enabled. Defaults to
true. -
The host to ping.
Maximum length is
4096. -
If
true, ping using the ipv4 protocol. Defaults totrue. -
If
true, ping using the ipv6 protocol. Defaults totrue. -
Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
-
The Elastic-managed locations to deploy the monitor to. 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, run the
elastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Management and click Create monitor.You can provide
locationsorprivate_locationsor both. At least one is required.Not more than
1000elements. -
The IDs of the maintenance windows to apply to the monitor.
Not more than
1000elements. Maximum length of each is1024. -
The mode of the monitor. If it is
all, the monitor pings all resolvable IPs for a hostname. If it isany, 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, useall. Defaults toany.Values are
anyorall. -
The monitor name.
Maximum length is
4096. -
The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters:
*,\,/,?,",<,>,|, whitespace,,,#,:, or-. Defaults todefault. -
The private locations to deploy the monitor to. These locations are hosted and managed by you, whereas
locationsare hosted by Elastic. You can specify a private location using the location's name. To list available private locations, run theelastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Settings and click Private locations.Not more than
1000elements. -
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 is created and, if configured, an alert is sent. Using
retest_on_failurecan reduce noise related to transient problems. -
The APM service name.
-
The IDs of additional spaces to make the monitor available in, besides the current space.
Not more than
1000elements. Maximum length of each is1024. - timeout
string | null | number The monitor timeout in seconds. The monitor fails if it doesn't complete within this time. Defaults to
16.For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts only apply on private locations; on public locations the timeout has no effect and the response includes a warning.
-
The monitor type.
Value is
icmp. -
The wait time in seconds. Defaults to
1.
-
The alert configuration. The default is
{ status: { enabled: true }, tls: { enabled: true } }.Additional properties are allowed.
Hide alert attributes Show alert attributes object
-
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.
-
Specify whether the monitor is enabled. Defaults to
true. -
Ignore HTTPS errors. Defaults to
false. -
The inline script.
Maximum length is
1000000. -
Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
-
The Elastic-managed locations to deploy the monitor to. 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, run the
elastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Management and click Create monitor.You can provide
locationsorprivate_locationsor both. At least one is required.Not more than
1000elements. -
The IDs of the maintenance windows to apply to the monitor.
Not more than
1000elements. Maximum length of each is1024. -
The monitor name.
Maximum length is
4096. -
The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters:
*,\,/,?,",<,>,|, whitespace,,,#,:, or-. Defaults todefault. -
Playwright options.
-
The private locations to deploy the monitor to. These locations are hosted and managed by you, whereas
locationsare hosted by Elastic. You can specify a private location using the location's name. To list available private locations, run theelastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Settings and click Private locations.Not more than
1000elements. -
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 is created and, if configured, an alert is sent. Using
retest_on_failurecan reduce noise related to transient problems. -
The screenshot option:
on,off, oronly-on-failure. Defaults toon. -
The APM service name.
-
The IDs of additional spaces to make the monitor available in, besides the current space.
Not more than
1000elements. Maximum length of each is1024. -
The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
-
Synthetics agent CLI arguments.
- timeout
string | null | number The monitor timeout in seconds. The monitor fails if it doesn't complete within this time. Defaults to
16.For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts only apply on private locations; on public locations the timeout has no effect and the response includes a warning.
-
The monitor type.
Value is
browser.
-
The alert configuration. The default is
{ status: { enabled: true }, tls: { enabled: true } }.Additional properties are allowed.
Hide alert attributes Show alert attributes object
-
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.
-
Specify whether the monitor is enabled. Defaults to
true. -
Ignore HTTPS errors. Defaults to
false. -
The inline script.
Maximum length is
1000000. -
Key-value pairs of labels to associate with the monitor. Labels can be used for filtering and grouping monitors.
-
The Elastic-managed locations to deploy the monitor to. 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, run the
elastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Management and click Create monitor.You can provide
locationsorprivate_locationsor both. At least one is required.Not more than
1000elements. -
The IDs of the maintenance windows to apply to the monitor.
Not more than
1000elements. Maximum length of each is1024. -
The monitor name.
Maximum length is
4096. -
The namespace field should be lowercase and not contain spaces. The namespace must not include any of the following characters:
*,\,/,?,",<,>,|, whitespace,,,#,:, or-. Defaults todefault. -
Playwright options.
-
The private locations to deploy the monitor to. These locations are hosted and managed by you, whereas
locationsare hosted by Elastic. You can specify a private location using the location's name. To list available private locations, run theelastic-synthetics locationscommand with the deployment's Kibana URL, or go to Synthetics > Settings and click Private locations.Not more than
1000elements. -
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 is created and, if configured, an alert is sent. Using
retest_on_failurecan reduce noise related to transient problems. -
The APM service name.
-
The IDs of additional spaces to make the monitor available in, besides the current space.
Not more than
1000elements. Maximum length of each is1024. -
The TLS/SSL connection settings for use with the HTTPS endpoint. If you don't specify settings, the system defaults are used.
-
Synthetics agent CLI arguments.
- timeout
string | null | number The monitor timeout in seconds. The monitor fails if it doesn't complete within this time. Defaults to
16.For browser monitors, the minimum timeout is 30 seconds. Browser monitor timeouts only apply on private locations; on public locations the timeout has no effect and the response includes a warning.
-
The monitor type.
Value is
api.
Responses
-
A successful response. The response may include a
warningsarray when the monitor configuration has non-critical issues. For example, if a browser monitor specifies a timeout but has no private locations configured, a warning is returned indicating the timeout will have no effect.Hide response attribute Show response attribute object
-
An optional array of warnings about the monitor configuration.
-
-
Bad request. For browser monitors, a 400 error is returned if the timeout is less than 30 seconds.
curl \
-X POST "${KIBANA_URL}/api/synthetics/monitors" \
-H "Authorization: ApiKey ${API_KEY}" \
-H "kbn-xsrf: true" \
-H "Content-Type: application/json" \
-d '{"type":"http","name":"Website Availability","url":"https://example.com","tags":["website","availability"],"locations":["united_kingdom"]}'
POST kbn://api/synthetics/monitors
{"type":"http","name":"Website Availability","url":"https://example.com","tags":["website","availability"],"locations":["united_kingdom"]}
{
"locations": [
"united_kingdom"
],
"name": "Website Availability",
"tags": [
"website",
"availability"
],
"type": "http",
"url": "https://example.com"
}
{
"host": "example.com",
"name": "Server Availability",
"private_locations": [
"my_private_location"
],
"type": "tcp"
}
{
"host": "example.com",
"locations": [
"united_kingdom"
],
"name": "Ping Test",
"type": "icmp"
}
{
"inline_script": "step('Go to https://google.com.co', () => page.goto('https://www.google.com'))",
"locations": [
"united_kingdom"
],
"name": "Example journey",
"type": "browser"
}
{
"enabled": true,
"name": "Example journey",
"type": "browser",
"warnings": [
{
"id": "monitor-id",
"message": "For browser monitors, timeout is only supported on private locations. Browser monitor \"Example journey\" specifies a timeout and is running on public locations: \"public-1, public-2\". The timeout will have no effect on these locations.",
"publicLocationIds": [
"public-1",
"public-2"
]
}
]
}
{
"attributes": {
"details": "Invalid timeout 20 seconds supplied. Minimum timeout for browser monitors is 30 seconds."
},
"error": "Bad Request",
"message": "Browser Monitor timeout is invalid",
"statusCode": 400
}