Create a load balancer target

Add a target to a load balancer. A running load balancer starts sending traffic to it shortly after. When a selector matches more servers than the load balancer's type allows, the load balancer keeps its previous configuration. The load balancer's status_message says why.

POST https://{availability_zone}.betterstackcloud.com/v1/load-balancers/{load_balancer_id}/targets
load_balancer_id string required

The ID of the load balancer.

Authorization string required

Bearer $TOKEN

Content-Type string

application/json

type string required

What the target points at.
Valid values:
server: One server. Send server_id and leave out selector.
label_selector: Every server whose metadata matches selector. Send selector and leave out server_id.

server_id string or null

The ID of the server to send traffic to. The server must be in the load balancer's team. A load balancer can have each server as a target once.

selector object or null

The tags a server must have to receive traffic, as string pairs. A server must have every pair. Keys and values can't be empty. Accepts any keys.

use_private_ip boolean default: false

Whether to send traffic to the servers' private IP on a network they share with the load balancer, instead of their public IP.

201 Created
{
  "id": 1,
  "type": "label_selector",
  "server_id": "123456789",
  "selector": {
    "role": "web"
  },
  "use_private_ip": false,
  "created_at": "2026-07-01T12:00:00.000Z",
  "updated_at": "2026-07-01T12:00:00.000Z"
}

Returns the newly created load balancer target.

id integer

The target's ID.

type string

What the target points at.
Valid values:
server: One server. Send server_id and leave out selector.
label_selector: Every server whose metadata matches selector. Send selector and leave out server_id.

server_id string or null

The ID of the server to send traffic to.

selector object or null

The tags a server must have to receive traffic, as string pairs. A server must have every pair.

use_private_ip boolean

Whether to send traffic to the servers' private IP on a network they share with the load balancer, instead of their public IP.

created_at datetime

When the target was added. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

updated_at datetime

When the target was last updated. In ISO 8601 format, such as 2026-07-01T12:00:00Z.