---
title: "Load balancers — API reference"
description: "Managed L4/L7 load balancer for your cloud servers: services, health checks, targets, free Let's Encrypt certificates, metrics. EU regions."
url: https://www.gyrohosting.com/developers/en/api/load-balancers.html
language: en
openapi: https://www.gyrohosting.com/developers/openapi.json
api_version: 2.30.0
---

# Load balancers

Managed L4/L7 load balancer for your cloud servers: services, health checks, targets, free Let's Encrypt certificates, metrics. EU regions.

Base URL: `https://www.gyrohosting.com/api/v1/client` · OpenAPI: https://www.gyrohosting.com/developers/openapi.json


## GET /cloud/load-balancer-types

**List load balancer sizes and prices** · operationId `listLoadBalancerTypes` · scope `cloud_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listLoadBalancerTypes.json

Orderable sizes (small/medium/large) with limits, regions and EUR prices per cycle (excl. VAT); `list_amount` is the strike-through list price.


### Responses

- **200**: Sizes
- **401**: Missing, invalid or revoked key

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancer-types' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb types
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancer-types", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancer-types", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers

**List load balancers** · operationId `listLoadBalancers` · scope `cloud_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/listLoadBalancers.json




### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `page` | query | integer |  |
| `limit` | query | integer |  |
| `status` | query | string |  |

### Responses

- **200**: Load balancers
- **401**: Missing, invalid or revoked key

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb list
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers

**Order a load balancer** · operationId `createLoadBalancer` · scope `cloud_order` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/createLoadBalancer.json

Orders and pays from the account balance (same money rules as servers): `"confirm": true`, an `Idempotency-Key` header, `dry_run` for a quote. Ready in about a minute; then add services and targets.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `Idempotency-Key` | header | string |  |

### Request body

| Field | Type | Description |
|---|---|---|
| `size` | string (small, medium, large) |  |
| `product_id` | integer |  |
| `region` | string (eu-de-1, eu-de-2, eu-fi-1) |  |
| `cycle` | string |  |
| `end_customer_id` | integer |  |
| `dry_run` | boolean |  |
| `confirm` | boolean |  |
| `project_id` | integer | Optional project for the new service(s) (0 = default project). Checked before the order: unknown id = 404 `project_not_found` (GyroAPI order endpoints) or 422 `checkout_blocked` with `[project_not_found]` (POST /orders). |

### Responses

- **201**: Ordered
- **200**: Quote (dry_run)
- **400**: Malformed request (e.g. missing Idempotency-Key)
- **401**: Missing, invalid or revoked key
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"size": "small", "product_id": 1, "region": "eu-de-1", "cycle": "string", "end_customer_id": 1, "dry_run": true, "confirm": true, "project_id": 1}'
```
```bash
gyro lb create --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
h["Idempotency-Key"] = str(uuid.uuid4())
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers", headers=h, json={"size": "small", "product_id": 1, "region": "eu-de-1", "cycle": "string", "end_customer_id": 1, "dry_run": True, "confirm": True, "project_id": 1}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({"size": "small", "product_id": 1, "region": "eu-de-1", "cycle": "string", "end_customer_id": 1, "dry_run": true, "confirm": true, "project_id": 1}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers/{id}

**Get a load balancer** · operationId `getLoadBalancer` · scope `cloud_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/getLoadBalancer.json




### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |

### Responses

- **200**: Load balancer
- **401**: Missing, invalid or revoked key
- **404**: Not found — also returned for objects owned by someone else

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb get 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/load-balancers/{id}

**Delete (cancel) a load balancer** · operationId `deleteLoadBalancer` · scope `cloud_delete` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/deleteLoadBalancer.json

`confirm=true` required. `immediate=true` cancels now: traffic and billing stop, the load balancer and its certificates are deleted permanently at once. Without immediate a cancellation request is filed.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer |  |
| `confirm` | query | boolean |  |
| `immediate` | query | boolean |  |

### Responses

- **202**: Cancelling
- **401**: Missing, invalid or revoked key
- **404**: Not found — also returned for objects owned by someone else
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb delete 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers/{id}/services

**List services (ports) of a load balancer** · operationId `typed_get_load_balancers__id__services` · scope `services_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_get_load_balancers__id__services.json

Services with health check and HTTP options, plus the certificates of this load balancer and its limits.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Responses

- **200**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb service list 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers/{id}/services

**Add a service** · operationId `typed_post_load_balancers__id__services` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_post_load_balancers__id__services.json

Adds a listener. HTTPS needs at least one certificate of this load balancer; TLS ends at the load balancer and targets get HTTP. Use TCP 443 for passthrough.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `protocol` (required) | string (tcp, http, https) |  |
| `listen_port` (required) | integer | Port the load balancer listens on |
| `destination_port` (required) | integer | Port on the targets |
| `proxyprotocol` | boolean | Send PROXY protocol header to targets |
| `hc_protocol` | string (tcp, http) | Health check type |
| `hc_port` | integer |  |
| `hc_interval` | integer | 3-60 s |
| `hc_timeout` | integer | 1-30 s, below interval |
| `hc_retries` | integer | 0-5 |
| `hc_path` | string | HTTP check path (starts with /) |
| `hc_domain` | string | HTTP check Host header |
| `hc_status_codes` | string | Comma separated, e.g. 2??,3?? |
| `hc_tls` | boolean | HTTP check over TLS |
| `sticky` | boolean | Sticky sessions (cookie) |
| `cookie_name` | string |  |
| `cookie_lifetime` | integer |  |
| `idle_timeout` | integer | Idle timeout (s) |
| `certificates` | string | HTTPS: comma separated certificate ids of this load balancer |
| `redirect_http` | boolean | HTTPS: redirect port 80 to HTTPS (port 80 must be free) |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"protocol": "tcp", "listen_port": 1, "destination_port": 1, "proxyprotocol": true, "hc_protocol": "tcp", "hc_port": 1, "hc_interval": 1, "hc_timeout": 1, "hc_retries": 1, "hc_path": "string", "hc_domain": "string", "hc_status_codes": "string", "hc_tls": true, "sticky": true, "cookie_name": "string", "cookie_lifetime": 1, "idle_timeout": 1, "certificates": "string", "redirect_http": true, "confirm": true}'
```
```bash
gyro lb service add 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services", headers=h, json={"protocol": "tcp", "listen_port": 1, "destination_port": 1, "proxyprotocol": True, "hc_protocol": "tcp", "hc_port": 1, "hc_interval": 1, "hc_timeout": 1, "hc_retries": 1, "hc_path": "string", "hc_domain": "string", "hc_status_codes": "string", "hc_tls": True, "sticky": True, "cookie_name": "string", "cookie_lifetime": 1, "idle_timeout": 1, "certificates": "string", "redirect_http": True, "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"protocol": "tcp", "listen_port": 1, "destination_port": 1, "proxyprotocol": true, "hc_protocol": "tcp", "hc_port": 1, "hc_interval": 1, "hc_timeout": 1, "hc_retries": 1, "hc_path": "string", "hc_domain": "string", "hc_status_codes": "string", "hc_tls": true, "sticky": true, "cookie_name": "string", "cookie_lifetime": 1, "idle_timeout": 1, "certificates": "string", "redirect_http": true, "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## PATCH /cloud/load-balancers/{id}/services/{port}

**Update a service** · operationId `typed_patch_load_balancers__id__services__port` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_patch_load_balancers__id__services__port.json

Changes options of the service on {port}. The protocol cannot change (delete and add).


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |
| `port` (required) | path | string | Listen port |

### Request body

| Field | Type | Description |
|---|---|---|
| `destination_port` | integer | Port on the targets |
| `proxyprotocol` | boolean | Send PROXY protocol header to targets |
| `hc_protocol` | string (tcp, http) | Health check type |
| `hc_port` | integer |  |
| `hc_interval` | integer | 3-60 s |
| `hc_timeout` | integer | 1-30 s, below interval |
| `hc_retries` | integer | 0-5 |
| `hc_path` | string | HTTP check path (starts with /) |
| `hc_domain` | string | HTTP check Host header |
| `hc_status_codes` | string | Comma separated, e.g. 2??,3?? |
| `hc_tls` | boolean | HTTP check over TLS |
| `sticky` | boolean | Sticky sessions (cookie) |
| `cookie_name` | string |  |
| `cookie_lifetime` | integer |  |
| `idle_timeout` | integer | Idle timeout (s) |
| `certificates` | string | HTTPS: comma separated certificate ids of this load balancer |
| `redirect_http` | boolean | HTTPS: redirect port 80 to HTTPS (port 80 must be free) |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X PATCH 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services/1' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"destination_port": 1, "proxyprotocol": true, "hc_protocol": "tcp", "hc_port": 1, "hc_interval": 1, "hc_timeout": 1, "hc_retries": 1, "hc_path": "string", "hc_domain": "string", "hc_status_codes": "string", "hc_tls": true, "sticky": true, "cookie_name": "string", "cookie_lifetime": 1, "idle_timeout": 1, "certificates": "string", "redirect_http": true, "confirm": true}'
```
```bash
gyro lb service update 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.patch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services/1", headers=h, json={"destination_port": 1, "proxyprotocol": True, "hc_protocol": "tcp", "hc_port": 1, "hc_interval": 1, "hc_timeout": 1, "hc_retries": 1, "hc_path": "string", "hc_domain": "string", "hc_status_codes": "string", "hc_tls": True, "sticky": True, "cookie_name": "string", "cookie_lifetime": 1, "idle_timeout": 1, "certificates": "string", "redirect_http": True, "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services/1", {
  method: "PATCH",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"destination_port": 1, "proxyprotocol": true, "hc_protocol": "tcp", "hc_port": 1, "hc_interval": 1, "hc_timeout": 1, "hc_retries": 1, "hc_path": "string", "hc_domain": "string", "hc_status_codes": "string", "hc_tls": true, "sticky": true, "cookie_name": "string", "cookie_lifetime": 1, "idle_timeout": 1, "certificates": "string", "redirect_http": true, "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/load-balancers/{id}/services/{port}

**Delete a service** · operationId `typed_delete_load_balancers__id__services__port` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_delete_load_balancers__id__services__port.json

Stops listening on {port}. Needs `"confirm": true`.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |
| `port` (required) | path | string | Listen port |

### Request body

| Field | Type | Description |
|---|---|---|
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services/1' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirm": true}'
```
```bash
gyro lb service delete 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services/1", headers=h, json={"confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/services/1", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers/{id}/targets

**List targets with health** · operationId `typed_get_load_balancers__id__targets` · scope `services_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_get_load_balancers__id__targets.json

Targets, per-service health (healthy/unhealthy/unknown), and the cloud servers / dedicated IPs that can be added.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Responses

- **200**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb target list 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers/{id}/targets

**Add a target** · operationId `typed_post_load_balancers__id__targets` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_post_load_balancers__id__targets.json

type=server (server = your cloud server id, same region), type=all (all your cloud servers, new ones join automatically) or type=ip (your dedicated server IP). use_private_ip needs a private network attached.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `type` (required) | string (server, all, ip) |  |
| `server` | integer | Cloud server id (type=server) |
| `ip` | string | Dedicated server IP (type=ip) |
| `use_private_ip` | boolean |  |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type": "server", "server": 1, "ip": "string", "use_private_ip": true, "confirm": true}'
```
```bash
gyro lb target add 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets", headers=h, json={"type": "server", "server": 1, "ip": "string", "use_private_ip": True, "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"type": "server", "server": 1, "ip": "string", "use_private_ip": true, "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/load-balancers/{id}/targets

**Remove a target** · operationId `typed_delete_load_balancers__id__targets` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_delete_load_balancers__id__targets.json

Same fields as add, in the query string (?type=server&server=123&confirm=true) or the JSON body. Needs `"confirm": true`.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |
| `type` | query | string | server / all / ip |
| `server` | query | string | Cloud server id |
| `ip` | query | string | Dedicated server IP |

### Request body

| Field | Type | Description |
|---|---|---|
| `type` | string |  |
| `server` | integer |  |
| `ip` | string |  |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type": "string", "server": 1, "ip": "string", "confirm": true}'
```
```bash
gyro lb target remove 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets", headers=h, json={"type": "string", "server": 1, "ip": "string", "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/targets", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"type": "string", "server": 1, "ip": "string", "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers/{id}/certificates

**List certificates** · operationId `typed_get_load_balancers__id__certificates` · scope `services_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_get_load_balancers__id__certificates.json

Uploaded and Let's Encrypt certificates (Let's Encrypt ones renew automatically), a pending Let's Encrypt request and the validation redirect base URL.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Responses

- **200**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb cert list 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers/{id}/certificates

**Upload a certificate** · operationId `typed_post_load_balancers__id__certificates` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_post_load_balancers__id__certificates.json

PEM certificate chain + unencrypted private key. The key is sent to the load balancer only; it is never stored or logged by the panel.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `name` | string |  |
| `certificate` (required) | string | PEM chain |
| `private_key` (required) | string | PEM key (unencrypted) |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "string", "certificate": "string", "private_key": "string", "confirm": true}'
```
```bash
gyro lb cert upload 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates", headers=h, json={"name": "string", "certificate": "string", "private_key": "string", "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"name": "string", "certificate": "string", "private_key": "string", "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers/{id}/certificates/letsencrypt

**Request a free Let's Encrypt certificate** · operationId `typed_post_load_balancers__id__certificates_letsencrypt` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_post_load_balancers__id__certificates_letsencrypt.json

Up to 10 names whose A record points to this load balancer. Your targets must redirect /.well-known/acme-challenge/<token> to the redirect base shown in GET certificates; answer `acme=waiting` lists the per-name check, fix the redirect and call verify.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `domains` (required) | string | Comma separated names |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"domains": "string", "confirm": true}'
```
```bash
gyro lb cert letsencrypt 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt", headers=h, json={"domains": "string", "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"domains": "string", "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/load-balancers/{id}/certificates/letsencrypt

**Cancel a pending Let's Encrypt request** · operationId `typed_delete_load_balancers__id__certificates_letsencrypt` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_delete_load_balancers__id__certificates_letsencrypt.json

Drops the pending order. Needs `"confirm": true`.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirm": true}'
```
```bash
gyro lb cert cancel 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt", headers=h, json={"confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers/{id}/certificates/letsencrypt/verify

**Continue a pending Let's Encrypt request** · operationId `typed_post_load_balancers__id__certificates_letsencrypt_verify` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_post_load_balancers__id__certificates_letsencrypt_verify.json

Re-checks the redirect, lets the CA validate and uploads the certificate (`acme=issued`).


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt/verify' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirm": true}'
```
```bash
gyro lb cert verify 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt/verify", headers=h, json={"confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/letsencrypt/verify", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/load-balancers/{id}/certificates/{cid}

**Delete a certificate** · operationId `typed_delete_load_balancers__id__certificates__cid` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_delete_load_balancers__id__certificates__cid.json

Only certificates not used by a service. Needs `"confirm": true`.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |
| `cid` (required) | path | string | Certificate id |

### Request body

| Field | Type | Description |
|---|---|---|
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/1' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirm": true}'
```
```bash
gyro lb cert delete 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/1", headers=h, json={"confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/certificates/1", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers/{id}/settings

**Algorithm, reverse DNS, private network** · operationId `typed_get_load_balancers__id__settings` · scope `services_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_get_load_balancers__id__settings.json

Current algorithm, PTR records, your private networks in the same region (attached or not) and limits.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Responses

- **200**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/settings' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb settings 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/settings", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/settings", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## PUT /cloud/load-balancers/{id}/algorithm

**Change the balancing algorithm** · operationId `typed_put_load_balancers__id__algorithm` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_put_load_balancers__id__algorithm.json

round_robin or least_connections.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `algorithm` (required) | string (round_robin, least_connections) |  |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X PUT 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/algorithm' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"algorithm": "round_robin", "confirm": true}'
```
```bash
gyro lb algorithm set 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.put("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/algorithm", headers=h, json={"algorithm": "round_robin", "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/algorithm", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"algorithm": "round_robin", "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## PUT /cloud/load-balancers/{id}/rdns

**Set reverse DNS** · operationId `typed_put_load_balancers__id__rdns` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_put_load_balancers__id__rdns.json

PTR for one of the load balancer's IPs; empty ptr restores the default.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `ip` (required) | string |  |
| `ptr` | string |  |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X PUT 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/rdns' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ip": "string", "ptr": "string", "confirm": true}'
```
```bash
gyro lb rdns set 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.put("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/rdns", headers=h, json={"ip": "string", "ptr": "string", "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/rdns", {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"ip": "string", "ptr": "string", "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## POST /cloud/load-balancers/{id}/network

**Attach to a private network** · operationId `typed_post_load_balancers__id__network` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_post_load_balancers__id__network.json

One of your private networks in the same region (GET settings).


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |

### Request body

| Field | Type | Description |
|---|---|---|
| `network` (required) | integer |  |
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X POST 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/network' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"network": 1, "confirm": true}'
```
```bash
gyro lb network attach 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.post("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/network", headers=h, json={"network": 1, "confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/network", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"network": 1, "confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## DELETE /cloud/load-balancers/{id}/network/{nid}

**Detach from a private network** · operationId `typed_delete_load_balancers__id__network__nid` · scope `services_write` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_delete_load_balancers__id__network__nid.json

Targets that use private IPs must be removed first. Needs `"confirm": true`.


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |
| `nid` (required) | path | string | Private network id |

### Request body

| Field | Type | Description |
|---|---|---|
| `confirm` | boolean |  |

### Responses

- **202**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s -X DELETE 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/network/1' \
  -H "Authorization: Bearer $GYRO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"confirm": true}'
```
```bash
gyro lb network detach 12345 --help    # all flags
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.delete("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/network/1", headers=h, json={"confirm": True}, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/network/1", {
  method: "DELETE",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"confirm": true}),
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```


## GET /cloud/load-balancers/{id}/metrics

**Load balancer metrics** · operationId `typed_get_load_balancers__id__metrics` · scope `services_read` · OpenAPI fragment: https://www.gyrohosting.com/developers/spec/ops/typed_get_load_balancers__id__metrics.json

Open connections, new connections/s, requests/s, bandwidth in/out (Mbit/s).


### Parameters

| Field | in | Type | Description |
|---|---|---|---|
| `id` (required) | path | integer | Service id |
| `period` | query | string | 24h / 7d / 30d |

### Responses

- **200**: Tool data / result
- **404**: Not found — also returned for objects owned by someone else
- **409**: State conflict (`server_locked`, `not_actionable`, `ssh_key_exists`, `server_limit`, `idempotency_in_flight`)
- **422**: Validation or business rule failure (`confirm_required`, `invalid_image`, `tool_action_failed` ...)

### Examples

```bash
curl -s 'https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/metrics' \
  -H "Authorization: Bearer $GYRO_TOKEN"
```
```bash
gyro lb metrics 12345
```
```hcl
# resource gyro_load_balancer: https://registry.terraform.io/providers/gyro-hosting/gyro/latest/docs/resources/load_balancer
# Two cloud servers behind a managed load balancer (EU regions: eu-de-1, eu-de-2, eu-fi-1).
resource "gyro_server" "web" {
  count         = 2
  plan          = "standart-2-4"
  region        = "eu-de-1"
  image         = "ubuntu-24.04"
  hostname      = "web-${count.index + 1}.example.com"
  confirm_order = true
}

resource "gyro_load_balancer" "web" {
  size          = "small" # small | medium | large (GET /cloud/load-balancer-types)
  region        = "eu-de-1"
  algorithm     = "least_connections"
  confirm_order = true # creating a load balancer is a paid order from your account balance

  services = [
    {
      protocol         = "http"
      listen_port      = 80
      destination_port = 80
      sticky_sessions  = true
      health_check     = { protocol = "http", path = "/healthz", interval = 10, timeout = 5, retries = 3 }
    },
    {
      # TLS passthrough: certificates stay on the servers
      protocol         = "tcp"
      listen_port      = 443
      destination_port = 443
    },
  ]

  targets = [for s in gyro_server.web : { type = "server", server_id = tonumber(s.id) }]
}

output "load_balancer_ip" {
  value = gyro_load_balancer.web.ipv4 # point your A record here
}
```
```python
import os, uuid, requests

h = {"Authorization": "Bearer " + os.environ["GYRO_TOKEN"]}
r = requests.get("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/metrics", headers=h, timeout=60)
r.raise_for_status()
print(r.json()["data"])
```
```js
const res = await fetch("https://www.gyrohosting.com/api/v1/client/cloud/load-balancers/12345/metrics", {
  method: "GET",
  headers: {
    "Authorization": `Bearer ${process.env.GYRO_TOKEN}`,
  },
});
const { data, error } = await res.json();
if (!res.ok) throw new Error(`${error.code}: ${error.message}`);
```
