Update Health Check
Update a configured health check.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYYAPI Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
X-Auth-Email: user@example.comThe previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194Accepted Permissions (at least one required)
Health Checks WritePath ParametersExpand Collapse
Body ParametersJSONExpand Collapse
result: object { id, address, check_regions, 15 more } or object { id, address, check_regions, 15 more } or object { id, address, check_regions, 15 more }
object { id, address, check_regions, 15 more }
check_regions: optional array of "WNAM" or "ENAM" or "WEU" or 11 moreA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
The number of consecutive fails required from a health check before changing the health to unhealthy.
The number of consecutive successes required from a health check before changing the health to healthy.
http_config: optional object { allow_insecure, expected_body, expected_codes, 5 more } Parameters specific to an HTTP or HTTPS health check.
Parameters specific to an HTTP or HTTPS health check.
A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.
The expected HTTP response codes (e.g. “200”) or code ranges (e.g. “2xx” for all codes starting with 2) of the health check.
The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
status: optional "unknown" or "healthy" or "unhealthy" or "suspended"The current status of the origin server according to the health check.
The current status of the origin server according to the health check.
object { id, address, check_regions, 15 more }
check_regions: optional array of "WNAM" or "ENAM" or "WEU" or 11 moreA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
The number of consecutive fails required from a health check before changing the health to unhealthy.
The number of consecutive successes required from a health check before changing the health to healthy.
http_config: optional object { allow_insecure, expected_body, expected_codes, 5 more } Parameters specific to an HTTP or HTTPS health check.
Parameters specific to an HTTP or HTTPS health check.
A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.
The expected HTTP response codes (e.g. “200”) or code ranges (e.g. “2xx” for all codes starting with 2) of the health check.
The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
status: optional "unknown" or "healthy" or "unhealthy" or "suspended"The current status of the origin server according to the health check.
The current status of the origin server according to the health check.
object { id, address, check_regions, 15 more }
check_regions: optional array of "WNAM" or "ENAM" or "WEU" or 11 moreA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
The number of consecutive fails required from a health check before changing the health to unhealthy.
The number of consecutive successes required from a health check before changing the health to healthy.
http_config: optional object { allow_insecure, expected_body, expected_codes, 5 more } Parameters specific to an HTTP or HTTPS health check.
Parameters specific to an HTTP or HTTPS health check.
A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.
The expected HTTP response codes (e.g. “200”) or code ranges (e.g. “2xx” for all codes starting with 2) of the health check.
The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
status: optional "unknown" or "healthy" or "unhealthy" or "suspended"The current status of the origin server according to the health check.
The current status of the origin server according to the health check.
ReturnsExpand Collapse
result: object { id, address, check_regions, 15 more } or object { id, address, check_regions, 15 more } or object { id, address, check_regions, 15 more }
object { id, address, check_regions, 15 more }
check_regions: optional array of "WNAM" or "ENAM" or "WEU" or 11 moreA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
The number of consecutive fails required from a health check before changing the health to unhealthy.
The number of consecutive successes required from a health check before changing the health to healthy.
http_config: optional object { allow_insecure, expected_body, expected_codes, 5 more } Parameters specific to an HTTP or HTTPS health check.
Parameters specific to an HTTP or HTTPS health check.
A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.
The expected HTTP response codes (e.g. “200”) or code ranges (e.g. “2xx” for all codes starting with 2) of the health check.
The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
status: optional "unknown" or "healthy" or "unhealthy" or "suspended"The current status of the origin server according to the health check.
The current status of the origin server according to the health check.
object { id, address, check_regions, 15 more }
check_regions: optional array of "WNAM" or "ENAM" or "WEU" or 11 moreA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
The number of consecutive fails required from a health check before changing the health to unhealthy.
The number of consecutive successes required from a health check before changing the health to healthy.
http_config: optional object { allow_insecure, expected_body, expected_codes, 5 more } Parameters specific to an HTTP or HTTPS health check.
Parameters specific to an HTTP or HTTPS health check.
A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.
The expected HTTP response codes (e.g. “200”) or code ranges (e.g. “2xx” for all codes starting with 2) of the health check.
The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
status: optional "unknown" or "healthy" or "unhealthy" or "suspended"The current status of the origin server according to the health check.
The current status of the origin server according to the health check.
object { id, address, check_regions, 15 more }
check_regions: optional array of "WNAM" or "ENAM" or "WEU" or 11 moreA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
A list of regions from which to run health checks. Null means Cloudflare will pick a default region.
The number of consecutive fails required from a health check before changing the health to unhealthy.
The number of consecutive successes required from a health check before changing the health to healthy.
http_config: optional object { allow_insecure, expected_body, expected_codes, 5 more } Parameters specific to an HTTP or HTTPS health check.
Parameters specific to an HTTP or HTTPS health check.
A case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy.
The expected HTTP response codes (e.g. “200”) or code ranges (e.g. “2xx” for all codes starting with 2) of the health check.
The HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden.
The interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.
The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
status: optional "unknown" or "healthy" or "unhealthy" or "suspended"The current status of the origin server according to the health check.
The current status of the origin server according to the health check.
Update Health Check
curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/smart_shield/healthchecks/$HEALTHCHECK_ID \
-X PUT \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-d '{
"errors": [
{
"code": 1000,
"message": "message"
}
],
"messages": [
{
"code": 1000,
"message": "message"
}
],
"result": {},
"success": true
}'{
"errors": [],
"messages": [],
"result": {
"address": "www.example.com",
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"name": "server-1"
},
"success": true
}{
"errors": [
{
"code": 1000,
"message": "An error occurred."
}
],
"messages": [],
"result": null,
"success": false
}Returns Examples
{
"errors": [],
"messages": [],
"result": {
"address": "www.example.com",
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"name": "server-1"
},
"success": true
}{
"errors": [
{
"code": 1000,
"message": "An error occurred."
}
],
"messages": [],
"result": null,
"success": false
}