# Public Cloud › Network › Site-to-Site VPN › IPsec connections 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

> 11 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/site-to-site-vpn/ipsec-connections/

OpenAPI v1: https://api.eu.ovhcloud.com/v1/__schemas/developer-hub-navigation/public-cloud/network/site-to-site-vpn/ipsec-connections.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/public-cloud/network/site-to-site-vpn/ipsec-connections.json?format=openapi3

## Operations

- `GET /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection` — List IPsec connections
- `GET /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}` — Get an IPsec connection
- `POST /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection` — Create an IPsec connection
- `DELETE /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}` — Delete an IPsec connection
- `PUT /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}` — Update an IPsec connection
- `GET /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel` — List IPsec tunnels
- `GET /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}` — Get an IPsec tunnel
- `POST /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel` — Create an IPsec tunnel
- `DELETE /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}` — Delete an IPsec tunnel
- `PUT /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}` — Update an IPsec tunnel
- `POST /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}/action` — Run an action on an IPsec tunnel

## List IPsec connections

`GET /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#getAllVpnConnections

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/get`

Returns the IPsec connections of the VPN gateway.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Connection[] | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec connection was created |
| `currentState` | publicCloud.vpn.ConnectionCurrentState | read-only | Observed state of the IPsec connection. Null while the IPsec connection is being created. |
| `currentState.bgp` | publicCloud.vpn.ConnectionBgp | read-only | BGP settings applied to the IPsec connection. Null when routingMode is STATIC. |
| `currentState.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `currentState.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `currentState.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `currentState.description` | string | read-only | Free-form description of the IPsec connection. Null when none was given. At most 255 characters. |
| `currentState.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | read-only | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `currentState.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `currentState.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `currentState.name` | string | read-only | Name of the IPsec connection. At most 255 characters. |
| `currentState.routingMode` | publicCloud.vpn.RoutingModeEnum | read-only | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Immutable after creation. — one of `BGP`, `STATIC` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec connection |
| `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 IPsec connection |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec connection: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.ConnectionTargetSpec | read-only | Last target specification requested for the IPsec connection |
| `targetSpec.bgp` | publicCloud.vpn.ConnectionBgp |  | BGP settings. Required when routingMode is BGP, null when it is STATIC. Immutable after creation. |
| `targetSpec.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `targetSpec.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `targetSpec.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. At most 255 characters. |
| `targetSpec.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | yes | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `targetSpec.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `targetSpec.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |
| `targetSpec.routingMode` | publicCloud.vpn.RoutingModeEnum |  | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Defaults to STATIC when null. Immutable after creation. — one of `BGP`, `STATIC` |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec connection was last updated |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "bgp": {
        "ecmpInboundEnabled": true,
        "localAsn": 0,
        "peerAsn": 0
      },
      "description": "string",
      "endpointGroup": {
        "distant": {
          "id": "00000000-0000-0000-0000-000000000000"
        },
        "local": {
          "id": "00000000-0000-0000-0000-000000000000"
        }
      },
      "name": "string",
      "routingMode": "BGP"
    },
    "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": {
      "bgp": {
        "ecmpInboundEnabled": true,
        "localAsn": 0,
        "peerAsn": 0
      },
      "description": "string",
      "endpointGroup": {
        "distant": {
          "id": "00000000-0000-0000-0000-000000000000"
        },
        "local": {
          "id": "00000000-0000-0000-0000-000000000000"
        }
      },
      "name": "string",
      "routingMode": "BGP"
    },
    "updatedAt": "2024-01-01T12:00:00Z"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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}/vpn/gateway/{gatewayId}/connection")

# 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}/vpn/gateway/{gatewayId}/connection");

print_r($result);
?>
```

## Get an IPsec connection

`GET /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#getVpnConnection

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/get`

Returns the IPsec connection and its observed state.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Connection | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec connection was created |
| `currentState` | publicCloud.vpn.ConnectionCurrentState | read-only | Observed state of the IPsec connection. Null while the IPsec connection is being created. |
| `currentState.bgp` | publicCloud.vpn.ConnectionBgp | read-only | BGP settings applied to the IPsec connection. Null when routingMode is STATIC. |
| `currentState.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `currentState.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `currentState.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `currentState.description` | string | read-only | Free-form description of the IPsec connection. Null when none was given. At most 255 characters. |
| `currentState.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | read-only | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `currentState.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `currentState.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `currentState.name` | string | read-only | Name of the IPsec connection. At most 255 characters. |
| `currentState.routingMode` | publicCloud.vpn.RoutingModeEnum | read-only | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Immutable after creation. — one of `BGP`, `STATIC` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec connection |
| `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 IPsec connection |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec connection: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.ConnectionTargetSpec | read-only | Last target specification requested for the IPsec connection |
| `targetSpec.bgp` | publicCloud.vpn.ConnectionBgp |  | BGP settings. Required when routingMode is BGP, null when it is STATIC. Immutable after creation. |
| `targetSpec.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `targetSpec.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `targetSpec.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. At most 255 characters. |
| `targetSpec.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | yes | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `targetSpec.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `targetSpec.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |
| `targetSpec.routingMode` | publicCloud.vpn.RoutingModeEnum |  | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Defaults to STATIC when null. Immutable after creation. — one of `BGP`, `STATIC` |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec connection was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "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": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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}/vpn/gateway/{gatewayId}/connection/{connectionId}")

# 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}/vpn/gateway/{gatewayId}/connection/{connectionId}");

print_r($result);
?>
```

## Create an IPsec connection

`POST /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#createVpnConnection

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/create`

Creates an IPsec connection on a VPN gateway: the endpoint groups of the networks on both sides, which must be in the region of the VPN gateway, and how their traffic is routed, shared by the one or two IPsec tunnels to the remote site. A VPN gateway holds several IPsec connections: the networks of their distant endpoint groups must not overlap, and its BGP connections share one local ASN. Creation applies immediately: the response already holds the result.

### Parameters

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

### Request body (required)

Type: `publicCloud.vpn.ConnectionCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.vpn.ConnectionTargetSpec | yes | Desired specification of the IPsec connection to create |
| `targetSpec.bgp` | publicCloud.vpn.ConnectionBgp |  | BGP settings. Required when routingMode is BGP, null when it is STATIC. Immutable after creation. |
| `targetSpec.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `targetSpec.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `targetSpec.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. At most 255 characters. |
| `targetSpec.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | yes | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `targetSpec.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `targetSpec.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |
| `targetSpec.routingMode` | publicCloud.vpn.RoutingModeEnum |  | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Defaults to STATIC when null. Immutable after creation. — one of `BGP`, `STATIC` |

```json
{
  "targetSpec": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Connection | 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 | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec connection was created |
| `currentState` | publicCloud.vpn.ConnectionCurrentState | read-only | Observed state of the IPsec connection. Null while the IPsec connection is being created. |
| `currentState.bgp` | publicCloud.vpn.ConnectionBgp | read-only | BGP settings applied to the IPsec connection. Null when routingMode is STATIC. |
| `currentState.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `currentState.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `currentState.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `currentState.description` | string | read-only | Free-form description of the IPsec connection. Null when none was given. At most 255 characters. |
| `currentState.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | read-only | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `currentState.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `currentState.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `currentState.name` | string | read-only | Name of the IPsec connection. At most 255 characters. |
| `currentState.routingMode` | publicCloud.vpn.RoutingModeEnum | read-only | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Immutable after creation. — one of `BGP`, `STATIC` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec connection |
| `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 IPsec connection |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec connection: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.ConnectionTargetSpec | read-only | Last target specification requested for the IPsec connection |
| `targetSpec.bgp` | publicCloud.vpn.ConnectionBgp |  | BGP settings. Required when routingMode is BGP, null when it is STATIC. Immutable after creation. |
| `targetSpec.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `targetSpec.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `targetSpec.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. At most 255 characters. |
| `targetSpec.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | yes | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `targetSpec.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `targetSpec.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |
| `targetSpec.routingMode` | publicCloud.vpn.RoutingModeEnum |  | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Defaults to STATIC when null. Immutable after creation. — one of `BGP`, `STATIC` |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec connection was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "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": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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.vpn.ConnectionCreation
result = client.post("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection",
	targetSpec = None, # Desired specification of the IPsec connection to create (type: publicCloud.vpn.ConnectionTargetSpec)
)

# 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.vpn.ConnectionCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection", array(
	targetSpec => null, // Desired specification of the IPsec connection to create (type: publicCloud.vpn.ConnectionTargetSpec)
));

print_r($result);
?>
```

## Delete an IPsec connection

`DELETE /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#deleteVpnConnection

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/delete`

Deletes the IPsec connection. It is refused while it has IPsec tunnels. Deletion applies immediately: the response already holds the result.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Connection | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec connection was created |
| `currentState` | publicCloud.vpn.ConnectionCurrentState | read-only | Observed state of the IPsec connection. Null while the IPsec connection is being created. |
| `currentState.bgp` | publicCloud.vpn.ConnectionBgp | read-only | BGP settings applied to the IPsec connection. Null when routingMode is STATIC. |
| `currentState.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `currentState.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `currentState.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `currentState.description` | string | read-only | Free-form description of the IPsec connection. Null when none was given. At most 255 characters. |
| `currentState.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | read-only | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `currentState.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `currentState.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `currentState.name` | string | read-only | Name of the IPsec connection. At most 255 characters. |
| `currentState.routingMode` | publicCloud.vpn.RoutingModeEnum | read-only | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Immutable after creation. — one of `BGP`, `STATIC` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec connection |
| `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 IPsec connection |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec connection: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.ConnectionTargetSpec | read-only | Last target specification requested for the IPsec connection |
| `targetSpec.bgp` | publicCloud.vpn.ConnectionBgp |  | BGP settings. Required when routingMode is BGP, null when it is STATIC. Immutable after creation. |
| `targetSpec.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `targetSpec.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `targetSpec.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. At most 255 characters. |
| `targetSpec.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | yes | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `targetSpec.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `targetSpec.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |
| `targetSpec.routingMode` | publicCloud.vpn.RoutingModeEnum |  | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Defaults to STATIC when null. Immutable after creation. — one of `BGP`, `STATIC` |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec connection was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "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": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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}/vpn/gateway/{gatewayId}/connection/{connectionId}")

# 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}/vpn/gateway/{gatewayId}/connection/{connectionId}");

print_r($result);
?>
```

## Update an IPsec connection

`PUT /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#editVpnConnection

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/edit`

The target specification replaces the previous one as a whole: a field left null goes back to its default. Send the checksum of the last GET to reject the update with a checksum mismatch when someone changed the resource in between. Only the name and the description can change: to change the networks or the routing, create another IPsec connection. The update applies immediately: the response already holds the result.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.vpn.ConnectionUpdate`

| 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.vpn.ConnectionUpdateTargetSpec | yes | Desired specification of the IPsec connection. It replaces the previous one as a whole. |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. Null or omitted removes the current description. At most 255 characters. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |

```json
{
  "checksum": "string",
  "targetSpec": {
    "description": "string",
    "name": "string"
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Connection | 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 | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec connection was created |
| `currentState` | publicCloud.vpn.ConnectionCurrentState | read-only | Observed state of the IPsec connection. Null while the IPsec connection is being created. |
| `currentState.bgp` | publicCloud.vpn.ConnectionBgp | read-only | BGP settings applied to the IPsec connection. Null when routingMode is STATIC. |
| `currentState.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `currentState.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `currentState.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `currentState.description` | string | read-only | Free-form description of the IPsec connection. Null when none was given. At most 255 characters. |
| `currentState.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | read-only | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `currentState.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `currentState.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `currentState.name` | string | read-only | Name of the IPsec connection. At most 255 characters. |
| `currentState.routingMode` | publicCloud.vpn.RoutingModeEnum | read-only | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Immutable after creation. — one of `BGP`, `STATIC` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec connection |
| `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 IPsec connection |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec connection: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.ConnectionTargetSpec | read-only | Last target specification requested for the IPsec connection |
| `targetSpec.bgp` | publicCloud.vpn.ConnectionBgp |  | BGP settings. Required when routingMode is BGP, null when it is STATIC. Immutable after creation. |
| `targetSpec.bgp.ecmpInboundEnabled` | boolean |  | Whether the local networks are advertised equally on both tunnels, for a peer able to balance its traffic over them (ECMP). False advertises them with a longer AS path on the standby tunnel. Defaults to false when null. |
| `targetSpec.bgp.localAsn` | integer | yes | Autonomous system number of the OVHcloud side, between 1 and 4294967295, 23456 excluded. It must differ from peerAsn: the sessions are eBGP. |
| `targetSpec.bgp.peerAsn` | integer | yes | Autonomous system number of the remote site, between 1 and 4294967295, 23456 excluded |
| `targetSpec.description` | string |  | Free-form description of the IPsec connection. At most 255 characters. |
| `targetSpec.endpointGroup` | publicCloud.vpn.ConnectionEndpointGroup | yes | Endpoint groups of the networks on both sides of the IPsec connection: local on the OVHcloud side, distant on the remote site. Both must be in the region of the VPN gateway. Immutable after creation. |
| `targetSpec.endpointGroup.distant` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks of the remote site, routed into the tunnels. It must not hold a default route (0.0.0.0/0 or ::/0). With BGP, only the routes learned within its networks are accepted. When every tunnel is down their traffic is dropped, never sent unencrypted. |
| `targetSpec.endpointGroup.local` | publicCloud.vpn.EndpointGroupRef | yes | Endpoint group of the networks on the OVHcloud side, behind the subnets of the VPN gateway. With BGP, they are advertised to the peer. |
| `targetSpec.name` | string | yes | Name of the IPsec connection. At most 255 characters. |
| `targetSpec.routingMode` | publicCloud.vpn.RoutingModeEnum |  | How the traffic toward the networks of endpointGroup.distant is routed into the tunnels. STATIC routes it into the active tunnel and fails over to the other one, without moving back when the first recovers. BGP runs an eBGP session inside each tunnel and follows its routes. Defaults to STATIC when null. Immutable after creation. — one of `BGP`, `STATIC` |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec connection was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "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": {
    "bgp": {
      "ecmpInboundEnabled": true,
      "localAsn": 0,
      "peerAsn": 0
    },
    "description": "string",
    "endpointGroup": {
      "distant": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "local": {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    },
    "name": "string",
    "routingMode": "BGP"
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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.vpn.ConnectionUpdate
result = client.put("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}",
	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 specification of the IPsec connection. It replaces the previous one as a whole. (type: publicCloud.vpn.ConnectionUpdateTargetSpec)
)

# 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.vpn.ConnectionUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}", 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 specification of the IPsec connection. It replaces the previous one as a whole. (type: publicCloud.vpn.ConnectionUpdateTargetSpec)
));

print_r($result);
?>
```

## List IPsec tunnels

`GET /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#getAllVpnTunnels

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/get`

Returns the IPsec tunnels of the IPsec connection.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `X-Pagination-Cursor` | header | string |  | Pagination cursor |
| `X-Pagination-Size` | header | integer |  | Pagination size |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Tunnel[] | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec tunnel was created |
| `currentState` | publicCloud.vpn.TunnelCurrentState | read-only | Observed state of the IPsec tunnel. Null while the IPsec tunnel is being created. |
| `currentState.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Null when the connection routingMode is STATIC. |
| `currentState.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `currentState.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `currentState.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `currentState.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `currentState.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `currentState.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `currentState.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `currentState.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy the IPsec tunnel is configured with |
| `currentState.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `currentState.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `currentState.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy the IPsec tunnel is configured with |
| `currentState.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `currentState.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `currentState.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `currentState.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the IPsec tunnel, as observed on the platform. `UP`: the tunnel is up. `DOWN`: the tunnel is down. `DISABLED`: `enabled` is false. `UNKNOWN`: not observed recently. Null until the IPsec tunnel is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `currentState.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `currentState.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `currentState.preSharedKey` | string (password) | read-only | Pre-shared key of the tunnel, to configure on the remote device. Null when the caller lacks the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action, and in every response other than the GET of one tunnel. |
| `currentState.priority` | integer | read-only | Preference of the tunnel within the connection, lower preferred |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the IPsec tunnel configuration on the platform. `ACTIVE`: applied. `PENDING_CREATE`, `PENDING_UPDATE`, `PENDING_DELETE`: a change is being applied. `ERROR`: the last change failed. Null when the platform reports another status. — one of `ACTIVE`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec tunnel |
| `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 IPsec tunnel |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec tunnel: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.TunnelReadTargetSpec | read-only | Last target specification requested for the IPsec tunnel |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Required when the connection routingMode is BGP. Null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.priority` | integer | read-only | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null when none was given at creation: currentState.priority holds the priority applied. |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec tunnel was last updated |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "bgp": {
        "peerIp": "192.0.2.0",
        "tunnelIp": "192.0.2.0/24"
      },
      "description": "string",
      "dpd": {
        "action": "CLEAR",
        "interval": 0
      },
      "enabled": true,
      "ike": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "initiator": "BI_DIRECTIONAL",
      "ipsec": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "localId": "string",
      "mtu": 0,
      "name": "string",
      "operatingStatus": "DISABLED",
      "peer": {
        "id": "string",
        "ip": "192.0.2.0"
      },
      "preSharedKey": "string",
      "priority": 0,
      "provisioningStatus": "ACTIVE"
    },
    "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": {
      "bgp": {
        "peerIp": "192.0.2.0",
        "tunnelIp": "192.0.2.0/24"
      },
      "description": "string",
      "dpd": {
        "action": "CLEAR",
        "interval": 0
      },
      "enabled": true,
      "ike": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "initiator": "BI_DIRECTIONAL",
      "ipsec": {
        "id": "00000000-0000-0000-0000-000000000000"
      },
      "localId": "string",
  …
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel")

# 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}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel");

print_r($result);
?>
```

## Get an IPsec tunnel

`GET /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#getVpnTunnel

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/get`, `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/preSharedKey/get`

Returns the IPsec tunnel and its observed state. `currentState.preSharedKey` holds the key in clear text only for a caller with the optional `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action. It is null otherwise.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |
| `tunnelId` | path | string (uuid) | yes | Tunnel ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Tunnel | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec tunnel was created |
| `currentState` | publicCloud.vpn.TunnelCurrentState | read-only | Observed state of the IPsec tunnel. Null while the IPsec tunnel is being created. |
| `currentState.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Null when the connection routingMode is STATIC. |
| `currentState.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `currentState.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `currentState.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `currentState.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `currentState.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `currentState.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `currentState.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `currentState.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy the IPsec tunnel is configured with |
| `currentState.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `currentState.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `currentState.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy the IPsec tunnel is configured with |
| `currentState.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `currentState.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `currentState.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `currentState.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the IPsec tunnel, as observed on the platform. `UP`: the tunnel is up. `DOWN`: the tunnel is down. `DISABLED`: `enabled` is false. `UNKNOWN`: not observed recently. Null until the IPsec tunnel is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `currentState.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `currentState.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `currentState.preSharedKey` | string (password) | read-only | Pre-shared key of the tunnel, to configure on the remote device. Null when the caller lacks the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action, and in every response other than the GET of one tunnel. |
| `currentState.priority` | integer | read-only | Preference of the tunnel within the connection, lower preferred |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the IPsec tunnel configuration on the platform. `ACTIVE`: applied. `PENDING_CREATE`, `PENDING_UPDATE`, `PENDING_DELETE`: a change is being applied. `ERROR`: the last change failed. Null when the platform reports another status. — one of `ACTIVE`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec tunnel |
| `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 IPsec tunnel |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec tunnel: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.TunnelReadTargetSpec | read-only | Last target specification requested for the IPsec tunnel |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Required when the connection routingMode is BGP. Null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.priority` | integer | read-only | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null when none was given at creation: currentState.priority holds the priority applied. |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec tunnel was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "operatingStatus": "DISABLED",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0,
    "provisioningStatus": "ACTIVE"
  },
  "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": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "priority": 0
  },
  …
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}")

# 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}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}");

print_r($result);
?>
```

## Create an IPsec tunnel

`POST /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#createVpnTunnel

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/create`

Creates an IPsec tunnel in the IPsec connection. A connection holds at most two tunnels, which fail over to each other. The VPN gateway of the connection must have a public address of the family of the peer. The IKE and IPsec policies must be in the region of the VPN gateway. Refused while the VPN gateway of the connection is being created, updated or deleted: retry once it is READY or ERROR. Creation is asynchronous: follow resourceStatus and currentTasks. READY means the tunnel is configured on the VPN gateway, not that it is up.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.vpn.TunnelCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.vpn.TunnelTargetSpec | yes | Desired specification of the IPsec tunnel to create |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp |  | BGP session inside the tunnel. Required when the connection routingMode is BGP, null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string |  | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd |  | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean |  | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | yes | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum |  | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | yes | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string |  | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer |  | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | yes | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | yes | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.preSharedKey` | string (password) |  | Pre-shared key authenticating both ends. Configure the same key on the remote device. When omitted, a random key is generated. Read it in `currentState.preSharedKey` of the tunnel GET, which needs the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action. Never returned in `targetSpec`. From 16 to 255 printable ASCII characters. |
| `targetSpec.priority` | integer |  | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null takes the priority after the one of the other tunnel of the connection at creation, and keeps the current one on update. |

```json
{
  "targetSpec": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Tunnel | 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 | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec tunnel was created |
| `currentState` | publicCloud.vpn.TunnelCurrentState | read-only | Observed state of the IPsec tunnel. Null while the IPsec tunnel is being created. |
| `currentState.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Null when the connection routingMode is STATIC. |
| `currentState.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `currentState.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `currentState.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `currentState.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `currentState.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `currentState.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `currentState.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `currentState.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy the IPsec tunnel is configured with |
| `currentState.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `currentState.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `currentState.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy the IPsec tunnel is configured with |
| `currentState.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `currentState.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `currentState.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `currentState.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the IPsec tunnel, as observed on the platform. `UP`: the tunnel is up. `DOWN`: the tunnel is down. `DISABLED`: `enabled` is false. `UNKNOWN`: not observed recently. Null until the IPsec tunnel is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `currentState.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `currentState.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `currentState.preSharedKey` | string (password) | read-only | Pre-shared key of the tunnel, to configure on the remote device. Null when the caller lacks the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action, and in every response other than the GET of one tunnel. |
| `currentState.priority` | integer | read-only | Preference of the tunnel within the connection, lower preferred |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the IPsec tunnel configuration on the platform. `ACTIVE`: applied. `PENDING_CREATE`, `PENDING_UPDATE`, `PENDING_DELETE`: a change is being applied. `ERROR`: the last change failed. Null when the platform reports another status. — one of `ACTIVE`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec tunnel |
| `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 IPsec tunnel |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec tunnel: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.TunnelReadTargetSpec | read-only | Last target specification requested for the IPsec tunnel |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Required when the connection routingMode is BGP. Null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.priority` | integer | read-only | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null when none was given at creation: currentState.priority holds the priority applied. |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec tunnel was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "operatingStatus": "DISABLED",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0,
    "provisioningStatus": "ACTIVE"
  },
  "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": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "priority": 0
  },
  …
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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.vpn.TunnelCreation
result = client.post("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel",
	targetSpec = None, # Desired specification of the IPsec tunnel to create (type: publicCloud.vpn.TunnelTargetSpec)
)

# 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.vpn.TunnelCreation
$result = $ovh->post("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel", array(
	targetSpec => null, // Desired specification of the IPsec tunnel to create (type: publicCloud.vpn.TunnelTargetSpec)
));

print_r($result);
?>
```

## Delete an IPsec tunnel

`DELETE /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#deleteVpnTunnel

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/delete`

Deletes the IPsec tunnel and tears it down. Refused while the VPN gateway of the connection is being created, updated or deleted: retry once it is READY or ERROR. Deletion is asynchronous: the tunnel stays listed with resourceStatus DELETING until it is gone.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |
| `tunnelId` | path | string (uuid) | yes | Tunnel ID |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Tunnel | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec tunnel was created |
| `currentState` | publicCloud.vpn.TunnelCurrentState | read-only | Observed state of the IPsec tunnel. Null while the IPsec tunnel is being created. |
| `currentState.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Null when the connection routingMode is STATIC. |
| `currentState.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `currentState.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `currentState.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `currentState.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `currentState.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `currentState.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `currentState.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `currentState.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy the IPsec tunnel is configured with |
| `currentState.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `currentState.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `currentState.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy the IPsec tunnel is configured with |
| `currentState.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `currentState.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `currentState.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `currentState.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the IPsec tunnel, as observed on the platform. `UP`: the tunnel is up. `DOWN`: the tunnel is down. `DISABLED`: `enabled` is false. `UNKNOWN`: not observed recently. Null until the IPsec tunnel is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `currentState.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `currentState.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `currentState.preSharedKey` | string (password) | read-only | Pre-shared key of the tunnel, to configure on the remote device. Null when the caller lacks the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action, and in every response other than the GET of one tunnel. |
| `currentState.priority` | integer | read-only | Preference of the tunnel within the connection, lower preferred |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the IPsec tunnel configuration on the platform. `ACTIVE`: applied. `PENDING_CREATE`, `PENDING_UPDATE`, `PENDING_DELETE`: a change is being applied. `ERROR`: the last change failed. Null when the platform reports another status. — one of `ACTIVE`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec tunnel |
| `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 IPsec tunnel |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec tunnel: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.TunnelReadTargetSpec | read-only | Last target specification requested for the IPsec tunnel |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Required when the connection routingMode is BGP. Null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.priority` | integer | read-only | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null when none was given at creation: currentState.priority holds the priority applied. |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec tunnel was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "operatingStatus": "DISABLED",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0,
    "provisioningStatus": "ACTIVE"
  },
  "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": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "priority": 0
  },
  …
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}")

# 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}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}");

print_r($result);
?>
```

## Update an IPsec tunnel

`PUT /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#editVpnTunnel

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/edit`

The target specification replaces the previous one as a whole: peer, priority, enabled, dpd, mtu and initiator must be sent, and bgp too when the connection routingMode is BGP. A description left null is removed, and a localId left null goes back to the public address of the VPN gateway. Send the checksum of the last GET to reject the update with a checksum mismatch when someone changed the resource in between. The pre-shared key is the exception: null keeps the current one. The tunnel is configured again with the new settings. Refused while the VPN gateway of the connection is being created, updated or deleted: retry once it is READY or ERROR. The update is asynchronous: follow resourceStatus and currentTasks.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |
| `tunnelId` | path | string (uuid) | yes | Tunnel ID |

### Request body (required)

Type: `publicCloud.vpn.TunnelUpdate`

| 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.vpn.TunnelUpdateTargetSpec | yes | Desired specification of the IPsec tunnel. It replaces the previous one as a whole. |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp |  | BGP session inside the tunnel. Required when the connection routingMode is BGP, null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string |  | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.DpdUpdate | yes | Dead peer detection settings |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum | yes | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer | yes | Idle time before the peer is probed in seconds. At least 1. |
| `targetSpec.enabled` | boolean | yes | Whether the IPsec tunnel is administratively enabled |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | yes | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | yes | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY) — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | yes | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string |  | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. When null, the public address of the VPN gateway in the IP family of `peer.ip` is used. At most 255 characters. |
| `targetSpec.mtu` | integer | yes | Maximum transmission unit of the tunnel in bytes. At least 68. |
| `targetSpec.name` | string | yes | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeerUpdate | yes | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string | yes | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Send the value of `ip` to keep the default. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.preSharedKey` | string (password) |  | Pre-shared key authenticating both ends. Configure the same key on the remote device. Never returned in `targetSpec`. When omitted, the current key is kept. From 16 to 255 printable ASCII characters. |
| `targetSpec.priority` | integer | yes | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. |

```json
{
  "checksum": "string",
  "targetSpec": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Tunnel | 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 | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec tunnel was created |
| `currentState` | publicCloud.vpn.TunnelCurrentState | read-only | Observed state of the IPsec tunnel. Null while the IPsec tunnel is being created. |
| `currentState.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Null when the connection routingMode is STATIC. |
| `currentState.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `currentState.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `currentState.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `currentState.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `currentState.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `currentState.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `currentState.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `currentState.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy the IPsec tunnel is configured with |
| `currentState.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `currentState.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `currentState.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy the IPsec tunnel is configured with |
| `currentState.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `currentState.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `currentState.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `currentState.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the IPsec tunnel, as observed on the platform. `UP`: the tunnel is up. `DOWN`: the tunnel is down. `DISABLED`: `enabled` is false. `UNKNOWN`: not observed recently. Null until the IPsec tunnel is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `currentState.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `currentState.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `currentState.preSharedKey` | string (password) | read-only | Pre-shared key of the tunnel, to configure on the remote device. Null when the caller lacks the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action, and in every response other than the GET of one tunnel. |
| `currentState.priority` | integer | read-only | Preference of the tunnel within the connection, lower preferred |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the IPsec tunnel configuration on the platform. `ACTIVE`: applied. `PENDING_CREATE`, `PENDING_UPDATE`, `PENDING_DELETE`: a change is being applied. `ERROR`: the last change failed. Null when the platform reports another status. — one of `ACTIVE`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec tunnel |
| `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 IPsec tunnel |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec tunnel: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.TunnelReadTargetSpec | read-only | Last target specification requested for the IPsec tunnel |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Required when the connection routingMode is BGP. Null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.priority` | integer | read-only | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null when none was given at creation: currentState.priority holds the priority applied. |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec tunnel was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "operatingStatus": "DISABLED",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0,
    "provisioningStatus": "ACTIVE"
  },
  "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": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "priority": 0
  },
  …
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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.vpn.TunnelUpdate
result = client.put("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}",
	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 specification of the IPsec tunnel. It replaces the previous one as a whole. (type: publicCloud.vpn.TunnelUpdateTargetSpec)
)

# 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.vpn.TunnelUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}", 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 specification of the IPsec tunnel. It replaces the previous one as a whole. (type: publicCloud.vpn.TunnelUpdateTargetSpec)
));

print_r($result);
?>
```

## Run an action on an IPsec tunnel

`POST /v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}/action`

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/ipsec-connections/#postVpnTunnelAction

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/connection/tunnel/runAction`

Runs an action on the IPsec tunnel. The only action is `REGENERATE_PRE_SHARED_KEY`. It gives the tunnel a new random pre-shared key. Read it in `currentState.preSharedKey` of the tunnel GET, and configure it on the remote device. The tunnel stays down until both ends use the new key. Refused while the VPN gateway of the connection or the tunnel is being created, updated or deleted. The action is asynchronous: follow `resourceStatus` and `currentTasks`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `connectionId` | path | string (uuid) | yes | Connection ID |
| `gatewayId` | path | string (uuid) | yes | Gateway ID |
| `projectId` | path | string | yes | Project ID |
| `tunnelId` | path | string (uuid) | yes | Tunnel ID |

### Request body (required)

Type: `publicCloud.vpn.TunnelActionRequest`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string |  | Checksum of the last GET. When given, the action is rejected with a checksum mismatch if the tunnel changed in between. When null or empty, the check is skipped. |
| `type` | publicCloud.vpn.TunnelActionTypeEnum | yes | Action to run — one of `REGENERATE_PRE_SHARED_KEY` |

```json
{
  "checksum": "string",
  "type": "REGENERATE_PRE_SHARED_KEY"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Tunnel | 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 | Hash of the current target specification. Send it back in the update payload to detect concurrent changes. |
| `createdAt` | string (date-time) | read-only | Date and time the IPsec tunnel was created |
| `currentState` | publicCloud.vpn.TunnelCurrentState | read-only | Observed state of the IPsec tunnel. Null while the IPsec tunnel is being created. |
| `currentState.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Null when the connection routingMode is STATIC. |
| `currentState.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `currentState.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `currentState.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `currentState.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `currentState.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `currentState.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `currentState.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `currentState.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy the IPsec tunnel is configured with |
| `currentState.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `currentState.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `currentState.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy the IPsec tunnel is configured with |
| `currentState.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `currentState.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `currentState.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `currentState.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the IPsec tunnel, as observed on the platform. `UP`: the tunnel is up. `DOWN`: the tunnel is down. `DISABLED`: `enabled` is false. `UNKNOWN`: not observed recently. Null until the IPsec tunnel is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `currentState.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `currentState.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `currentState.preSharedKey` | string (password) | read-only | Pre-shared key of the tunnel, to configure on the remote device. Null when the caller lacks the `vpn/gateway/connection/tunnel/preSharedKey/get` IAM action, and in every response other than the GET of one tunnel. |
| `currentState.priority` | integer | read-only | Preference of the tunnel within the connection, lower preferred |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the IPsec tunnel configuration on the platform. `ACTIVE`: applied. `PENDING_CREATE`, `PENDING_UPDATE`, `PENDING_DELETE`: a change is being applied. `ERROR`: the last change failed. Null when the platform reports another status. — one of `ACTIVE`, `ERROR`, `PENDING_CREATE`, `PENDING_DELETE`, `PENDING_UPDATE` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the IPsec tunnel |
| `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 IPsec tunnel |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the IPsec tunnel: whether its observed state has converged to its target specification — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.vpn.TunnelReadTargetSpec | read-only | Last target specification requested for the IPsec tunnel |
| `targetSpec.bgp` | publicCloud.vpn.TunnelBgp | read-only | BGP session inside the tunnel. Required when the connection routingMode is BGP. Null when it is STATIC. |
| `targetSpec.bgp.peerIp` | ip | yes | Address of the remote side inside the tunnel, the BGP neighbor. It must be another host address of the network of `tunnelIp`. |
| `targetSpec.bgp.tunnelIp` | ipBlock | yes | Address of the OVHcloud side inside the tunnel, with its prefix length, such as 169.254.10.1/30. Its network must be of the same IP family as the networks of the connection. It must not overlap those networks, nor the tunnel network of the other tunnel of the connection. |
| `targetSpec.description` | string | read-only | Free-form description of the IPsec tunnel. At most 255 characters. |
| `targetSpec.dpd` | publicCloud.vpn.Dpd | read-only | Dead peer detection settings. Null applies the defaults. |
| `targetSpec.dpd.action` | publicCloud.vpn.DpdActionEnum |  | Action taken when the peer is declared dead. RESTART brings the tunnel back on its own once the peer answers again. Defaults to RESTART when null. — one of `CLEAR`, `DISABLED`, `HOLD`, `RESTART`, `RESTART_BY_PEER` |
| `targetSpec.dpd.interval` | integer |  | Idle time before the peer is probed in seconds. At least 1. Defaults to 30 when null. |
| `targetSpec.enabled` | boolean | read-only | Whether the IPsec tunnel is administratively enabled. Defaults to true when null. |
| `targetSpec.ike` | publicCloud.vpn.IkePolicyRef | read-only | IKE (phase 1) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ike.id` | string (uuid) | yes | Unique identifier of the IKE policy, as returned by /publicCloud/project/{projectId}/vpn/ikePolicy |
| `targetSpec.initiator` | publicCloud.vpn.InitiatorEnum | read-only | Whether the OVHcloud side starts the IKE negotiation too (BI_DIRECTIONAL) or only answers the peer (RESPONSE_ONLY). Defaults to BI_DIRECTIONAL when null. — one of `BI_DIRECTIONAL`, `RESPONSE_ONLY` |
| `targetSpec.ipsec` | publicCloud.vpn.IpsecPolicyRef | read-only | IPsec (phase 2) policy of the IPsec tunnel, in the region of the VPN gateway. Configure the same algorithms on the remote device. Changing it renegotiates this tunnel only. |
| `targetSpec.ipsec.id` | string (uuid) | yes | Unique identifier of the IPsec policy, as returned by /publicCloud/project/{projectId}/vpn/ipsecPolicy |
| `targetSpec.localId` | string | read-only | IKE identity of the OVHcloud side: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to the public address of the VPN gateway in the IP family of `peer.ip`. At most 255 characters. |
| `targetSpec.mtu` | integer | read-only | Maximum transmission unit of the tunnel in bytes. Defaults to 1400 when null, which leaves room for the IPsec overhead. At least 68. |
| `targetSpec.name` | string | read-only | Name of the IPsec tunnel. At most 255 characters. |
| `targetSpec.peer` | publicCloud.vpn.TunnelPeer | read-only | Remote device of the IPsec tunnel |
| `targetSpec.peer.id` | string |  | IKE identity of the remote device: an IP address, a fully qualified domain name, user@fqdn or a distinguished name. Defaults to `ip`. At most 255 characters. |
| `targetSpec.peer.ip` | ip | yes | Public IPv4 or IPv6 address of the remote device. The VPN gateway must have a public address of the same family, and the address must not be inside the networks of the distant endpoint group of the connection. |
| `targetSpec.priority` | integer | read-only | Preference of the tunnel within the connection, at least 1, lower preferred, unique within the connection. With STATIC routing it picks the tunnel active first. Null when none was given at creation: currentState.priority holds the priority applied. |
| `updatedAt` | string (date-time) | read-only | Date and time the IPsec tunnel was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "operatingStatus": "DISABLED",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "preSharedKey": "string",
    "priority": 0,
    "provisioningStatus": "ACTIVE"
  },
  "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": {
    "bgp": {
      "peerIp": "192.0.2.0",
      "tunnelIp": "192.0.2.0/24"
    },
    "description": "string",
    "dpd": {
      "action": "CLEAR",
      "interval": 0
    },
    "enabled": true,
    "ike": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "initiator": "BI_DIRECTIONAL",
    "ipsec": {
      "id": "00000000-0000-0000-0000-000000000000"
    },
    "localId": "string",
    "mtu": 0,
    "name": "string",
    "peer": {
      "id": "string",
      "ip": "192.0.2.0"
    },
    "priority": 0
  },
  …
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}/action" \
  -H "accept: application/json" \
  -H "X-Schemas-Version: 2026-06" \
  -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.vpn.TunnelActionRequest
result = client.post("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}/action",
	checksum = None, # Checksum of the last GET. When given, the action is rejected with a checksum mismatch if the tunnel changed in between. When null or empty, the check is skipped. (type: string, nullable)
	type = None, # Action to run (type: publicCloud.vpn.TunnelActionTypeEnum)
)

# 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.vpn.TunnelActionRequest
$result = $ovh->post("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}/connection/{connectionId}/tunnel/{tunnelId}/action", array(
	checksum => null, // Checksum of the last GET. When given, the action is rejected with a checksum mismatch if the tunnel changed in between. When null or empty, the check is skipped. (type: string, nullable)
	type => null, // Action to run (type: publicCloud.vpn.TunnelActionTypeEnum)
));

print_r($result);
?>
```
