Skip to content
Start here

Healthchecks

List Health Checks
client.Healthchecks.List(ctx, params) (*V4PagePaginationArray[Healthcheck], error)
GET/zones/{zone_id}/healthchecks
Health Check Details
client.Healthchecks.Get(ctx, healthcheckID, query) (*Healthcheck, error)
GET/zones/{zone_id}/healthchecks/{healthcheck_id}
Create Health Check
client.Healthchecks.New(ctx, params) (*Healthcheck, error)
POST/zones/{zone_id}/healthchecks
Update Health Check
client.Healthchecks.Update(ctx, healthcheckID, params) (*Healthcheck, error)
PUT/zones/{zone_id}/healthchecks/{healthcheck_id}
Patch Health Check
client.Healthchecks.Edit(ctx, healthcheckID, params) (*Healthcheck, error)
PATCH/zones/{zone_id}/healthchecks/{healthcheck_id}
Delete Health Check
client.Healthchecks.Delete(ctx, healthcheckID, body) (*HealthcheckDeleteResponse, error)
DELETE/zones/{zone_id}/healthchecks/{healthcheck_id}
ModelsExpand Collapse
type CheckRegion string

WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, EEU: Eastern Europe, NSAM: Northern South America, SSAM: Southern South America, OC: Oceania, ME: Middle East, NAF: North Africa, SAF: South Africa, IN: India, SEAS: South East Asia, NEAS: North East Asia, ALL_REGIONS: all regions (BUSINESS and ENTERPRISE customers only).

One of the following:
const CheckRegionWnam CheckRegion = "WNAM"
const CheckRegionEnam CheckRegion = "ENAM"
const CheckRegionWeu CheckRegion = "WEU"
const CheckRegionEeu CheckRegion = "EEU"
const CheckRegionNsam CheckRegion = "NSAM"
const CheckRegionSsam CheckRegion = "SSAM"
const CheckRegionOc CheckRegion = "OC"
const CheckRegionMe CheckRegion = "ME"
const CheckRegionNaf CheckRegion = "NAF"
const CheckRegionSaf CheckRegion = "SAF"
const CheckRegionIn CheckRegion = "IN"
const CheckRegionSeas CheckRegion = "SEAS"
const CheckRegionNeas CheckRegion = "NEAS"
const CheckRegionAllRegions CheckRegion = "ALL_REGIONS"
type Healthcheck struct{…}
ID stringoptional

Identifier

maxLength32
Address stringoptional

The hostname or IP address of the origin server to run health checks on.

CheckRegions []CheckRegionoptional

A list of regions from which to run health checks. Null means Cloudflare will pick a default region.

One of the following:
const CheckRegionWnam CheckRegion = "WNAM"
const CheckRegionEnam CheckRegion = "ENAM"
const CheckRegionWeu CheckRegion = "WEU"
const CheckRegionEeu CheckRegion = "EEU"
const CheckRegionNsam CheckRegion = "NSAM"
const CheckRegionSsam CheckRegion = "SSAM"
const CheckRegionOc CheckRegion = "OC"
const CheckRegionMe CheckRegion = "ME"
const CheckRegionNaf CheckRegion = "NAF"
const CheckRegionSaf CheckRegion = "SAF"
const CheckRegionIn CheckRegion = "IN"
const CheckRegionSeas CheckRegion = "SEAS"
const CheckRegionNeas CheckRegion = "NEAS"
const CheckRegionAllRegions CheckRegion = "ALL_REGIONS"
ConsecutiveFails int64optional

The number of consecutive fails required from a health check before changing the health to unhealthy.

ConsecutiveSuccesses int64optional

The number of consecutive successes required from a health check before changing the health to healthy.

CreatedOn Timeoptional
formatdate-time
Description stringoptional

A human-readable description of the health check.

FailureReason stringoptional

The current failure reason if status is unhealthy.

HTTPConfig HTTPConfigurationoptional

Parameters specific to an HTTP or HTTPS health check.

Interval int64optional

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.

ModifiedOn Timeoptional
formatdate-time
Name stringoptional

A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.

Retries int64optional

The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.

Status HealthcheckStatusoptional

The current status of the origin server according to the health check.

One of the following:
const HealthcheckStatusUnknown HealthcheckStatus = "unknown"
const HealthcheckStatusHealthy HealthcheckStatus = "healthy"
const HealthcheckStatusUnhealthy HealthcheckStatus = "unhealthy"
const HealthcheckStatusSuspended HealthcheckStatus = "suspended"
Suspended booloptional

If suspended, no health checks are sent to the origin.

TCPConfig TCPConfigurationoptional

Parameters specific to TCP health check.

Timeout int64optional

The timeout (in seconds) before marking the health check as failed.

Type stringoptional

The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.

type HTTPConfiguration struct{…}

Parameters specific to an HTTP or HTTPS health check.

AllowInsecure booloptional

Do not validate the certificate when the health check uses HTTPS.

ExpectedBody stringoptional

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.

ExpectedCodes []stringoptional

The expected HTTP response codes (e.g. "200") or code ranges (e.g. "2xx" for all codes starting with 2) of the health check.

FollowRedirects booloptional

Follow redirects if the origin returns a 3xx status code.

Header map[string, []string]optional

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.

Method HTTPConfigurationMethodoptional

The HTTP method to use for the health check.

One of the following:
const HTTPConfigurationMethodGet HTTPConfigurationMethod = "GET"
const HTTPConfigurationMethodHead HTTPConfigurationMethod = "HEAD"
Path stringoptional

The endpoint path to health check against.

Port int64optional

Port number to connect to for the health check. Defaults to 80 if type is HTTP or 443 if type is HTTPS.

type QueryHealthcheck struct{…}
Address string

The hostname or IP address of the origin server to run health checks on.

Name string

A short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed.

CheckRegions []CheckRegionoptional

A list of regions from which to run health checks. Null means Cloudflare will pick a default region.

One of the following:
const CheckRegionWnam CheckRegion = "WNAM"
const CheckRegionEnam CheckRegion = "ENAM"
const CheckRegionWeu CheckRegion = "WEU"
const CheckRegionEeu CheckRegion = "EEU"
const CheckRegionNsam CheckRegion = "NSAM"
const CheckRegionSsam CheckRegion = "SSAM"
const CheckRegionOc CheckRegion = "OC"
const CheckRegionMe CheckRegion = "ME"
const CheckRegionNaf CheckRegion = "NAF"
const CheckRegionSaf CheckRegion = "SAF"
const CheckRegionIn CheckRegion = "IN"
const CheckRegionSeas CheckRegion = "SEAS"
const CheckRegionNeas CheckRegion = "NEAS"
const CheckRegionAllRegions CheckRegion = "ALL_REGIONS"
ConsecutiveFails int64optional

The number of consecutive fails required from a health check before changing the health to unhealthy.

ConsecutiveSuccesses int64optional

The number of consecutive successes required from a health check before changing the health to healthy.

Description stringoptional

A human-readable description of the health check.

HTTPConfig HTTPConfigurationoptional

Parameters specific to an HTTP or HTTPS health check.

Interval int64optional

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.

Retries int64optional

The number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.

Suspended booloptional

If suspended, no health checks are sent to the origin.

TCPConfig TCPConfigurationoptional

Parameters specific to TCP health check.

Timeout int64optional

The timeout (in seconds) before marking the health check as failed.

Type stringoptional

The protocol to use for the health check. Currently supported protocols are 'HTTP', 'HTTPS' and 'TCP'.

type TCPConfiguration struct{…}

Parameters specific to TCP health check.

Method TCPConfigurationMethodoptional

The TCP connection method to use for the health check.

Port int64optional

Port number to connect to for the health check. Defaults to 80.

HealthchecksPreviews

Health Check Preview Details
client.Healthchecks.Previews.Get(ctx, healthcheckID, query) (*Healthcheck, error)
GET/zones/{zone_id}/healthchecks/preview/{healthcheck_id}
Create Preview Health Check
client.Healthchecks.Previews.New(ctx, params) (*Healthcheck, error)
POST/zones/{zone_id}/healthchecks/preview
Delete Preview Health Check
client.Healthchecks.Previews.Delete(ctx, healthcheckID, body) (*PreviewDeleteResponse, error)
DELETE/zones/{zone_id}/healthchecks/preview/{healthcheck_id}