dots.v2.load_balancers.byLb_id().put()

Generated on 5 Nov 2026 from DoTs version v1.23.0

Usage

client.v2.load_balancers.byLb_id(lb_id).put(body: UntypedNode, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | WithLb_PutResponse>

Description

To update a load balancer’s settings, send a PUT request to /v2/load_balancers/{lb_id}. The request should contain a full representation of the load balancer including existing attributes. It may contain one of the droplets_ids or tag attributes as they are mutually exclusive. Note that any attribute that is not provided will be reset to its default value.

Parameters

Path Parameters

lb_id string required

Example: 4de7ac8b-495b-4884-9a69-1050c6793cd6

A unique identifier for a load balancer.

Min: 1

Request Body

body object required
Show child properties
dropletIds array of integers optional

Example: [3164444, 3164445]

An array containing the IDs of the Droplets assigned to the load balancer.

region string optional

The slug identifier for the region where the resource will initially be available.

One of: ams1, ams2, ams3, blr1, fra1, lon1, nyc1, nyc2, nyc3, sfo1, sfo2, sfo3, sgp1, tor1, syd1

id string optional read-only

Example: 4de7ac8b-495b-4884-9a69-1050c6793cd6

A unique ID that can be used to identify and reference a load balancer.

name string optional

Example: example-lb-01

A human-readable name for a load balancer instance.

projectId string optional

Example: 4de7ac8b-495b-4884-9a69-1050c6793cd6

The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. If an invalid project ID is provided, the load balancer will not be created.

ipv6 string optional read-only

Example: 2604:a880:800:14::85f5:c000

An attribute containing the public-facing IPv6 address of the load balancer.

sizeUnit integer optional

Example: 3

How many nodes the load balancer contains. Each additional node increases the load balancer's ability to manage more connections. Load balancers can be scaled up or down, and you can change the number of nodes after creation up to once per hour. This field is currently not available in the AMS2, NYC2, or SFO1 regions. Use the size field to scale load balancers that reside in these regions.

Default: 1

Min: 1

Max: 100

size string optional deprecated

This field has been replaced by the size_unit field for all regions except in AMS2, NYC2, and SFO1. Each available load balancer size now equates to the load balancer having a set number of nodes.
* lb-small = 1 node
* lb-medium = 3 nodes
* lb-large = 6 nodes

You can resize load balancers after creation up to once per hour. You cannot resize a load balancer within the first hour of its creation.

One of: lb-small, lb-medium, lb-large

Default: lb-small

algorithm string optional deprecated

This field has been deprecated. You can no longer specify an algorithm for load balancers.

One of: round_robin, least_connections

Default: round_robin

status string optional read-only

A status string indicating the current state of the load balancer. This can be new, active, or errored.

One of: new, active, errored

createdAt string optional read-only

Example: 2017-02-01T22:22:58Z

A time value given in ISO8601 combined date and time format that represents when the load balancer was created.

forwardingRules array of objects optional

An array of objects specifying the forwarding rules for a load balancer.

Show child properties
entryProtocol string required

The protocol used for traffic to the load balancer. The possible values are: http, https, http2, http3, tcp, or udp. If you set the entry_protocol to udp, the target_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

One of: http, https, http2, http3, tcp, udp

entryPort integer required

Example: 443

An integer representing the port on which the load balancer instance will listen.

targetProtocol string required

The protocol used for traffic from the load balancer to the backend Droplets. The possible values are: http, https, http2, tcp, or udp. If you set the target_protocol to udp, the entry_protocol must be set to udp. When using UDP, the load balancer requires that you set up a health check with a port that uses TCP, HTTP, or HTTPS to work properly.

One of: http, https, http2, tcp, udp

targetPort integer required

Example: 80

An integer representing the port on the backend Droplets to which the load balancer will send traffic.

certificateId string optional

Example: 892071a0-bb95-49bc-8021-3afd67a210bf

The ID of the TLS certificate used for SSL termination if enabled.

tlsPassthrough boolean optional

Example: false

A boolean value indicating whether SSL encrypted traffic will be passed through to the backend Droplets.

healthCheck object optional

An object specifying health check settings for the load balancer.

Show child properties
protocol string optional

The protocol used for health checks sent to the backend Droplets. The possible values are http, https, or tcp.

One of: http, https, tcp

Default: http

port integer optional

Example: 80

An integer representing the port on the backend Droplets on which the health check will attempt a connection.

Default: 80

path string optional

Example: /

The path on the backend Droplets to which the load balancer instance will send a request.

Default: /

checkIntervalSeconds integer optional

Example: 10

The number of seconds between between two consecutive health checks.

Default: 10

responseTimeoutSeconds integer optional

Example: 5

The number of seconds the load balancer instance will wait for a response until marking a health check as failed.

Default: 5

unhealthyThreshold integer optional

Example: 5

The number of times a health check must fail for a backend Droplet to be marked "unhealthy" and be removed from the pool.

Default: 5

healthyThreshold integer optional

Example: 3

The number of times a health check must pass for a backend Droplet to be marked "healthy" and be re-added to the pool.

Default: 3

stickySessions object optional

An object specifying sticky sessions settings for the load balancer.

Show child properties
type string optional

An attribute indicating how and if requests from a client will be persistently served by the same backend Droplet. The possible values are cookies or none.

One of: cookies, none

Default: none

cookieName string optional

Example: DO-LB

The name of the cookie sent to the client. This attribute is only returned when using cookies for the sticky sessions type.

cookieTtlSeconds integer optional

Example: 300

The number of seconds until the cookie set by the load balancer expires. This attribute is only returned when using cookies for the sticky sessions type.

redirectHttpToHttps boolean optional

Example: true

A boolean value indicating whether HTTP requests to the load balancer on port 80 will be redirected to HTTPS on port 443.

Default: false

enableProxyProtocol boolean optional

Example: true

A boolean value indicating whether PROXY Protocol is in use.

Default: false

enableBackendKeepalive boolean optional

Example: true

A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets.

Default: false

httpIdleTimeoutSeconds integer optional

Example: 90

An integer value which configures the idle timeout for HTTP requests to the target droplets.

Default: 60

Min: 30

Max: 600

vpcUuid string optional

Example: c33931f2-a26a-4e61-b85c-4e95a2ec431b

A string specifying the UUID of the VPC to which the load balancer is assigned.

subnetUuid string optional

Example: cbd79771-23eb-49be-b5ea-59cc56222622

A string specifying the UUID of the VPC subnet to which the load balancer is assigned.

disableLetsEncryptDnsRecords boolean optional

Example: true

A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer.

Default: false

firewall object optional

An object specifying allow and deny rules to control traffic to the load balancer.

Show child properties
deny array of strings optional

Example: ["ip:1.2.3.4", "cidr:2.3.0.0/16"]

the rules for denying traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')

Default: []

allow array of strings optional

Example: ["ip:1.2.3.4", "cidr:2.3.0.0/16"]

the rules for allowing traffic to the load balancer (in the form 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')

Default: []

network string optional

A string indicating whether the load balancer should be external or internal. Internal load balancers have no public IPs and are only accessible to resources on the same VPC network. This property cannot be updated after creating the load balancer.

One of: EXTERNAL, INTERNAL

Default: EXTERNAL

networkStack string optional

A string indicating whether the load balancer will support IPv4 or both IPv4 and IPv6 networking. This property cannot be updated after creating the load balancer.

One of: IPV4, DUALSTACK

Default: IPV4

type string optional

A string indicating whether the load balancer should be a standard regional HTTP load balancer, a regional network load balancer that routes traffic at the TCP/UDP transport layer, or a global load balancer.

One of: REGIONAL, REGIONAL_NETWORK, GLOBAL

Default: REGIONAL

domains array of objects optional

An array of objects specifying the domain configurations for a Global load balancer.

Show child properties
name string optional

Example: example.com

FQDN to associate with a Global load balancer.

isManaged boolean optional

Example: true

A boolean value indicating if the domain is already managed by DigitalOcean. If true, all A and AAAA records required to enable Global load balancers will be automatically added.

certificateId string optional

Example: 892071a0-bb95-49bc-8021-3afd67a210bf

The ID of the TLS certificate used for SSL termination.

glbSettings object optional

An object specifying forwarding configurations for a Global load balancer.

Show child properties
targetProtocol string optional

The protocol used for forwarding traffic from the load balancer to the target backends. The possible values are http, https and http2.

One of: http, https, http2

targetPort integer optional

Example: 80

An integer representing the port on the target backends which the load balancer will forward traffic to.

cdn object optional

An object specifying CDN configurations for a Global load balancer.

Show child properties
isEnabled boolean optional

Example: true

A boolean flag to enable CDN caching.

regionPriorities object optional

Example: {"nyc1": 1, "fra1": 2, "sgp1": 3}

A map of region string to an integer priority value indicating preference for which regional target a Global load balancer will forward traffic to. A lower value indicates a higher priority.

failoverThreshold integer optional

Example: 50

An integer value as a percentage to indicate failure threshold to decide how the regional priorities will take effect. A value of 50 would indicate that the Global load balancer will choose a lower priority region to forward traffic to once this failure threshold has been reached for the higher priority region.

targetLoadBalancerIds array of strings optional

Example: ["7dbf91fe-cbdb-48dc-8290-c3a181554905", "996fa239-fac3-42a2-b9a1-9fa822268b7a"]

An array containing the UUIDs of the Regional load balancers to be used as target backends for a Global load balancer.

tlsCipherPolicy string optional

A string indicating the policy for the TLS cipher suites used by the load balancer. The possible values are DEFAULT or STRONG. The default value is DEFAULT.

One of: DEFAULT, STRONG

Default: DEFAULT

tag string optional

Example: prod:web

The name of a Droplet tag corresponding to Droplets assigned to the load balancer.

Response Example

Show Response Example
{
  "load_balancer": {
    "id": "4de7ac8b-495b-4884-9a69-1050c6793cd6",
    "name": "updated-example-lb-01",
    "ip": "104.131.186.241",
    "size": "lb-small",
    "algorithm": "round_robin",
    "status": "new",
    "created_at": "2017-02-01T22:22:58Z",
    "forwarding_rules": [
      {
        "entry_protocol": "http",
        "entry_port": 80,
        "target_protocol": "http",
        "target_port": 80,
        "certificate_id": "",
        "tls_passthrough": false
      },
      {
        "entry_protocol": "https",
        "entry_port": 443,
        "target_protocol": "https",
        "target_port": 443,
        "certificate_id": "",
        "tls_passthrough": true
      }
    ],
    "health_check": {
      "protocol": "http",
      "port": 80,
      "path": "/",
      "check_interval_seconds": 10,
      "response_timeout_seconds": 5,
      "healthy_threshold": 5,
      "unhealthy_threshold": 3
    },
    "sticky_sessions": {
      "type": "none"
    },
    "region": {
      "name": "New York 3",
      "slug": "nyc3",
      "sizes": [
        "s-1vcpu-1gb",
        "s-1vcpu-2gb",
        "s-1vcpu-3gb",
        "s-2vcpu-2gb",
        "s-3vcpu-1gb",
        "s-2vcpu-4gb",
        "s-4vcpu-8gb",
        "s-6vcpu-16gb",
        "s-8vcpu-32gb",
        "s-12vcpu-48gb",
        "s-16vcpu-64gb",
        "s-20vcpu-96gb",
        "s-24vcpu-128gb",
        "s-32vcpu-192gb"
      ],
      "features": [
        "private_networking",
        "backups",
        "ipv6",
        "metadata",
        "install_agent"
      ],
      "available": true
    },
    "tag": "",
    "droplet_ids": [
      3164444,
      3164445
    ],
    "redirect_http_to_https": false,
    "enable_proxy_protocol": true,
    "enable_backend_keepalive": true,
    "vpc_uuid": "c33931f2-a26a-4e61-b85c-4e95a2ec431b",
    "subnet_uuid": "cbd79771-23eb-49be-b5ea-59cc56222622",
    "disable_lets_encrypt_dns_records": false,
    "project_id": "9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
    "http_idle_timeout_seconds": 60,
    "firewall": {
      "deny": [
        "cidr:1.2.0.0/16",
        "ip:2.3.4.5"
      ],
      "allow": [
        "ip:1.2.3.4",
        "cidr:2.3.4.0/24"
      ]
    }
  }
}

More Information

See /v2/load_balancers/{lb_id} in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.