Skip to main content
POST
/
cloud
/
v1
/
loadbalancers
/
{project_id}
/
{region_id}
Create load balancer
curl --request POST \
  --url https://api.gcore.com/cloud/v1/loadbalancers/{project_id}/{region_id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "new_load_balancer",
  "flavor": "lb1-1-2",
  "floating_ip": {
    "existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d",
    "source": "existing"
  },
  "listeners": [
    {
      "name": "my_listener",
      "protocol_port": 80,
      "allowed_cidrs": [
        "10.0.0.0/8"
      ],
      "connection_limit": 100000,
      "insert_x_forwarded": false,
      "pools": [
        {
          "name": "pool_name",
          "ca_secret_id": "<string>",
          "crl_secret_id": "<string>",
          "healthmonitor": {
            "delay": 10,
            "domain_name": "example.com",
            "http_method": "GET",
            "http_version": "1.1",
            "max_retries": 3,
            "max_retries_down": 3,
            "timeout": 5,
            "type": "HTTP",
            "url_path": "/"
          },
          "members": [
            {
              "address": "192.168.1.101",
              "instance_id": "a7e7e8d6-0bf7-4ac9-8170-831b47ee2ba9",
              "protocol_port": 8000,
              "weight": 2
            },
            {
              "address": "192.168.1.102",
              "instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd",
              "protocol_port": 8000,
              "weight": 4
            }
          ],
          "secret_id": "<string>",
          "session_persistence": {
            "cookie_name": "cookie_name",
            "type": "APP_COOKIE"
          },
          "timeout_client_data": 50000,
          "timeout_member_connect": 50000,
          "timeout_member_data": 43200000
        }
      ],
      "secret_id": "f2e734d0-fa2b-42c2-ad33-4c6db5101e00",
      "sni_secret_id": [
        "f2e734d0-fa2b-42c2-ad33-4c6db5101e00",
        "eb121225-7ded-4ff3-ae1f-599e145dd7cb"
      ],
      "timeout_client_data": 50000,
      "timeout_member_connect": 50000,
      "timeout_member_data": null,
      "user_list": [
        {
          "encrypted_password": "$5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5",
          "username": "admin"
        }
      ]
    }
  ],
  "logging": {
    "destination_region_id": 1,
    "enabled": true,
    "retention_policy": {
      "period": 45
    },
    "topic_name": "my-log-name"
  },
  "preferred_connectivity": "L2",
  "tags": {},
  "vip_network_id": "ac307687-31a4-4a11-a949-6bea1b2878f5",
  "vip_port_id": "ff83e13a-b256-4be2-ba5d-028d3f0ab450",
  "vip_subnet_id": "4e7802d3-5023-44b8-b298-7726558fddf4"
}
'
{
  "tasks": [
    "d478ae29-dedc-4869-82f0-96104425f565"
  ]
}

Documentation Index

Fetch the complete documentation index at: https://gcore.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

API key for authentication. Make sure to include the word apikey, followed by a single space and then your token. Example: apikey 1234$abcdef

Path Parameters

project_id
integer
required

Project ID

Example:

1

region_id
integer
required

Region ID

Example:

7

Body

application/json
name
string
required

Load balancer name.

Pattern: ^[a-zA-Z0-9][a-zA-Z 0-9._\-]{1,61}[a-zA-Z0-9._]$
Example:

"new_load_balancer"

flavor
string

Load balancer flavor name

Examples:

"lb1-1-2"

"lb2-2-2"

floating_ip
New floating IP · object

Floating IP configuration for assignment

Example:
{
"existing_floating_id": "c64e5db1-5f1f-43ec-a8d9-5090df85b82d",
"source": "existing"
}
listeners
CreateListenerSerializer · object[]

Load balancer listeners. Maximum 50 per LB (excluding Prometheus endpoint listener).

Maximum array length: 51
logging
LoadbalancerLoggingSerializer · object

Logging configuration

preferred_connectivity
enum<string>
default:L2

Preferred option to establish connectivity between load balancer and its pools members. L2 provides best performance, L3 provides less IPs usage. It is taking effect only if instance_id + ip_address is provided, not subnet_id + ip_address, because we're considering this as intentional subnet_id specification.

Available options:
L2,
L3
Examples:

"L2"

"L3"

tags
CreateTagsSerializer · object

Key-value tags to associate with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Both tag keys and values have a maximum length of 255 characters. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.

Example:
{ "my-tag": "my-tag-value" }
vip_ip_family
enum<string>

IP family for load balancer subnet auto-selection if vip_network_id is specified

Available options:
dual,
ipv4,
ipv6
Example:

"ipv4"

vip_network_id
string<uuid4>

Network ID for load balancer. If not specified, default external network will be used. Mutually exclusive with vip_port_id

Example:

"ac307687-31a4-4a11-a949-6bea1b2878f5"

vip_port_id
string<uuid4>

Existing Reserved Fixed IP port ID for load balancer. Mutually exclusive with vip_network_id

Example:

"ff83e13a-b256-4be2-ba5d-028d3f0ab450"

vip_subnet_id
string<uuid4>

Subnet ID for load balancer. If not specified, any subnet from vip_network_id will be selected. Ignored when vip_network_id is not specified.

Example:

"4e7802d3-5023-44b8-b298-7726558fddf4"

Response

200 - application/json

OK

tasks
string[]
required

List of task IDs representing asynchronous operations. Use these IDs to monitor operation progress:

  • GET /v1/tasks/{task_id} - Check individual task status and details Poll task status until completion (FINISHED/ERROR) before proceeding with dependent operations.
Example:
["d478ae29-dedc-4869-82f0-96104425f565"]