> ## 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.

# Create load balancer listener



## OpenAPI

````yaml /api-reference/services_documented/cloud_api.yaml post /cloud/v1/lblisteners/{project_id}/{region_id}
openapi: 3.1.0
info:
  title: Gcore OpenAPI – Cloud API
  description: >-
    This OpenAPI is an aggregated OpenAPI specification that unifies all Gcore
    products into a single file. It covers Cloud, CDN, DNS, WAAP, DDoS
    Protection, Object Storage, Streaming, and FastEdge services.
  version: '2026-05-14T07:00:22.640261+00:00'
servers:
  - url: https://api.gcore.com
security:
  - APIKey: []
tags:
  - name: Bare Metal
    x-displayName: Bare Metal
  - name: Container as a Service
    x-displayName: Container as a Service
  - name: Cost Reports
    x-displayName: Cost Reports
  - name: DDoS Protection
    x-displayName: DDoS Protection
  - name: Everywhere Inference
    x-displayName: Everywhere Inference
  - name: Everywhere Inference Apps
    x-displayName: Everywhere Inference Apps
  - name: File Shares
    x-displayName: File Shares
  - name: Floating IPs
    x-displayName: Floating IPs
  - name: Function as a Service
    x-displayName: Function as a Service
  - name: GPU Bare Metal
    x-displayName: GPU Bare Metal
  - name: GPU Virtual
    x-displayName: GPU Virtual
  - name: IP Ranges
    x-displayName: IP Ranges
  - name: Images
    x-displayName: Images
  - name: Instances
    x-displayName: Instances
  - name: Load Balancers
    x-displayName: Load Balancers
  - name: Logging
    x-displayName: Logging
  - name: Managed Kubernetes
    x-displayName: Managed Kubernetes
  - name: Managed PostgreSQL
    x-displayName: Managed PostgreSQL
  - name: Networks
    x-displayName: Networks
  - name: Placement Groups
    x-displayName: Placement Groups
  - name: Projects
    x-displayName: Projects
  - name: Quotas
    x-displayName: Quotas
  - name: Regions
    x-displayName: Regions
  - name: Registry
    x-displayName: Registry
  - name: Reservations
    x-displayName: Reservations
  - name: Reserved IPs
    x-displayName: Reserved IPs
  - name: Routers
    x-displayName: Routers
  - name: SSH Keys
    x-displayName: SSH Keys
  - name: Secrets
    x-displayName: Secrets
  - name: Security Groups
    x-displayName: Security Groups
  - name: Snapshot Schedules
    x-displayName: Snapshot Schedules
  - name: Snapshots
    x-displayName: Snapshots
  - name: Tasks
    x-displayName: Tasks
  - name: User Actions
    x-displayName: User Actions
  - name: User Role Assignments
    x-displayName: User Role Assignments
  - name: Volumes
    x-displayName: Volumes
paths:
  /cloud/v1/lblisteners/{project_id}/{region_id}:
    post:
      tags:
        - Load Balancers
      summary: Create load balancer listener
      operationId: LoadBalancerListenerViewSet.post
      parameters:
        - in: path
          name: project_id
          required: true
          description: Project ID
          schema:
            description: Project ID
            example: 1
            examples:
              - 1
            title: Project Id
            type: integer
        - in: path
          name: region_id
          required: true
          description: Region ID
          schema:
            description: Region ID
            example: 1
            examples:
              - 1
            exclusiveMinimum: 0
            title: Region Id
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateLbListenerSerializer'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIDsSerializer'
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from gcore import Gcore

            client = Gcore(
                api_key=os.environ.get("GCORE_API_KEY"),  # This is the default and can be omitted
            )
            task_id_list = client.cloud.load_balancers.listeners.create(
                project_id=1,
                region_id=1,
                load_balancer_id="30f4f55b-4a7c-48e0-9954-5cddfee216e7",
                name="my_listener",
                protocol="HTTP",
                protocol_port=80,
            )
            print(task_id_list.tasks)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/G-Core/gcore-go\"\n\t\"github.com/G-Core/gcore-go/cloud\"\n\t\"github.com/G-Core/gcore-go/option\"\n)\n\nfunc main() {\n\tclient := gcore.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\ttaskIDList, err := client.Cloud.LoadBalancers.Listeners.New(context.TODO(), cloud.LoadBalancerListenerNewParams{\n\t\tProjectID:      gcore.Int(1),\n\t\tRegionID:       gcore.Int(1),\n\t\tLoadBalancerID: \"30f4f55b-4a7c-48e0-9954-5cddfee216e7\",\n\t\tName:           \"my_listener\",\n\t\tProtocol:       cloud.LbListenerProtocolHTTP,\n\t\tProtocolPort:   80,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", taskIDList.Tasks)\n}\n"
components:
  schemas:
    CreateLbListenerSerializer:
      properties:
        allowed_cidrs:
          anyOf:
            - items:
                format: ipvanynetwork
                type: string
              maxItems: 100
              type: array
            - type: 'null'
          description: Network CIDRs from which service will be accessible
          examples:
            - - 10.0.0.0/8
          title: Allowed Cidrs
        connection_limit:
          default: 100000
          description: >-
            Limit of the simultaneous connections. If -1 is provided, it is
            translated to the default value 100000.
          example: 100000
          examples:
            - 100000
          maximum: 1000000
          minimum: -1
          title: Connection Limit
          type: integer
        default_pool_id:
          description: ID of already existent Load Balancer Pool to attach listener to.
          example: 00000000-0000-4000-8000-000000000000
          examples:
            - 00000000-0000-4000-8000-000000000000
          format: uuid4
          title: Default Pool Id
          type: string
        insert_x_forwarded:
          description: >-
            Add headers X-Forwarded-For, X-Forwarded-Port, X-Forwarded-Proto to
            requests. Only used with HTTP or `TERMINATED_HTTPS` protocols.
          example: false
          examples:
            - false
          title: Insert X Forwarded
          type: boolean
        load_balancer_id:
          description: ID of already existent Load Balancer.
          example: 30f4f55b-4a7c-48e0-9954-5cddfee216e7
          examples:
            - 30f4f55b-4a7c-48e0-9954-5cddfee216e7
          format: uuid4
          title: Load Balancer Id
          type: string
        name:
          description: Load balancer listener name
          example: my_listener
          examples:
            - my_listener
          pattern: ^[a-zA-Z0-9][a-zA-Z 0-9._\-]{1,61}[a-zA-Z0-9._]$
          title: Name
          type: string
        protocol:
          $ref: '#/components/schemas/LbListenerProtocolEnum'
          description: Load balancer listener protocol
          examples:
            - HTTP
        protocol_port:
          description: Protocol port
          example: 80
          examples:
            - 80
          maximum: 65535
          minimum: 1
          title: Protocol Port
          type: integer
        secret_id:
          anyOf:
            - const: ''
              type: string
            - format: uuid4
              type: string
          description: >-
            ID of the secret where PKCS12 file is stored for `TERMINATED_HTTPS`
            or PROMETHEUS listener
          examples:
            - f2e734d0-fa2b-42c2-ad33-4c6db5101e00
          title: Secret Id
        sni_secret_id:
          description: >-
            List of secrets IDs containing PKCS12 format certificate/key bundles
            for `TERMINATED_HTTPS` or PROMETHEUS listeners
          example:
            - f2e734d0-fa2b-42c2-ad33-4c6db5101e00
            - eb121225-7ded-4ff3-ae1f-599e145dd7cb
          examples:
            - - f2e734d0-fa2b-42c2-ad33-4c6db5101e00
              - eb121225-7ded-4ff3-ae1f-599e145dd7cb
          items:
            format: uuid4
            type: string
          title: Sni Secret Id
          type: array
        timeout_client_data:
          anyOf:
            - maximum: 86400000
              minimum: 0
              type: integer
            - type: 'null'
          description: Frontend client inactivity timeout in milliseconds
          examples:
            - 50000
          title: Timeout Client Data
        timeout_member_connect:
          anyOf:
            - maximum: 86400000
              minimum: 0
              type: integer
            - type: 'null'
          deprecated: true
          description: >-
            Backend member connection timeout in milliseconds. We are
            recommending to use `pool.timeout_member_connect` instead.
          examples:
            - 50000
          title: Timeout Member Connect
        timeout_member_data:
          anyOf:
            - maximum: 86400000
              minimum: 0
              type: integer
            - type: 'null'
          deprecated: true
          description: >-
            Backend member inactivity timeout in milliseconds. We are
            recommending to use `pool.timeout_member_data` instead.
          examples:
            - null
          title: Timeout Member Data
        user_list:
          description: Load balancer listener list of username and encrypted password items
          example:
            - encrypted_password: $5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5
              username: admin
          examples:
            - - encrypted_password: >-
                  $5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5
                username: admin
          items:
            $ref: '#/components/schemas/UserListItem'
          maxItems: 3
          title: User List
          type: array
      required:
        - name
        - protocol
        - protocol_port
        - load_balancer_id
      title: CreateLbListenerSerializer
      type: object
    TaskIDsSerializer:
      properties:
        tasks:
          description: >-
            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
          examples:
            - - d478ae29-dedc-4869-82f0-96104425f565
          items:
            type: string
          title: Tasks
          type: array
      required:
        - tasks
      title: TaskIDsSerializer
      type: object
    LbListenerProtocolEnum:
      enum:
        - HTTP
        - HTTPS
        - PROMETHEUS
        - TCP
        - TERMINATED_HTTPS
        - UDP
      title: LbListenerProtocolEnum
      type: string
    UserListItem:
      properties:
        encrypted_password:
          description: Encrypted password to auth via Basic Authentication
          example: $5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5
          examples:
            - $5$isRr.HJ1IrQP38.m$oViu3DJOpUG2ZsjCBtbITV3mqpxxbZfyWJojLPNSPO5
          maxLength: 128
          title: Encrypted Password
          type: string
        username:
          description: Username to auth via Basic Authentication
          example: admin
          examples:
            - admin
          maxLength: 32
          pattern: ^[a-zA-Z0-9][a-zA-Z 0-9._\-]{1,30}[a-zA-Z0-9._]$
          title: Username
          type: string
      required:
        - username
        - encrypted_password
      title: UserListItem
      type: object
  securitySchemes:
    APIKey:
      description: >-
        API key for authentication. Make sure to include the word `apikey`,
        followed by a single space and then your token.

        Example: `apikey 1234$abcdef`
      type: apiKey
      in: header
      name: Authorization

````