# Public Cloud › Network › Load Balancer › Listeners API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Public Cloud product's sections: https://developers.eu.ovhcloud.com/reference/public-cloud/llms.txt
> Everything in one file: https://developers.eu.ovhcloud.com/llms-full.txt

> 10 operations of the OVHcloud API. Calls carry `authorization: Bearer $OVH_TOKEN`; the EU host is shown, Canada and the United States answer on api.ca.ovhcloud.com and api.us.ovhcloud.com.

Page: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/public-cloud/network/load-balancer/listeners.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/network/load-balancer/listeners.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener` — List listeners
- `GET /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}` — Get a listener
- `POST /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener` — Create a listener
- `DELETE /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}` — Delete a listener
- `PUT /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}` — Update a listener
- `GET /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy` — List L7 policies
- `GET /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}` — Get an L7 policy
- `POST /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy` — Create an L7 policy
- `DELETE /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}` — Delete an L7 policy
- `PUT /publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}` — Update an L7 policy

## List listeners

`GET /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#getLoadBalancerListeners

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/get`

Returns the listeners of the load balancer.

### Filters
The optional `name` and `protocol` query parameters narrow the list. Each one can be repeated (for example `?protocol=HTTP&protocol=HTTPS`): repeated values of the same parameter are combined with OR, and different parameters are combined with AND. An unknown `protocol` value is rejected with a `400 InvalidParameter`. The `resourceStatus` is computed from the live state of each resource, so it is not a filter: a `status` query parameter is rejected with a `400 InvalidParameter`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `name` | query | string[] |  | Filter by listener name (case-insensitive substring match). Repeatable. |
| `projectId` | path | string | yes | Project ID |
| `protocol` | query | publicCloud.loadbalancer.ListenerProtocolEnum[] |  | Filter by listener protocol. Repeatable. |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.Listener[] | successful operation |
| 400 | object | Error 400 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the listener |
| `currentState` | publicCloud.loadbalancer.ListenerCurrentState | read-only | Current state of the listener |
| `currentState.allowedCidrs` | string[] | read-only | CIDR blocks allowed to connect to this listener |
| `currentState.connectionLimit` | integer | read-only | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `currentState.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolDetail | read-only | Default pool that handles traffic for this listener |
| `currentState.defaultPool.id` | string (uuid) | read-only | Identifier of the default pool for this listener |
| `currentState.defaultTlsContainerRef` | string | read-only | Reference to the default TLS certificate container |
| `currentState.description` | string | read-only | Listener description |
| `currentState.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders | read-only | Headers inserted into requests before forwarding to backend members |
| `currentState.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `currentState.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `currentState.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `currentState.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `currentState.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `currentState.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `currentState.name` | string | read-only | Listener name |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Whether the listener is currently accepting connections, as observed on the platform. This is distinct from its provisioning status, which tracks whether your configuration has been applied. — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | read-only | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `currentState.protocolPort` | integer | read-only | Port on which the listener accepts traffic |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.sniContainerRefs` | string[] | read-only | References to TLS certificate containers for SNI |
| `currentState.timeoutClientData` | integer | read-only | Frontend client inactivity timeout in milliseconds |
| `currentState.timeoutMemberConnect` | integer | read-only | Backend member connection timeout in milliseconds |
| `currentState.timeoutMemberData` | integer | read-only | Backend member inactivity timeout in milliseconds |
| `currentState.timeoutTcpInspect` | integer | read-only | Time in milliseconds to wait for additional TCP packets for content inspection |
| `currentState.tlsVersions` | string[] | read-only | List of TLS protocol versions allowed |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the listener |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the listener |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Listener readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.ListenerTargetSpec | read-only | Last target specification of the listener |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS) |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | yes | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `targetSpec.protocolPort` | integer | yes | Port on which the listener accepts traffic |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS) |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3 |
| `updatedAt` | string (date-time) | read-only | Last update date of the listener |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "allowedCidrs": [
        "string"
      ],
      "connectionLimit": 0,
      "defaultPool": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "defaultTlsContainerRef": "string",
      "description": "string",
      "insertHeaders": {
        "xForwardedFor": true,
        "xForwardedPort": true,
        "xForwardedProto": true,
        "xSslClientDn": true,
        "xSslClientHasCert": true,
        "xSslClientVerify": true
      },
      "name": "string",
      "operatingStatus": "DEGRADED",
      "protocol": "HTTP",
      "protocolPort": 0,
      "provisioningStatus": "ACTIVE",
      "sniContainerRefs": [
        "string"
      ],
      "timeoutClientData": 0,
      "timeoutMemberConnect": 0,
      "timeoutMemberData": 0,
      "timeoutTcpInspect": 0,
      "tlsVersions": [
        "string"
      ]
    },
    "currentTasks": [
      {
        "errors": [
          {
            "message": "string"
          }
        ],
        "id": "00000000-0000-0000-0000-000000000000",
        "link": "string",
        "status": "ERROR",
        "type": "string"
      }
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "resourceStatus": "CREATING",
    "targetSpec": {
      "allowedCidrs": [
        "192.0.2.0/24"
      ],
      "connectionLimit": 0,
      "defaultPool": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "defaultTlsContainerRef": "string",
      "description": "string",
      "insertHeaders": {
  …
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener");

print_r($result);
?>
```

## Get a listener

`GET /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#getLoadBalancerListener

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/get`

Returns the listener, including its default pool and operating status.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.Listener | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the listener |
| `currentState` | publicCloud.loadbalancer.ListenerCurrentState | read-only | Current state of the listener |
| `currentState.allowedCidrs` | string[] | read-only | CIDR blocks allowed to connect to this listener |
| `currentState.connectionLimit` | integer | read-only | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `currentState.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolDetail | read-only | Default pool that handles traffic for this listener |
| `currentState.defaultPool.id` | string (uuid) | read-only | Identifier of the default pool for this listener |
| `currentState.defaultTlsContainerRef` | string | read-only | Reference to the default TLS certificate container |
| `currentState.description` | string | read-only | Listener description |
| `currentState.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders | read-only | Headers inserted into requests before forwarding to backend members |
| `currentState.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `currentState.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `currentState.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `currentState.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `currentState.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `currentState.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `currentState.name` | string | read-only | Listener name |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Whether the listener is currently accepting connections, as observed on the platform. This is distinct from its provisioning status, which tracks whether your configuration has been applied. — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | read-only | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `currentState.protocolPort` | integer | read-only | Port on which the listener accepts traffic |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.sniContainerRefs` | string[] | read-only | References to TLS certificate containers for SNI |
| `currentState.timeoutClientData` | integer | read-only | Frontend client inactivity timeout in milliseconds |
| `currentState.timeoutMemberConnect` | integer | read-only | Backend member connection timeout in milliseconds |
| `currentState.timeoutMemberData` | integer | read-only | Backend member inactivity timeout in milliseconds |
| `currentState.timeoutTcpInspect` | integer | read-only | Time in milliseconds to wait for additional TCP packets for content inspection |
| `currentState.tlsVersions` | string[] | read-only | List of TLS protocol versions allowed |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the listener |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the listener |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Listener readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.ListenerTargetSpec | read-only | Last target specification of the listener |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS) |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | yes | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `targetSpec.protocolPort` | integer | yes | Port on which the listener accepts traffic |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS) |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3 |
| `updatedAt` | string (date-time) | read-only | Last update date of the listener |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "allowedCidrs": [
      "string"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
      "xSslClientVerify": true
    },
    "name": "string",
    "operatingStatus": "DEGRADED",
    "protocol": "HTTP",
    "protocolPort": 0,
    "provisioningStatus": "ACTIVE",
    "sniContainerRefs": [
      "string"
    ],
    "timeoutClientData": 0,
    "timeoutMemberConnect": 0,
    "timeoutMemberData": 0,
    "timeoutTcpInspect": 0,
    "tlsVersions": [
      "string"
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "allowedCidrs": [
      "192.0.2.0/24"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
  …
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}");

print_r($result);
?>
```

## Create a listener

`POST /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#createLoadBalancerListener

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/create`

Creates a listener for a protocol and port, optionally forwarding to a default pool.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.loadbalancer.ListenerCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.loadbalancer.ListenerTargetSpec | yes | Desired target specification for the listener to create |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS) |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | yes | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `targetSpec.protocolPort` | integer | yes | Port on which the listener accepts traffic |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS) |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3 |

```json
{
  "targetSpec": {
    "allowedCidrs": [
      "192.0.2.0/24"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
      "xSslClientVerify": true
    },
    "name": "string",
    "protocol": "HTTP",
    "protocolPort": 0,
    "sniContainerRefs": [
      "string"
    ],
    "timeoutClientData": 0,
    "timeoutMemberConnect": 0,
    "timeoutMemberData": 0,
    "timeoutTcpInspect": 0,
    "tlsVersions": [
      "string"
    ]
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.Listener | successful operation |
| 400 | object | Error 400 response |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the listener |
| `currentState` | publicCloud.loadbalancer.ListenerCurrentState | read-only | Current state of the listener |
| `currentState.allowedCidrs` | string[] | read-only | CIDR blocks allowed to connect to this listener |
| `currentState.connectionLimit` | integer | read-only | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `currentState.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolDetail | read-only | Default pool that handles traffic for this listener |
| `currentState.defaultPool.id` | string (uuid) | read-only | Identifier of the default pool for this listener |
| `currentState.defaultTlsContainerRef` | string | read-only | Reference to the default TLS certificate container |
| `currentState.description` | string | read-only | Listener description |
| `currentState.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders | read-only | Headers inserted into requests before forwarding to backend members |
| `currentState.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `currentState.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `currentState.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `currentState.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `currentState.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `currentState.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `currentState.name` | string | read-only | Listener name |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Whether the listener is currently accepting connections, as observed on the platform. This is distinct from its provisioning status, which tracks whether your configuration has been applied. — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | read-only | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `currentState.protocolPort` | integer | read-only | Port on which the listener accepts traffic |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.sniContainerRefs` | string[] | read-only | References to TLS certificate containers for SNI |
| `currentState.timeoutClientData` | integer | read-only | Frontend client inactivity timeout in milliseconds |
| `currentState.timeoutMemberConnect` | integer | read-only | Backend member connection timeout in milliseconds |
| `currentState.timeoutMemberData` | integer | read-only | Backend member inactivity timeout in milliseconds |
| `currentState.timeoutTcpInspect` | integer | read-only | Time in milliseconds to wait for additional TCP packets for content inspection |
| `currentState.tlsVersions` | string[] | read-only | List of TLS protocol versions allowed |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the listener |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the listener |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Listener readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.ListenerTargetSpec | read-only | Last target specification of the listener |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS) |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | yes | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `targetSpec.protocolPort` | integer | yes | Port on which the listener accepts traffic |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS) |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3 |
| `updatedAt` | string (date-time) | read-only | Last update date of the listener |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "allowedCidrs": [
      "string"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
      "xSslClientVerify": true
    },
    "name": "string",
    "operatingStatus": "DEGRADED",
    "protocol": "HTTP",
    "protocolPort": 0,
    "provisioningStatus": "ACTIVE",
    "sniContainerRefs": [
      "string"
    ],
    "timeoutClientData": 0,
    "timeoutMemberConnect": 0,
    "timeoutMemberData": 0,
    "timeoutTcpInspect": 0,
    "tlsVersions": [
      "string"
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "allowedCidrs": [
      "192.0.2.0/24"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
  …
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.loadbalancer.ListenerCreation
result = client.post("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener",
	targetSpec = None, # Desired target specification for the listener to create (type: publicCloud.loadbalancer.ListenerTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.loadbalancer.ListenerCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener", array(
	targetSpec => null, // Desired target specification for the listener to create (type: publicCloud.loadbalancer.ListenerTargetSpec)
));

print_r($result);
?>
```

## Delete a listener

`DELETE /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#deleteLoadBalancerListener

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/delete`

Deletes the listener.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.Listener | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the listener |
| `currentState` | publicCloud.loadbalancer.ListenerCurrentState | read-only | Current state of the listener |
| `currentState.allowedCidrs` | string[] | read-only | CIDR blocks allowed to connect to this listener |
| `currentState.connectionLimit` | integer | read-only | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `currentState.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolDetail | read-only | Default pool that handles traffic for this listener |
| `currentState.defaultPool.id` | string (uuid) | read-only | Identifier of the default pool for this listener |
| `currentState.defaultTlsContainerRef` | string | read-only | Reference to the default TLS certificate container |
| `currentState.description` | string | read-only | Listener description |
| `currentState.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders | read-only | Headers inserted into requests before forwarding to backend members |
| `currentState.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `currentState.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `currentState.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `currentState.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `currentState.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `currentState.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `currentState.name` | string | read-only | Listener name |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Whether the listener is currently accepting connections, as observed on the platform. This is distinct from its provisioning status, which tracks whether your configuration has been applied. — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | read-only | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `currentState.protocolPort` | integer | read-only | Port on which the listener accepts traffic |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.sniContainerRefs` | string[] | read-only | References to TLS certificate containers for SNI |
| `currentState.timeoutClientData` | integer | read-only | Frontend client inactivity timeout in milliseconds |
| `currentState.timeoutMemberConnect` | integer | read-only | Backend member connection timeout in milliseconds |
| `currentState.timeoutMemberData` | integer | read-only | Backend member inactivity timeout in milliseconds |
| `currentState.timeoutTcpInspect` | integer | read-only | Time in milliseconds to wait for additional TCP packets for content inspection |
| `currentState.tlsVersions` | string[] | read-only | List of TLS protocol versions allowed |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the listener |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the listener |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Listener readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.ListenerTargetSpec | read-only | Last target specification of the listener |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS) |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | yes | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `targetSpec.protocolPort` | integer | yes | Port on which the listener accepts traffic |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS) |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3 |
| `updatedAt` | string (date-time) | read-only | Last update date of the listener |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "allowedCidrs": [
      "string"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
      "xSslClientVerify": true
    },
    "name": "string",
    "operatingStatus": "DEGRADED",
    "protocol": "HTTP",
    "protocolPort": 0,
    "provisioningStatus": "ACTIVE",
    "sniContainerRefs": [
      "string"
    ],
    "timeoutClientData": 0,
    "timeoutMemberConnect": 0,
    "timeoutMemberData": 0,
    "timeoutTcpInspect": 0,
    "tlsVersions": [
      "string"
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "allowedCidrs": [
      "192.0.2.0/24"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
  …
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}");

print_r($result);
?>
```

## Update a listener

`PUT /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#editLoadBalancerListener

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/edit`

Replaces the listener's target specification as a whole. The body carries the complete desired state of every field `publicCloud.loadbalancer.ListenerPutTargetSpec` exposes, so read the listener first and restate every value you want to keep: a field left out of `targetSpec` is cleared, not carried over from the stored specification.

This matters most for the collection-valued and security-relevant fields. Leaving `allowedCidrs` out clears the allow list and reopens the listener to every source. Leaving `sniContainerRefs` out removes every SNI certificate, and leaving `defaultTlsContainerRef` out removes the default certificate. Leaving `insertHeaders` out stops every header from being inserted, and leaving `tlsVersions` out clears the TLS version restriction. Each of these is replaced as a whole. There is no per-element merge.

The create-only fields `protocol` and `protocolPort` cannot be changed once the listener exists. They are deliberately absent from the update model, and sending one is rejected with a 400.

`name` is required.

The optional `checksum` guards against a lost update: when supplied it must match the listener's current checksum or the request is rejected with a 409 checksum mismatch. Omitting it skips the check and forces the write (last-write-wins).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.loadbalancer.ListenerUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string |  | Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). |
| `targetSpec` | publicCloud.loadbalancer.ListenerPutTargetSpec | yes | Desired target specification for the listener |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener. The list replaces the one currently set. Clearing it reopens the listener to every source. |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener. Clearing it detaches the default pool. |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS). Clearing it removes the default certificate from the listener. |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members. The object replaces the stored one as a whole. Clearing it stops every header from being inserted. |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS). The list replaces the one currently set. Clearing it removes every SNI certificate from the listener. |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3. The list replaces the one currently set. Clearing it lifts the restriction. |

```json
{
  "checksum": "string",
  "targetSpec": {
    "allowedCidrs": [
      "192.0.2.0/24"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
      "xSslClientVerify": true
    },
    "name": "string",
    "sniContainerRefs": [
      "string"
    ],
    "timeoutClientData": 0,
    "timeoutMemberConnect": 0,
    "timeoutMemberData": 0,
    "timeoutTcpInspect": 0,
    "tlsVersions": [
      "string"
    ]
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.Listener | successful operation |
| 400 | object | Error 400 response |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the listener |
| `currentState` | publicCloud.loadbalancer.ListenerCurrentState | read-only | Current state of the listener |
| `currentState.allowedCidrs` | string[] | read-only | CIDR blocks allowed to connect to this listener |
| `currentState.connectionLimit` | integer | read-only | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `currentState.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolDetail | read-only | Default pool that handles traffic for this listener |
| `currentState.defaultPool.id` | string (uuid) | read-only | Identifier of the default pool for this listener |
| `currentState.defaultTlsContainerRef` | string | read-only | Reference to the default TLS certificate container |
| `currentState.description` | string | read-only | Listener description |
| `currentState.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders | read-only | Headers inserted into requests before forwarding to backend members |
| `currentState.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `currentState.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `currentState.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `currentState.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `currentState.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `currentState.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `currentState.name` | string | read-only | Listener name |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Whether the listener is currently accepting connections, as observed on the platform. This is distinct from its provisioning status, which tracks whether your configuration has been applied. — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | read-only | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `currentState.protocolPort` | integer | read-only | Port on which the listener accepts traffic |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.sniContainerRefs` | string[] | read-only | References to TLS certificate containers for SNI |
| `currentState.timeoutClientData` | integer | read-only | Frontend client inactivity timeout in milliseconds |
| `currentState.timeoutMemberConnect` | integer | read-only | Backend member connection timeout in milliseconds |
| `currentState.timeoutMemberData` | integer | read-only | Backend member inactivity timeout in milliseconds |
| `currentState.timeoutTcpInspect` | integer | read-only | Time in milliseconds to wait for additional TCP packets for content inspection |
| `currentState.tlsVersions` | string[] | read-only | List of TLS protocol versions allowed |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the listener |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the listener |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Listener readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.ListenerTargetSpec | read-only | Last target specification of the listener |
| `targetSpec.allowedCidrs` | ipBlock[] |  | CIDR blocks allowed to connect to this listener |
| `targetSpec.connectionLimit` | integer |  | Maximum number of connections permitted for this listener (-1 for unlimited) |
| `targetSpec.defaultPool` | publicCloud.loadbalancer.ListenerDefaultPoolRef |  | Reference to the default pool that handles traffic for this listener |
| `targetSpec.defaultPool.id` | string (uuid) | yes | Identifier of the default pool for this listener |
| `targetSpec.defaultTlsContainerRef` | string |  | Reference to the default TLS certificate container (for TERMINATED_HTTPS) |
| `targetSpec.description` | string |  | Listener description |
| `targetSpec.insertHeaders` | publicCloud.loadbalancer.ListenerInsertHeaders |  | Optional headers to insert into requests before forwarding to backend members |
| `targetSpec.insertHeaders.xForwardedFor` | boolean |  | When true, inserts X-Forwarded-For header with the client IP address |
| `targetSpec.insertHeaders.xForwardedPort` | boolean |  | When true, inserts X-Forwarded-Port header with the listener port |
| `targetSpec.insertHeaders.xForwardedProto` | boolean |  | When true, inserts X-Forwarded-Proto header with the listener protocol |
| `targetSpec.insertHeaders.xSslClientDn` | boolean |  | When true, inserts X-SSL-Client-DN header with the client certificate distinguished name |
| `targetSpec.insertHeaders.xSslClientHasCert` | boolean |  | When true, inserts X-SSL-Client-Has-Cert header indicating whether a client certificate is presented |
| `targetSpec.insertHeaders.xSslClientVerify` | boolean |  | When true, inserts X-SSL-Client-Verify header with the client certificate verification result |
| `targetSpec.name` | string | yes | Listener name |
| `targetSpec.protocol` | publicCloud.loadbalancer.ListenerProtocolEnum | yes | Protocol of the listener — one of `HTTP`, `HTTPS`, `SCTP`, `TCP`, `TERMINATED_HTTPS`, `UDP` |
| `targetSpec.protocolPort` | integer | yes | Port on which the listener accepts traffic |
| `targetSpec.sniContainerRefs` | string[] |  | References to TLS certificate containers for SNI (for TERMINATED_HTTPS) |
| `targetSpec.timeoutClientData` | integer |  | Frontend client inactivity timeout in milliseconds |
| `targetSpec.timeoutMemberConnect` | integer |  | Backend member connection timeout in milliseconds |
| `targetSpec.timeoutMemberData` | integer |  | Backend member inactivity timeout in milliseconds |
| `targetSpec.timeoutTcpInspect` | integer |  | Time in milliseconds to wait for additional TCP packets for content inspection |
| `targetSpec.tlsVersions` | string[] |  | List of TLS protocol versions allowed, for example TLSv1.2, TLSv1.3 |
| `updatedAt` | string (date-time) | read-only | Last update date of the listener |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "allowedCidrs": [
      "string"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
      "xSslClientVerify": true
    },
    "name": "string",
    "operatingStatus": "DEGRADED",
    "protocol": "HTTP",
    "protocolPort": 0,
    "provisioningStatus": "ACTIVE",
    "sniContainerRefs": [
      "string"
    ],
    "timeoutClientData": 0,
    "timeoutMemberConnect": 0,
    "timeoutMemberData": 0,
    "timeoutTcpInspect": 0,
    "tlsVersions": [
      "string"
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "allowedCidrs": [
      "192.0.2.0/24"
    ],
    "connectionLimit": 0,
    "defaultPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "defaultTlsContainerRef": "string",
    "description": "string",
    "insertHeaders": {
      "xForwardedFor": true,
      "xForwardedPort": true,
      "xForwardedProto": true,
      "xSslClientDn": true,
      "xSslClientHasCert": true,
  …
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.loadbalancer.ListenerUpdate
result = client.put("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}",
	checksum = None, # Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec = None, # Desired target specification for the listener (type: publicCloud.loadbalancer.ListenerPutTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.loadbalancer.ListenerUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}", array(
	checksum => null, // Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec => null, // Desired target specification for the listener (type: publicCloud.loadbalancer.ListenerPutTargetSpec)
));

print_r($result);
?>
```

## List L7 policies

`GET /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#getLoadBalancerL7Policies

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/L7policy/get`

Returns the L7 policies of the listener.

### Filters
The optional `name` and `action` query parameters narrow the list. Each one can be repeated (for example `?action=REJECT&action=REDIRECT_TO_POOL`): repeated values of the same parameter are combined with OR, and different parameters are combined with AND. An unknown `action` value is rejected with a `400 InvalidParameter`. The `resourceStatus` is computed from the live state of each resource, so it is not a filter: a `status` query parameter is rejected with a `400 InvalidParameter`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `action` | query | publicCloud.loadbalancer.L7PolicyActionEnum[] |  | Filter by L7 policy action. Repeatable. |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `name` | query | string[] |  | Filter by L7 policy name (case-insensitive substring match). Repeatable. |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.L7Policy[] | successful operation |
| 400 | object | Error 400 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the L7 policy |
| `currentState` | publicCloud.loadbalancer.L7PolicyCurrentState | read-only | Current state of the L7 policy |
| `currentState.action` | publicCloud.loadbalancer.L7PolicyActionEnum | read-only | Action taken when the policy matches — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `currentState.description` | string | read-only | Description of the L7 policy |
| `currentState.name` | string | read-only | Human-readable name of the L7 policy |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 policy — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.position` | integer | read-only | Evaluation position of this policy relative to other policies |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 policy in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.redirectHttpCode` | integer | read-only | HTTP status code used for redirect responses |
| `currentState.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolDetail | read-only | Pool traffic is redirected to |
| `currentState.redirectPool.id` | string (uuid) | read-only | Identifier of the pool traffic is redirected to |
| `currentState.redirectPrefix` | string | read-only | URL prefix requests are redirected to |
| `currentState.redirectUrl` | string | read-only | URL requests are redirected to |
| `currentState.rules` | publicCloud.loadbalancer.L7RuleState[] | read-only | L7 rules associated with this policy |
| `currentState.rules[].compareType` | string | read-only | Comparison method used for matching |
| `currentState.rules[].id` | string (uuid) | read-only | Unique identifier of the L7 rule |
| `currentState.rules[].invert` | boolean | read-only | Whether the rule logic is inverted |
| `currentState.rules[].key` | string | read-only | Key used for the comparison (for COOKIE and HEADER rule types) |
| `currentState.rules[].operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 rule — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.rules[].provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 rule in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.rules[].type` | string | read-only | Type of attribute matched by the rule |
| `currentState.rules[].value` | string | read-only | Value compared against the attribute |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the L7 policy |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the L7 policy |
| `resourceStatus` | common.ResourceStatusEnum | read-only | L7 policy readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyTargetSpec | read-only | Last target specification of the L7 policy |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, REJECT) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |
| `updatedAt` | string (date-time) | read-only | Last update date of the L7 policy |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "action": "REDIRECT_PREFIX",
      "description": "string",
      "name": "string",
      "operatingStatus": "DEGRADED",
      "position": 0,
      "provisioningStatus": "ACTIVE",
      "redirectHttpCode": 0,
      "redirectPool": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "redirectPrefix": "string",
      "redirectUrl": "string",
      "rules": [
        {
          "compareType": "string",
          "id": "00000000-0000-0000-0000-000000000000",
          "invert": true,
          "key": "string",
          "operatingStatus": "DEGRADED",
          "provisioningStatus": "ACTIVE",
          "type": "string",
          "value": "string"
        }
      ]
    },
    "currentTasks": [
      {
        "errors": [
          {
            "message": "string"
          }
        ],
        "id": "00000000-0000-0000-0000-000000000000",
        "link": "string",
        "status": "ERROR",
        "type": "string"
      }
    ],
    "id": "00000000-0000-0000-0000-000000000000",
    "resourceStatus": "CREATING",
    "targetSpec": {
      "action": "REDIRECT_PREFIX",
      "description": "string",
      "name": "string",
      "position": 0,
      "redirectHttpCode": 0,
      "redirectPool": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "redirectPrefix": "string",
      "redirectUrl": "string",
      "rules": [
        {
          "compareType": "CONTAINS",
          "invert": true,
          "key": "string",
          "type": "COOKIE",
  …
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy");

print_r($result);
?>
```

## Get an L7 policy

`GET /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#getLoadBalancerL7Policy

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/L7policy/get`

Returns the L7 policy, including its action and matching rules.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `l7PolicyId` | path | string (uuid) | yes | L7 policy ID |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.L7Policy | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the L7 policy |
| `currentState` | publicCloud.loadbalancer.L7PolicyCurrentState | read-only | Current state of the L7 policy |
| `currentState.action` | publicCloud.loadbalancer.L7PolicyActionEnum | read-only | Action taken when the policy matches — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `currentState.description` | string | read-only | Description of the L7 policy |
| `currentState.name` | string | read-only | Human-readable name of the L7 policy |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 policy — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.position` | integer | read-only | Evaluation position of this policy relative to other policies |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 policy in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.redirectHttpCode` | integer | read-only | HTTP status code used for redirect responses |
| `currentState.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolDetail | read-only | Pool traffic is redirected to |
| `currentState.redirectPool.id` | string (uuid) | read-only | Identifier of the pool traffic is redirected to |
| `currentState.redirectPrefix` | string | read-only | URL prefix requests are redirected to |
| `currentState.redirectUrl` | string | read-only | URL requests are redirected to |
| `currentState.rules` | publicCloud.loadbalancer.L7RuleState[] | read-only | L7 rules associated with this policy |
| `currentState.rules[].compareType` | string | read-only | Comparison method used for matching |
| `currentState.rules[].id` | string (uuid) | read-only | Unique identifier of the L7 rule |
| `currentState.rules[].invert` | boolean | read-only | Whether the rule logic is inverted |
| `currentState.rules[].key` | string | read-only | Key used for the comparison (for COOKIE and HEADER rule types) |
| `currentState.rules[].operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 rule — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.rules[].provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 rule in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.rules[].type` | string | read-only | Type of attribute matched by the rule |
| `currentState.rules[].value` | string | read-only | Value compared against the attribute |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the L7 policy |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the L7 policy |
| `resourceStatus` | common.ResourceStatusEnum | read-only | L7 policy readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyTargetSpec | read-only | Last target specification of the L7 policy |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, REJECT) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |
| `updatedAt` | string (date-time) | read-only | Last update date of the L7 policy |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "operatingStatus": "DEGRADED",
    "position": 0,
    "provisioningStatus": "ACTIVE",
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "invert": true,
        "key": "string",
        "operatingStatus": "DEGRADED",
        "provisioningStatus": "ACTIVE",
        "type": "string",
        "value": "string"
      }
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "position": 0,
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "CONTAINS",
        "invert": true,
        "key": "string",
        "type": "COOKIE",
        "value": "string"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->get("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}");

print_r($result);
?>
```

## Create an L7 policy

`POST /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#createLoadBalancerL7Policy

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/L7policy/create`

Creates an L7 policy that redirects or rejects traffic matching its rules. Position sets its evaluation order among the listener's policies.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.loadbalancer.L7PolicyCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyTargetSpec | yes | Desired target specification for the L7 policy to create |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, REJECT) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |

```json
{
  "targetSpec": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "position": 0,
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "CONTAINS",
        "invert": true,
        "key": "string",
        "type": "COOKIE",
        "value": "string"
      }
    ]
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.L7Policy | successful operation |
| 400 | object | Error 400 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the L7 policy |
| `currentState` | publicCloud.loadbalancer.L7PolicyCurrentState | read-only | Current state of the L7 policy |
| `currentState.action` | publicCloud.loadbalancer.L7PolicyActionEnum | read-only | Action taken when the policy matches — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `currentState.description` | string | read-only | Description of the L7 policy |
| `currentState.name` | string | read-only | Human-readable name of the L7 policy |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 policy — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.position` | integer | read-only | Evaluation position of this policy relative to other policies |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 policy in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.redirectHttpCode` | integer | read-only | HTTP status code used for redirect responses |
| `currentState.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolDetail | read-only | Pool traffic is redirected to |
| `currentState.redirectPool.id` | string (uuid) | read-only | Identifier of the pool traffic is redirected to |
| `currentState.redirectPrefix` | string | read-only | URL prefix requests are redirected to |
| `currentState.redirectUrl` | string | read-only | URL requests are redirected to |
| `currentState.rules` | publicCloud.loadbalancer.L7RuleState[] | read-only | L7 rules associated with this policy |
| `currentState.rules[].compareType` | string | read-only | Comparison method used for matching |
| `currentState.rules[].id` | string (uuid) | read-only | Unique identifier of the L7 rule |
| `currentState.rules[].invert` | boolean | read-only | Whether the rule logic is inverted |
| `currentState.rules[].key` | string | read-only | Key used for the comparison (for COOKIE and HEADER rule types) |
| `currentState.rules[].operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 rule — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.rules[].provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 rule in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.rules[].type` | string | read-only | Type of attribute matched by the rule |
| `currentState.rules[].value` | string | read-only | Value compared against the attribute |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the L7 policy |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the L7 policy |
| `resourceStatus` | common.ResourceStatusEnum | read-only | L7 policy readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyTargetSpec | read-only | Last target specification of the L7 policy |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, REJECT) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |
| `updatedAt` | string (date-time) | read-only | Last update date of the L7 policy |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "operatingStatus": "DEGRADED",
    "position": 0,
    "provisioningStatus": "ACTIVE",
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "invert": true,
        "key": "string",
        "operatingStatus": "DEGRADED",
        "provisioningStatus": "ACTIVE",
        "type": "string",
        "value": "string"
      }
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "position": 0,
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "CONTAINS",
        "invert": true,
        "key": "string",
        "type": "COOKIE",
        "value": "string"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.loadbalancer.L7PolicyCreation
result = client.post("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy",
	targetSpec = None, # Desired target specification for the L7 policy to create (type: publicCloud.loadbalancer.L7PolicyTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.loadbalancer.L7PolicyCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy", array(
	targetSpec => null, // Desired target specification for the L7 policy to create (type: publicCloud.loadbalancer.L7PolicyTargetSpec)
));

print_r($result);
?>
```

## Delete an L7 policy

`DELETE /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#deleteLoadBalancerL7Policy

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/L7policy/delete`

Deletes the L7 policy.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `l7PolicyId` | path | string (uuid) | yes | L7 policy ID |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.L7Policy | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the L7 policy |
| `currentState` | publicCloud.loadbalancer.L7PolicyCurrentState | read-only | Current state of the L7 policy |
| `currentState.action` | publicCloud.loadbalancer.L7PolicyActionEnum | read-only | Action taken when the policy matches — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `currentState.description` | string | read-only | Description of the L7 policy |
| `currentState.name` | string | read-only | Human-readable name of the L7 policy |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 policy — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.position` | integer | read-only | Evaluation position of this policy relative to other policies |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 policy in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.redirectHttpCode` | integer | read-only | HTTP status code used for redirect responses |
| `currentState.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolDetail | read-only | Pool traffic is redirected to |
| `currentState.redirectPool.id` | string (uuid) | read-only | Identifier of the pool traffic is redirected to |
| `currentState.redirectPrefix` | string | read-only | URL prefix requests are redirected to |
| `currentState.redirectUrl` | string | read-only | URL requests are redirected to |
| `currentState.rules` | publicCloud.loadbalancer.L7RuleState[] | read-only | L7 rules associated with this policy |
| `currentState.rules[].compareType` | string | read-only | Comparison method used for matching |
| `currentState.rules[].id` | string (uuid) | read-only | Unique identifier of the L7 rule |
| `currentState.rules[].invert` | boolean | read-only | Whether the rule logic is inverted |
| `currentState.rules[].key` | string | read-only | Key used for the comparison (for COOKIE and HEADER rule types) |
| `currentState.rules[].operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 rule — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.rules[].provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 rule in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.rules[].type` | string | read-only | Type of attribute matched by the rule |
| `currentState.rules[].value` | string | read-only | Value compared against the attribute |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the L7 policy |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the L7 policy |
| `resourceStatus` | common.ResourceStatusEnum | read-only | L7 policy readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyTargetSpec | read-only | Last target specification of the L7 policy |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, REJECT) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |
| `updatedAt` | string (date-time) | read-only | Last update date of the L7 policy |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "operatingStatus": "DEGRADED",
    "position": 0,
    "provisioningStatus": "ACTIVE",
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "invert": true,
        "key": "string",
        "operatingStatus": "DEGRADED",
        "provisioningStatus": "ACTIVE",
        "type": "string",
        "value": "string"
      }
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "position": 0,
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "CONTAINS",
        "invert": true,
        "key": "string",
        "type": "COOKIE",
        "value": "string"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

result = client.delete("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}")

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

$result = $ovh->delete("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}");

print_r($result);
?>
```

## Update an L7 policy

`PUT /v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/load-balancer/listeners/#editLoadBalancerL7Policy

**Status:** Stable production version  
**IAM actions:** `publicCloudProject:apiovh:loadbalancer/listener/L7policy/edit`

Replaces the L7 policy's target specification as a whole, including its action and evaluation position.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `l7PolicyId` | path | string (uuid) | yes | L7 policy ID |
| `listenerId` | path | string (uuid) | yes | Listener ID |
| `loadbalancerId` | path | string (uuid) | yes | Loadbalancer ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.loadbalancer.L7PolicyUpdate`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string |  | Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyUpdateTargetSpec | yes | Desired target specification for the L7 policy |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (determines which redirect fields are valid) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |

```json
{
  "checksum": "string",
  "targetSpec": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "position": 0,
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "CONTAINS",
        "invert": true,
        "key": "string",
        "type": "COOKIE",
        "value": "string"
      }
    ]
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.loadbalancer.L7Policy | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the L7 policy |
| `currentState` | publicCloud.loadbalancer.L7PolicyCurrentState | read-only | Current state of the L7 policy |
| `currentState.action` | publicCloud.loadbalancer.L7PolicyActionEnum | read-only | Action taken when the policy matches — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `currentState.description` | string | read-only | Description of the L7 policy |
| `currentState.name` | string | read-only | Human-readable name of the L7 policy |
| `currentState.operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 policy — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.position` | integer | read-only | Evaluation position of this policy relative to other policies |
| `currentState.provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 policy in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.redirectHttpCode` | integer | read-only | HTTP status code used for redirect responses |
| `currentState.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolDetail | read-only | Pool traffic is redirected to |
| `currentState.redirectPool.id` | string (uuid) | read-only | Identifier of the pool traffic is redirected to |
| `currentState.redirectPrefix` | string | read-only | URL prefix requests are redirected to |
| `currentState.redirectUrl` | string | read-only | URL requests are redirected to |
| `currentState.rules` | publicCloud.loadbalancer.L7RuleState[] | read-only | L7 rules associated with this policy |
| `currentState.rules[].compareType` | string | read-only | Comparison method used for matching |
| `currentState.rules[].id` | string (uuid) | read-only | Unique identifier of the L7 rule |
| `currentState.rules[].invert` | boolean | read-only | Whether the rule logic is inverted |
| `currentState.rules[].key` | string | read-only | Key used for the comparison (for COOKIE and HEADER rule types) |
| `currentState.rules[].operatingStatus` | publicCloud.loadbalancer.LoadbalancerOperatingStatusEnum | read-only | Operating status of the L7 rule — one of `DEGRADED`, `DRAINING`, `ERROR`, `NO_MONITOR`, `OFFLINE`, `ONLINE` |
| `currentState.rules[].provisioningStatus` | publicCloud.loadbalancer.LoadbalancerProvisioningStatusEnum | read-only | Provisioning status of the L7 rule in OpenStack — one of `ACTIVE`, `DELETED`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentState.rules[].type` | string | read-only | Type of attribute matched by the rule |
| `currentState.rules[].value` | string | read-only | Value compared against the attribute |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the L7 policy |
| `currentTasks[].errors` | common.TaskError[] | read-only | Errors that occurred on the task |
| `currentTasks[].errors[].message` | string | read-only | Error description |
| `currentTasks[].id` | string (uuid) | read-only | Identifier of the current task |
| `currentTasks[].link` | string | read-only | Link to the task details |
| `currentTasks[].status` | common.CurrentTaskStatusEnum | read-only | Current global status of the current task — one of `ERROR`, `PENDING`, `RUNNING`, `SCHEDULED`, `WAITING_USER_INPUT` |
| `currentTasks[].type` | string | read-only | Type of the current task |
| `id` | string (uuid) | read-only | Unique identifier of the L7 policy |
| `resourceStatus` | common.ResourceStatusEnum | read-only | L7 policy readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.loadbalancer.L7PolicyTargetSpec | read-only | Last target specification of the L7 policy |
| `targetSpec.action` | publicCloud.loadbalancer.L7PolicyActionEnum | yes | Action to take when the policy matches (REDIRECT_PREFIX, REDIRECT_TO_POOL, REDIRECT_TO_URL, REJECT) — one of `REDIRECT_PREFIX`, `REDIRECT_TO_POOL`, `REDIRECT_TO_URL`, `REJECT` |
| `targetSpec.description` | string |  | Description of the L7 policy |
| `targetSpec.name` | string |  | Human-readable name of the L7 policy |
| `targetSpec.position` | integer |  | Evaluation position of this policy relative to other policies (starting at 1) |
| `targetSpec.redirectHttpCode` | integer |  | HTTP status code used for redirect responses, for example 301, 302, 303, 307, 308 |
| `targetSpec.redirectPool` | publicCloud.loadbalancer.L7PolicyRedirectPoolRef |  | Reference to the pool to redirect traffic to (for REDIRECT_TO_POOL action) |
| `targetSpec.redirectPool.id` | string (uuid) | yes | Identifier of the pool to redirect traffic to |
| `targetSpec.redirectPrefix` | string |  | URL prefix to redirect requests to (for REDIRECT_PREFIX action) |
| `targetSpec.redirectUrl` | string |  | URL to redirect requests to (for REDIRECT_TO_URL action) |
| `targetSpec.rules` | publicCloud.loadbalancer.L7RuleSpec[] |  | L7 rules that determine when this policy matches |
| `targetSpec.rules[].compareType` | publicCloud.loadbalancer.L7RuleCompareTypeEnum | yes | Comparison method for matching the value — one of `CONTAINS`, `ENDS_WITH`, `EQUAL_TO`, `REGEX`, `STARTS_WITH` |
| `targetSpec.rules[].invert` | boolean |  | When true, inverts the logic of the rule (matches when the rule does not match) |
| `targetSpec.rules[].key` | string |  | Key to use for the comparison (required for COOKIE and HEADER rule types) |
| `targetSpec.rules[].type` | publicCloud.loadbalancer.L7RuleTypeEnum | yes | Type of attribute to match (COOKIE, FILE_TYPE, HEADER, HOST_NAME, PATH) — one of `COOKIE`, `FILE_TYPE`, `HEADER`, `HOST_NAME`, `PATH` |
| `targetSpec.rules[].value` | string | yes | Value to compare against the attribute |
| `updatedAt` | string (date-time) | read-only | Last update date of the L7 policy |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "operatingStatus": "DEGRADED",
    "position": 0,
    "provisioningStatus": "ACTIVE",
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "string",
        "id": "00000000-0000-0000-0000-000000000000",
        "invert": true,
        "key": "string",
        "operatingStatus": "DEGRADED",
        "provisioningStatus": "ACTIVE",
        "type": "string",
        "value": "string"
      }
    ]
  },
  "currentTasks": [
    {
      "errors": [
        {
          "message": "string"
        }
      ],
      "id": "00000000-0000-0000-0000-000000000000",
      "link": "string",
      "status": "ERROR",
      "type": "string"
    }
  ],
  "id": "00000000-0000-0000-0000-000000000000",
  "resourceStatus": "CREATING",
  "targetSpec": {
    "action": "REDIRECT_PREFIX",
    "description": "string",
    "name": "string",
    "position": 0,
    "redirectHttpCode": 0,
    "redirectPool": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "redirectPrefix": "string",
    "redirectUrl": "string",
    "rules": [
      {
        "compareType": "CONTAINS",
        "invert": true,
        "key": "string",
        "type": "COOKIE",
        "value": "string"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

```python
'''
First, install the latest release of Python wrapper: $ pip install ovh
'''
import json
import ovh

# Instantiate an OVH Client.
# You can generate new credentials with full access to your account on
# the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
client = ovh.Client(
	endpoint='ovh-eu',               # Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
	application_key='xxxxxxxxxx',    # Application Key
	application_secret='xxxxxxxxxx', # Application Secret
	consumer_key='xxxxxxxxxx',       # Consumer Key
)

# Request body type: publicCloud.loadbalancer.L7PolicyUpdate
result = client.put("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}",
	checksum = None, # Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec = None, # Desired target specification for the L7 policy (type: publicCloud.loadbalancer.L7PolicyUpdateTargetSpec)
)

# Pretty print
print(json.dumps(result, indent=4))
```

```php
<?php
/**
 * First, download the latest release of PHP wrapper on github
 * And include this script into the folder with extracted files
 */
require __DIR__ . '/vendor/autoload.php';
use \Ovh\Api;

/**
 * Instantiate an OVH Client.
 * You can generate new credentials with full access to your account on
 * the token creation page (https://api.ovh.com/createToken/index.cgi?GET=/*&PUT=/*&POST=/*&DELETE=/*)
 */
$ovh = new Api('xxxxxxxxxx',  // Application Key
               'xxxxxxxxxx',  // Application Secret
               'ovh-eu',      // Endpoint of API OVH (List of available endpoints: https://github.com/ovh/python-ovh#2-configure-your-application)
               'xxxxxxxxxx'); // Consumer Key

// Request body type: publicCloud.loadbalancer.L7PolicyUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/loadbalancer/{loadbalancerId}/listener/{listenerId}/l7policy/{l7PolicyId}", array(
	checksum => null, // Optional concurrency-control checksum. When supplied, it must match the resource's current checksum or the request is rejected with a 409 checksum-mismatch conflict. When omitted or empty, the concurrency check is skipped and the write is forced (last-write-wins). (type: string, nullable)
	targetSpec => null, // Desired target specification for the L7 policy (type: publicCloud.loadbalancer.L7PolicyUpdateTargetSpec)
));

print_r($result);
?>
```
