POST /load_balancers/{id}/actions/add_target

Adds a target to a Load Balancer.

Call specific error codes

CodeDescription
cloud_resource_ip_not_allowedThe IP you are trying to add as a target belongs to a Hetzner Cloud resource
ip_not_ownedThe IP you are trying to add as a target is not owned by the Project owner
load_balancer_not_attached_to_networkThe Load Balancer is not attached to a network
robot_unavailableRobot was not available. The caller may retry the operation after a short delay.
server_not_attached_to_networkThe server you are trying to add as a target is not attached to the same network as the Load Balancer
missing_ipv4The server that you are trying to add as a public target does not have a public IPv4 address
target_already_definedThe Load Balancer target you are trying to define is already defined

Servers

Path parameters

Name Type Required Description
id Integer Yes

ID of the Load Balancer.

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
label_selector Object No

Configuration for label selector targets, only valid and required if type is label_selector.

label_selector.selector String Yes

Label selector

type String Yes

Type of the resource

Possible values:

  • "server"
  • "ip"
  • "label_selector"
server Object No

Configuration for type Server, only valid and required if type is server.

server.id Integer Yes

ID of the Server

use_private_ip Boolean No

Use the private network IP instead of the public IP of the Server, requires the Server and Load Balancer to be in the same network.

Default value: false

ip Object No

Configuration for an IP target. It is only possible to use the (Public or vSwitch) IPs of Hetzner Online Root Servers belonging to the project owner. IPs belonging to other users are blocked. Additionally IPs belonging to services provided by Hetzner Cloud (Servers, Load Balancers, ...) are blocked as well. Only valid and required if type is ip.

ip.ip String Yes

IP of a server that belongs to the same customer (public IPv4/IPv6) or private IP in a subnet type vswitch.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. 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.
  3. Click Test request to test run your request to the API and see the API's response.