Load Balancer Actions

Add Target

Adds a target to a Load Balancer.

Operation specific errors

StatusCodeDescription
422ip_not_in_vswitch_subnetThe IP you are trying to add does not belong to the vswitch subnet of the attached network
422ip_not_ownedThe IP you are trying to add as a target is not owned by the Project owner
422ip_not_assigned_to_serverThe specified IP is neither the Primary IPv4 address nor in the IPv6 subnet of the given Server
422load_balancer_public_interface_disabledThe Load Balancer's public network interface is disabled
422load_balancer_not_attached_to_networkThe Load Balancer is not attached to a network
422network_has_no_vswitch_subnetThe given IP is private but attached network does not have a vswitch subnet
422resolve_cloud_private_targets_errorThe server you are trying to add as a target is not attached to the same network as the Load Balancer
422resolve_cloud_public_targets_errorThe server that you are trying to add as a public target does not have a public IPv4 address
422target_already_definedThe Load Balancer target you are trying to define is already defined
post/load_balancers/{id}/actions/add_target

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/load_balancers/{id}/actions/add_target
  • Auth: HTTP bearer

Path parameters

idinteger required

ID of the Load Balancer.

Example:42

ID of the Load Balancer.

Request body

type'server' | 'label_selector' | 'ip' required

Type of the resource.

use_private_ipboolean

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. Only valid for target types server and label_selector.

Example request

{
  "server": {
    "id": 80,
    "ip": "2001:db8::1"
  },
  "label_selector": {
    "selector": "env=prod"
  },
  "ip": {
    "ip": "203.0.113.1"
  },
  "use_private_ip": true
}

Response

Request succeeded.

Example response

{
  "action": {
    "id": 42,
    "command": "start_resource",
    "started": "2016-01-30T23:55:00Z",
    "finished": "2016-01-30T23:55:00Z",
    "progress": 100,
    "resources": [
      {
        "id": 42,
        "type": "server"
      }
    ],
    "error": {
      "code": "action_failed",
      "message": "Action failed"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.