---
title: pydo.load_balancers.add_forwarding_rules()
description: Add Forwarding Rules to a Load Balancer
product: Reference
url: https://docs.digitalocean.com/reference/pydo/reference/load_balancers/add_forwarding_rules/
last_updated: "2026-10-01"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# pydo.load_balancers.add_forwarding_rules()

Generated on 1 Oct 2026 from `pydo` version [`v0.43.0`](https://github.com/digitalocean/pydo/releases/tag/v0.43.0v0.43.0)

## Usage

```python
client.load_balancers.add_forwarding_rules(
    lb_id="4de7ac8b-495b-4884-9a69-1050c6793cd6",
    body={
        "forwarding_rules": [...],
    },
)
```

Returns `None`Raises `HttpResponseError`

## Description

To add an additional forwarding rule to a load balancer instance, send a POST request to [`/v2/load_balancers/{lb_id}/forwarding_rules`](https://docs.digitalocean.com/reference/api/reference/load-balancers/index.html.md). In the body of the request, there should be a `forwarding_rules` attribute containing an array of rules to be added.

No response body will be sent back, but the response code will indicate success. Specifically, the response code will be a 204, which means that the action was successful with no returned body data.

## Parameters

`lb_id` string required

A unique identifier for a load balancer.

Min: `1`

`forwarding_rules` array of objects required

## Show child properties

`entry_protocol` 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`

`entry_port` integer required

Example: `443`

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

`target_protocol` 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`

`target_port` integer required

Example: `80`

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

`certificate_id` string optional

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

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

`tls_passthrough` boolean optional

Example: `False`

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

## Request Sample

## Show Request Sample

```python
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "forwarding_rules": [
    {
      "entry_protocol": "https",
      "entry_port": 443,
      "target_protocol": "http",
      "target_port": 80,
      "certificate_id": "892071a0-bb95-49bc-8021-3afd67a210bf",
      "tls_passthrough": False
    }
  ]
}

resp = client.load_balancers.add_forwarding_rules(lb_id="1fd32a", body=req)
```

## More Information

See [`/v2/load_balancers/{lb_id}/forwarding_rules`](https://docs.digitalocean.com/reference/api/reference/load-balancers/index.html.md#loadBalancers_add_forwardingRules) in the API reference for additional detail on responses, headers, parameters, and more.