> For the complete documentation index, see [llms.txt](https://waap.docs.link11.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://waap.docs.link11.com/reference-information/api/namespace-reference/load-balancers.md).

# Load Balancers

## Prerequisites

The *{config}* API parameter is discussed [here](/using-the-product/the-link11-waap-api/internal-data-structures.md#the-fundamental-data-structure-configuration).

Load balancer administration is discussed [here](/console-walkthrough/sites/ssl/load-balancers.md). The discussion below assumes familiarity with it.

## Special considerations when using the API

### Multi-regional configuration

As explained [here](/console-walkthrough/sites/ssl/load-balancers.md#configuring-traffic-routing), when a Link11 load balancer supports a multi-regional planet, admins can (if desired) configure traffic routing.

The API provides additional granularity beyond the configuration available in the web console:&#x20;

* In the UI, the load balancer is treated as a single instance. However, this "one" load balancer is conceptual: it represents multiple physical instances, running simultaneously in different cities. The API provides the ability to configure each city separately, if desired.
* In the UI, the *Preferred datacenter* control displays a list of datacenters where Link11 WAAP has been deployed. In the API, this list is provided in the `upstream_regions` parameter, which is returned when calling *GET /api/v4.3/conf/{config}/load-balancers/regions.*
* In the UI, one *Preferred datacenter* can be selected, which will be applied to all cities. In the API, different datacenters can be specified for different cities, by calling *POST /api/v4.3/conf/{config}/load-balancers/regions.*

{% hint style="info" %}
When calling *POST /api/v4.3/conf/{config}/load-balancers/regions*, all desired preferences should be specified. All unspecified regions will be set to the default preference of `automatic` .

If an incorrect preferred datacenter (one where L11WAAP is not running) is specified, this action will be rejected, and the previous selection will remain in effect.
{% endhint %}

## API overview

<table><thead><tr><th width="346.4755859375">Action</th><th>Operation</th></tr></thead><tbody><tr><td>To retrieve information about all load balancers</td><td>GET .../load-balancers</td></tr><tr><td>To add a certificate</td><td>PUT .../{entry_name}/certificates/{certificate_id}</td></tr><tr><td>To remove a certificate</td><td>DELETE .../{entry_name}/certificates</td></tr><tr><td>To get the list of Link11 WAAP datacenters, and each city's current preference</td><td>GET .../regions</td></tr><tr><td>To set preferred datacenters for each city</td><td>POST .../regions</td></tr></tbody></table>

## Operations

## Get Load Balancers

> Get all Load Balancers in a configuration

```json
{"openapi":"3.0.2","info":{"title":"Link11 WAAP","version":"v4.3"},"paths":{"/api/v4.3/conf/{config}/load-balancers":{"get":{"operationId":"get_load_balancers_api_v3_reblaze_config_load_balancers__get_191271472328453064","summary":"Get Load Balancers","description":"Get all Load Balancers in a configuration","parameters":[{"in":"path","name":"config","required":true,"schema":{"title":"Config","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Get Load Balancers Api v4.3 Reblaze Load Balancers","properties":{"total":{"type":"integer"},"items":{"type":"array","items":{"$ref":"#/components/schemas/LoadBalancer"}}}}}},"description":"Load Balancers retrieved successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputError"}}},"description":"Input Error"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal Server Error"}},"tags":["Load Balancers"]}}},"components":{"schemas":{"LoadBalancer":{"properties":{"certificates":{"items":{"type":"string"},"title":"Certificates","type":"array"},"default_certificate":{"title":"Default Certificate","type":"string"},"dns_name":{"title":"Dns Name","type":"string"},"listener_name":{"title":"Listener Name","type":"string"},"listener_port":{"description":"Port in AWS or IP in GCP","title":"Listener Port","type":"integer"},"load_balancer_type":{"enum":["classic","application"],"title":"Load Balancer Type","type":"string"},"max_certificates":{"title":"Max Certificates","type":"integer"},"name":{"title":"Name","type":"string"},"provider":{"$ref":"#/components/schemas/CloudProviderEnum"},"region":{"title":"Region","type":"string"}},"required":["provider","name","listener_name","listener_port","dns_name","region","load_balancer_type","max_certificates","default_certificate","certificates"],"title":"LoadBalancer","type":"object"},"CloudProviderEnum":{"description":"An enumeration.","enum":["aws","gcp","link11"],"title":"CloudProviderEnum","type":"string"},"InputError":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"InputError","type":"object"},"Error":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"Error","type":"object"}}}}
```

## Add Certificate

> Add a certificate to a Load Balancer

```json
{"openapi":"3.0.2","info":{"title":"Link11 WAAP","version":"v4.3"},"paths":{"/api/v4.3/conf/{config}/load-balancers/{entry_name}/certificates/{certificate_id}":{"put":{"operationId":"add_certificate_to_load_balancer_api_v3_reblaze_config__config__load_balancers__load_balancer_name__certificates__certificate_id___put_162012920830018407","summary":"Add Certificate","description":"Add a certificate to a Load Balancer","parameters":[{"in":"path","name":"config","required":true,"schema":{"title":"Config","type":"string"}},{"in":"path","name":"entry_name","required":true,"schema":{"title":"Load Balancer Name","type":"string"}},{"in":"path","name":"certificate_id","required":true,"schema":{"title":"Certificate ID","type":"string"}},{"in":"query","name":"provider","required":true,"schema":{"$ref":"#/components/schemas/CloudProviderEnum"}},{"in":"query","name":"region","required":true,"schema":{"title":"Region","type":"string"}},{"in":"query","name":"default","required":false,"schema":{"default":false,"title":"Default","type":"boolean"}},{"in":"query","name":"elbv2","required":false,"schema":{"default":true,"title":"ELB v2","type":"boolean"}},{"in":"query","name":"listener","required":true,"schema":{"title":"Listener","type":"string"}},{"in":"query","name":"listener-port","required":true,"schema":{"title":"Listener Port","type":"integer"}}],"responses":{"200":{"description":"Successfully added certificate to Load Balancer"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal Server Error"}},"tags":["Load Balancers"]}}},"components":{"schemas":{"CloudProviderEnum":{"description":"An enumeration.","enum":["aws","gcp","link11"],"title":"CloudProviderEnum","type":"string"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"Error":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"Error","type":"object"}}}}
```

## Detach certificate

> Detach a non-default certificate from the Load Balancer

```json
{"openapi":"3.0.2","info":{"title":"Link11 WAAP","version":"v4.3"},"paths":{"/api/v4.3/conf/{config}/load-balancers/{entry_name}/certificates":{"delete":{"operationId":"remove_certificate_from_load_balancer_api_v3_reblaze_config__config__load_balancers__load_balancer_name__certificates__delete_1218194429487707258","summary":"Detach certificate","description":"Detach a non-default certificate from the Load Balancer","parameters":[{"in":"path","name":"config","required":true,"schema":{"title":"Config","type":"string"}},{"in":"path","name":"entry_name","required":true,"schema":{"title":"Load Balancer Name","type":"string"}},{"in":"query","name":"provider","required":true,"schema":{"title":"Provider","type":"string"}},{"in":"query","name":"region","required":true,"schema":{"title":"Region","type":"string"}},{"in":"query","name":"certificate-id","required":false,"schema":{"title":"Certificate ID","type":"string"}},{"in":"query","name":"elbv2","required":false,"schema":{"default":true,"title":"ELB v2","type":"boolean"}},{"in":"query","name":"listener","required":false,"schema":{"title":"Listener","type":"string"}},{"in":"query","name":"listener-port","required":false,"schema":{"title":"Listener Port","type":"string"}}],"responses":{"200":{"description":"Successfully detached certificate from Load Balancer"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal Server Error"}},"tags":["Load Balancers"]}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"},"Error":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"Error","type":"object"}}}}
```

## Get available datacenters per region and Load Balancer

> Get regions with available datacenters for each Load Balancer.

```json
{"openapi":"3.0.2","info":{"title":"Link11 WAAP","version":"v4.3"},"paths":{"/api/v4.3/conf/{config}/load-balancers/regions":{"get":{"operationId":"get_load_balancers_regions_api_v4_config_load_balancers__get","summary":"Get available datacenters per region and Load Balancer","description":"Get regions with available datacenters for each Load Balancer.","parameters":[{"in":"path","name":"config","required":true,"schema":{"title":"Config","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"title":"Response Get Datacenters Regions Api v4.3 Reblaze Load Balancers","$ref":"#/components/schemas/LoadBalancerRegions"}}},"description":"Load Balancers retrieved successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputError"}}},"description":"Input Error"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal Server Error"}},"tags":["Load Balancers"]}}},"components":{"schemas":{"LoadBalancerRegions":{"properties":{"city_codes":{"items":{"type":"string"},"title":"City Names","type":"object"},"lbs":{"title":"Load Balancers","type":"array","items":{"$ref":"#/components/schemas/LoadBalancerRegion"}}},"required":["provider","name"],"type":"object"},"LoadBalancerRegion":{"properties":{"id":{"type":"integer","title":"LoadBalancer ID"},"regions":{"type":"object","title":"Current LoadBalancer Settings","items":{"type":"string"}},"name":{"type":"string","title":"LoadBalancer Name"},"upstream_regions":{"type":"array","title":"Available Datacenter Regions","items":{"type":"string"}}}},"InputError":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"InputError","type":"object"},"Error":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"Error","type":"object"}}}}
```

## Set preferred datacenters for each Load Balancer

> Set preferred datacenters for each Load Balancer. "automatic" will choose the best route depending on the load balancer location.

```json
{"openapi":"3.0.2","info":{"title":"Link11 WAAP","version":"v4.3"},"paths":{"/api/v4.3/conf/{config}/load-balancers/regions":{"post":{"operationId":"set_load_balancers_regions_api_v4_config_load_balancers__set","summary":"Set preferred datacenters for each Load Balancer","description":"Set preferred datacenters for each Load Balancer. \"automatic\" will choose the best route depending on the load balancer location.","parameters":[{"in":"path","name":"config","required":true,"schema":{"title":"Config","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"title":"LoadBalancers by ID, with LoadBalancer Region to Datacenter Region","properties":{"lbs":{"title":"LoadBalancers by ID","type":"array","items":{"type":"object","title":"LoadBalancer Region to Datacenter Region"}}},"required":["lbs"]}}}},"responses":{"200":{"content":{"application/json":{"schema":{"title":"Set Preferred Datacenters for each Load Balancers v4.3 Reblaze Load Balancers","properties":{"message":{"type":"string","title":"Message"}}}}},"description":"Load Balancers retrieved successfully"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InputError"}}},"description":"Input Error"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Internal Server Error"}},"tags":["Load Balancers"]}}},"components":{"schemas":{"InputError":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"InputError","type":"object"},"Error":{"properties":{"code":{"title":"Code","type":"integer"},"message":{"title":"Message","type":"string"}},"required":["code","message"],"title":"Error","type":"object"}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://waap.docs.link11.com/reference-information/api/namespace-reference/load-balancers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
