POST /zones/{zone_id}/load_balancers
Create a new load balancer.
Servers
- https://api.cloudflare.com/client/v4
Path parameters
Name | Type | Required | Description |
---|---|---|---|
zone_id |
String | Yes |
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
fallback_pool |
String | Yes |
The pool ID to use when all other pools are detected as unhealthy. |
session_affinity |
String | No |
Specifies the type of session affinity the load balancer should use unless specified as
Possible values:
Default value: "none" |
ttl |
Number | No |
Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers. |
description |
String | No |
Object description. |
proxied |
Boolean | No |
Whether the hostname should be gray clouded (false) or orange clouded (true). Default value: false |
default_pools[] |
Array | Yes |
A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region. |
session_affinity_attributes |
Object | No |
Configures attributes for session affinity. |
session_affinity_attributes.drain_duration |
Number | No |
Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer. |
session_affinity_attributes.secure |
String | No |
Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled. Possible values:
Default value: "Auto" |
session_affinity_attributes.samesite |
String | No |
Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never". Possible values:
Default value: "Auto" |
session_affinity_attributes.headers[] |
Array | No |
Configures the names of HTTP headers to base session affinity on when header |
session_affinity_attributes.require_all_headers |
Boolean | No |
When header
Default value: false |
session_affinity_attributes.zero_downtime_failover |
String | No |
Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are:
Possible values:
Default value: "none" |
location_strategy |
Object | No |
Controls location-based steering for non-proxied requests. See |
location_strategy.prefer_ecs |
String | No |
Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.
Possible values:
Default value: "proximity" |
location_strategy.mode |
String | No |
Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.
Possible values:
Default value: "pop" |
rules[] |
Array | No |
BETA Field Not General Access: A list of rules for this load balancer to execute. |
rules[].overrides |
Object | No |
A collection of overrides to apply to the load balancer when this rule's condition is true. All fields are optional. |
rules[].overrides.fallback_pool |
String | No |
The pool ID to use when all other pools are detected as unhealthy. |
rules[].overrides.session_affinity |
String | No |
Specifies the type of session affinity the load balancer should use unless specified as
Possible values:
Default value: "none" |
rules[].overrides.ttl |
Number | No |
Time to live (TTL) of the DNS entry for the IP address returned by this load balancer. This only applies to gray-clouded (unproxied) load balancers. |
rules[].overrides.default_pools[] |
Array | No |
A list of pool IDs ordered by their failover priority. Pools defined here are used by default, or when region_pools are not configured for a given region. |
rules[].overrides.session_affinity_attributes |
Object | No |
Configures attributes for session affinity. |
rules[].overrides.session_affinity_attributes.drain_duration |
Number | No |
Configures the drain duration in seconds. This field is only used when session affinity is enabled on the load balancer. |
rules[].overrides.session_affinity_attributes.secure |
String | No |
Configures the Secure attribute on session affinity cookie. Value "Always" indicates the Secure attribute will be set in the Set-Cookie header, "Never" indicates the Secure attribute will not be set, and "Auto" will set the Secure attribute depending if Always Use HTTPS is enabled. Possible values:
Default value: "Auto" |
rules[].overrides.session_affinity_attributes.samesite |
String | No |
Configures the SameSite attribute on session affinity cookie. Value "Auto" will be translated to "Lax" or "None" depending if Always Use HTTPS is enabled. Note: when using value "None", the secure attribute can not be set to "Never". Possible values:
Default value: "Auto" |
rules[].overrides.session_affinity_attributes.headers[] |
Array | No |
Configures the names of HTTP headers to base session affinity on when header |
rules[].overrides.session_affinity_attributes.require_all_headers |
Boolean | No |
When header
Default value: false |
rules[].overrides.session_affinity_attributes.zero_downtime_failover |
String | No |
Configures the zero-downtime failover between origins within a pool when session affinity is enabled. This feature is currently incompatible with Argo, Tiered Cache, and Bandwidth Alliance. The supported values are:
Possible values:
Default value: "none" |
rules[].overrides.location_strategy |
Object | No |
Controls location-based steering for non-proxied requests. See |
rules[].overrides.location_strategy.prefer_ecs |
String | No |
Whether the EDNS Client Subnet (ECS) GeoIP should be preferred as the authoritative location.
Possible values:
Default value: "proximity" |
rules[].overrides.location_strategy.mode |
String | No |
Determines the authoritative location when ECS is not preferred, does not exist in the request, or its GeoIP lookup is unsuccessful.
Possible values:
Default value: "pop" |
rules[].overrides.session_affinity_ttl |
Number | No |
Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per
|
rules[].overrides.adaptive_routing |
Object | No |
Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin. |
rules[].overrides.adaptive_routing.failover_across_pools |
Boolean | No |
Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See Default value: false |
rules[].overrides.country_pools |
Object | No |
A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools. |
rules[].overrides.country_pools.name |
String | No | |
rules[].overrides.steering_policy |
String | No |
Steering Policy for this load balancer.
Possible values:
|
rules[].overrides.pop_pools |
Object | No |
(Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools. |
rules[].overrides.pop_pools.name |
String | No | |
rules[].overrides.random_steering |
Object | No |
Configures pool weights.
|
rules[].overrides.random_steering.pool_weights |
Object | No |
A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer. |
rules[].overrides.random_steering.default_weight |
Number | No |
The default weight for pools in the load balancer that are not specified in the pool_weights map. Default value: 1 |
rules[].overrides.region_pools |
Object | No |
A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools. |
rules[].overrides.region_pools.name |
String | No | |
rules[].priority |
Integer | No |
The order in which rules should be executed in relation to each other. Lower values are executed first. Values do not need to be sequential. If no value is provided for any rule the array order of the rules field will be used to assign a priority. Default value: 0 |
rules[].name |
String | No |
Name of this rule. Only used for human readability. |
rules[].disabled |
Boolean | No |
Disable this specific rule. It will no longer be evaluated by this load balancer. Default value: false |
rules[].condition |
String | No |
The condition expressions to evaluate. If the condition evaluates to true, the overrides or fixed_response in this rule will be applied. An empty condition is always true. For more details on condition expressions, please see https://developers.cloudflare.com/load-balancing/understand-basics/load-balancing-rules/expressions. |
rules[].fixed_response |
Object | No |
A collection of fields used to directly respond to the eyeball instead of routing to a pool. If a fixed_response is supplied the rule will be marked as terminates. |
rules[].fixed_response.message_body |
String | No |
Text to include as the http body. |
rules[].fixed_response.content_type |
String | No |
The http 'Content-Type' header to include in the response. |
rules[].fixed_response.location |
String | No |
The http 'Location' header to include in the response. |
rules[].fixed_response.status_code |
Integer | No |
The http status code to respond with. |
rules[].terminates |
Boolean | No |
If this rule's condition is true, this causes rule evaluation to stop after processing this rule. |
session_affinity_ttl |
Number | No |
Time, in seconds, until a client's session expires after being created. Once the expiry time has been reached, subsequent requests may get sent to a different origin server. The accepted ranges per
|
name |
String | Yes |
The DNS hostname to associate with your Load Balancer. If this hostname already exists as a DNS record in Cloudflare's DNS, the Load Balancer will take precedence and the DNS record will not be used. |
networks[] |
Array | No |
List of networks where Load Balancer or Pool is enabled. |
adaptive_routing |
Object | No |
Controls features that modify the routing of requests to pools and origins in response to dynamic conditions, such as during the interval between active health monitoring requests. For example, zero-downtime failover occurs immediately when an origin becomes unavailable due to HTTP 521, 522, or 523 response codes. If there is another healthy origin in the same pool, the request is retried once against this alternate origin. |
adaptive_routing.failover_across_pools |
Boolean | No |
Extends zero-downtime failover of requests to healthy origins from alternate pools, when no healthy alternate exists in the same pool, according to the failover order defined by traffic and origin steering. When set false (the default) zero-downtime failover will only occur between origins within the same pool. See Default value: false |
country_pools |
Object | No |
A mapping of country codes to a list of pool IDs (ordered by their failover priority) for the given country. Any country not explicitly defined will fall back to using the corresponding region_pool mapping if it exists else to default_pools. |
country_pools.name |
String | No | |
steering_policy |
String | No |
Steering Policy for this load balancer.
Possible values:
|
pop_pools |
Object | No |
(Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any PoPs not explicitly defined will fall back to using the corresponding country_pool, then region_pool mapping if it exists else to default_pools. |
pop_pools.name |
String | No | |
random_steering |
Object | No |
Configures pool weights.
|
random_steering.pool_weights |
Object | No |
A mapping of pool IDs to custom weights. The weight is relative to other pools in the load balancer. |
random_steering.default_weight |
Number | No |
The default weight for pools in the load balancer that are not specified in the pool_weights map. Default value: 1 |
region_pools |
Object | No |
A mapping of region codes to a list of pool IDs (ordered by their failover priority) for the given region. Any regions not explicitly defined will fall back to using default_pools. |
region_pools.name |
String | No |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.