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

> 5 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/vpn-gateways/

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

## Operations

- `GET /publicCloud/project/{projectId}/vpn/gateway` — List VPN gateways
- `POST /publicCloud/project/{projectId}/vpn/gateway` — Create a VPN gateway
- `GET /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}` — Get a VPN gateway
- `PUT /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}` — Update a VPN gateway
- `DELETE /publicCloud/project/{projectId}/vpn/gateway/{gatewayId}` — Delete a VPN gateway

## List VPN gateways

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/vpn-gateways/#getAllVpnGateways

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

Returns the VPN gateways of the project, in every region.

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Gateway[] | successful operation |

| 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 VPN gateway was created |
| `currentState` | publicCloud.vpn.GatewayCurrentState | read-only | Observed state of the VPN gateway. Null while the VPN gateway is being created. |
| `currentState.description` | string | read-only | Free-form description of the VPN gateway. Null when none was given. At most 255 characters. |
| `currentState.externalGateway` | publicCloud.vpn.ExternalGateway | read-only | Attachment of the VPN gateway to the external network, as currently applied |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `currentState.externalIpv4` | ip | read-only | Public IPv4 address of the VPN gateway, for the IPv4 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv4 subnet. |
| `currentState.externalIpv6` | ip | read-only | Public IPv6 address of the VPN gateway, for the IPv6 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv6 subnet. |
| `currentState.location` | publicCloud.vpn.Location | read-only | Region of the VPN gateway. Immutable after creation. |
| `currentState.location.region` | string | yes | Region code, such as GRA11 |
| `currentState.name` | string | read-only | Name of the VPN gateway, at most 255 characters, unique in the project |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the VPN gateway, as observed on the platform. `UP`: running. `DOWN`: not running. `UNKNOWN`: not observed recently. `DISABLED`: never returned for a VPN gateway. Null until the VPN gateway is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the VPN gateway 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` |
| `currentState.subnets` | publicCloud.vpn.GatewaySubnet[] | read-only | Subnets the VPN gateway is attached to, with its address on each |
| `currentState.subnets[].id` | string (uuid) | read-only | Identifier of the Public Cloud subnet |
| `currentState.subnets[].ip` | ip | read-only | Address of the VPN gateway on the subnet. Set it as the next hop of the subnet host routes toward the remote networks. Null until the address is allocated. |
| `currentState.subnets[].network` | publicCloud.vpn.NetworkRef | read-only | Network of the subnet. Null until the platform reports it. |
| `currentState.subnets[].status` | common.ResourceStatusEnum | read-only | Provisioning status of the VPN gateway on the subnet. `CREATING`: being plugged into the subnet. `READY`: plugged into the subnet. `ERROR`: plugging failed. `DELETING`: being detached. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the VPN gateway |
| `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 VPN gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the VPN gateway: 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.GatewayTargetSpec | read-only | Last target specification requested for the VPN gateway |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.location` | publicCloud.vpn.Location | yes | Region of the VPN gateway. Immutable after creation. |
| `targetSpec.location.region` | string | yes | Region code, such as GRA11 |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty at creation plugs the VPN gateway into no subnet. Null in a response when it is plugged into none. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |
| `updatedAt` | string (date-time) | read-only | Date and time the VPN gateway was last updated |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "description": "string",
      "externalGateway": {
        "enabled": true
      },
      "externalIpv4": "192.0.2.0",
      "externalIpv6": "192.0.2.0",
      "location": {
        "region": "string"
      },
      "name": "string",
      "operatingStatus": "DISABLED",
      "provisioningStatus": "ACTIVE",
      "subnets": [
        {
          "id": "00000000-0000-0000-0000-000000000000",
          "ip": "192.0.2.0",
          "network": {
            "id": "00000000-0000-0000-0000-000000000000"
          },
          "status": "CREATING"
        }
      ]
    },
    "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": {
      "description": "string",
      "externalGateway": {
        "enabled": true
      },
      "location": {
        "region": "string"
      },
      "name": "string",
      "subnets": [
        {
          "id": "00000000-0000-0000-0000-000000000000"
        }
      ]
    },
    "updatedAt": "2024-01-01T12:00:00Z"
  }
]
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway" \
  -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")

# 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");

print_r($result);
?>
```

## Create a VPN gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/vpn-gateways/#createVpnGateway

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

Creates a VPN gateway: a router dedicated to IPsec, running on a managed instance. When targetSpec.externalGateway.enabled is true, it gets its public addresses automatically. It is plugged into the subnets of targetSpec.subnets. Creation is asynchronous: follow resourceStatus and currentTasks, then currentState.externalIpv4 and externalIpv6 for the addresses to give to the peers.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `projectId` | path | string | yes | Project ID |

### Request body (required)

Type: `publicCloud.vpn.GatewayCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.vpn.GatewayTargetSpec | yes | Desired specification of the VPN gateway to create |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.location` | publicCloud.vpn.Location | yes | Region of the VPN gateway. Immutable after creation. |
| `targetSpec.location.region` | string | yes | Region code, such as GRA11 |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty at creation plugs the VPN gateway into no subnet. Null in a response when it is plugged into none. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |

```json
{
  "targetSpec": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Gateway | successful operation |
| 400 | object | Error 400 response |
| 403 | object | Error 403 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 VPN gateway was created |
| `currentState` | publicCloud.vpn.GatewayCurrentState | read-only | Observed state of the VPN gateway. Null while the VPN gateway is being created. |
| `currentState.description` | string | read-only | Free-form description of the VPN gateway. Null when none was given. At most 255 characters. |
| `currentState.externalGateway` | publicCloud.vpn.ExternalGateway | read-only | Attachment of the VPN gateway to the external network, as currently applied |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `currentState.externalIpv4` | ip | read-only | Public IPv4 address of the VPN gateway, for the IPv4 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv4 subnet. |
| `currentState.externalIpv6` | ip | read-only | Public IPv6 address of the VPN gateway, for the IPv6 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv6 subnet. |
| `currentState.location` | publicCloud.vpn.Location | read-only | Region of the VPN gateway. Immutable after creation. |
| `currentState.location.region` | string | yes | Region code, such as GRA11 |
| `currentState.name` | string | read-only | Name of the VPN gateway, at most 255 characters, unique in the project |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the VPN gateway, as observed on the platform. `UP`: running. `DOWN`: not running. `UNKNOWN`: not observed recently. `DISABLED`: never returned for a VPN gateway. Null until the VPN gateway is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the VPN gateway 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` |
| `currentState.subnets` | publicCloud.vpn.GatewaySubnet[] | read-only | Subnets the VPN gateway is attached to, with its address on each |
| `currentState.subnets[].id` | string (uuid) | read-only | Identifier of the Public Cloud subnet |
| `currentState.subnets[].ip` | ip | read-only | Address of the VPN gateway on the subnet. Set it as the next hop of the subnet host routes toward the remote networks. Null until the address is allocated. |
| `currentState.subnets[].network` | publicCloud.vpn.NetworkRef | read-only | Network of the subnet. Null until the platform reports it. |
| `currentState.subnets[].status` | common.ResourceStatusEnum | read-only | Provisioning status of the VPN gateway on the subnet. `CREATING`: being plugged into the subnet. `READY`: plugged into the subnet. `ERROR`: plugging failed. `DELETING`: being detached. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the VPN gateway |
| `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 VPN gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the VPN gateway: 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.GatewayTargetSpec | read-only | Last target specification requested for the VPN gateway |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.location` | publicCloud.vpn.Location | yes | Region of the VPN gateway. Immutable after creation. |
| `targetSpec.location.region` | string | yes | Region code, such as GRA11 |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty at creation plugs the VPN gateway into no subnet. Null in a response when it is plugged into none. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |
| `updatedAt` | string (date-time) | read-only | Date and time the VPN gateway was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "externalIpv4": "192.0.2.0",
    "externalIpv6": "192.0.2.0",
    "location": {
      "region": "string"
    },
    "name": "string",
    "operatingStatus": "DISABLED",
    "provisioningStatus": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "ip": "192.0.2.0",
        "network": {
          "id": "00000000-0000-0000-0000-000000000000"
        },
        "status": "CREATING"
      }
    ]
  },
  "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": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway" \
  -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.GatewayCreation
result = client.post("/v2/publicCloud/project/{projectId}/vpn/gateway",
	targetSpec = None, # Desired specification of the VPN gateway to create (type: publicCloud.vpn.GatewayTargetSpec)
)

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

print_r($result);
?>
```

## Get a VPN gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/vpn-gateways/#getVpnGateway

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

Returns the VPN gateway and its observed state.

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Gateway | 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 VPN gateway was created |
| `currentState` | publicCloud.vpn.GatewayCurrentState | read-only | Observed state of the VPN gateway. Null while the VPN gateway is being created. |
| `currentState.description` | string | read-only | Free-form description of the VPN gateway. Null when none was given. At most 255 characters. |
| `currentState.externalGateway` | publicCloud.vpn.ExternalGateway | read-only | Attachment of the VPN gateway to the external network, as currently applied |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `currentState.externalIpv4` | ip | read-only | Public IPv4 address of the VPN gateway, for the IPv4 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv4 subnet. |
| `currentState.externalIpv6` | ip | read-only | Public IPv6 address of the VPN gateway, for the IPv6 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv6 subnet. |
| `currentState.location` | publicCloud.vpn.Location | read-only | Region of the VPN gateway. Immutable after creation. |
| `currentState.location.region` | string | yes | Region code, such as GRA11 |
| `currentState.name` | string | read-only | Name of the VPN gateway, at most 255 characters, unique in the project |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the VPN gateway, as observed on the platform. `UP`: running. `DOWN`: not running. `UNKNOWN`: not observed recently. `DISABLED`: never returned for a VPN gateway. Null until the VPN gateway is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the VPN gateway 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` |
| `currentState.subnets` | publicCloud.vpn.GatewaySubnet[] | read-only | Subnets the VPN gateway is attached to, with its address on each |
| `currentState.subnets[].id` | string (uuid) | read-only | Identifier of the Public Cloud subnet |
| `currentState.subnets[].ip` | ip | read-only | Address of the VPN gateway on the subnet. Set it as the next hop of the subnet host routes toward the remote networks. Null until the address is allocated. |
| `currentState.subnets[].network` | publicCloud.vpn.NetworkRef | read-only | Network of the subnet. Null until the platform reports it. |
| `currentState.subnets[].status` | common.ResourceStatusEnum | read-only | Provisioning status of the VPN gateway on the subnet. `CREATING`: being plugged into the subnet. `READY`: plugged into the subnet. `ERROR`: plugging failed. `DELETING`: being detached. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the VPN gateway |
| `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 VPN gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the VPN gateway: 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.GatewayTargetSpec | read-only | Last target specification requested for the VPN gateway |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.location` | publicCloud.vpn.Location | yes | Region of the VPN gateway. Immutable after creation. |
| `targetSpec.location.region` | string | yes | Region code, such as GRA11 |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty at creation plugs the VPN gateway into no subnet. Null in a response when it is plugged into none. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |
| `updatedAt` | string (date-time) | read-only | Date and time the VPN gateway was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "externalIpv4": "192.0.2.0",
    "externalIpv6": "192.0.2.0",
    "location": {
      "region": "string"
    },
    "name": "string",
    "operatingStatus": "DISABLED",
    "provisioningStatus": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "ip": "192.0.2.0",
        "network": {
          "id": "00000000-0000-0000-0000-000000000000"
        },
        "status": "CREATING"
      }
    ]
  },
  "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": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}" \
  -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}")

# 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}");

print_r($result);
?>
```

## Update a VPN gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/vpn-gateways/#editVpnGateway

**Status:** Alpha version  
**IAM actions:** `publicCloudProject:apiovh:vpn/gateway/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. Subnets added to targetSpec.subnets are plugged and subnets removed are unplugged, which is asynchronous: follow resourceStatus and currentState.subnets. Likewise, setting targetSpec.externalGateway.enabled to true attaches the VPN gateway to the external network: follow resourceStatus. Once enabled, it cannot be disabled: create another VPN gateway instead. Refused while the VPN gateway is being created, updated or deleted: follow its resourceStatus and retry once it is READY or ERROR.

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

| 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.GatewayUpdateTargetSpec | yes | Desired specification of the VPN gateway. It replaces the previous one as a whole. |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty unplugs the VPN gateway from every subnet. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |

```json
{
  "checksum": "string",
  "targetSpec": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "name": "string",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  }
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Gateway | 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 VPN gateway was created |
| `currentState` | publicCloud.vpn.GatewayCurrentState | read-only | Observed state of the VPN gateway. Null while the VPN gateway is being created. |
| `currentState.description` | string | read-only | Free-form description of the VPN gateway. Null when none was given. At most 255 characters. |
| `currentState.externalGateway` | publicCloud.vpn.ExternalGateway | read-only | Attachment of the VPN gateway to the external network, as currently applied |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `currentState.externalIpv4` | ip | read-only | Public IPv4 address of the VPN gateway, for the IPv4 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv4 subnet. |
| `currentState.externalIpv6` | ip | read-only | Public IPv6 address of the VPN gateway, for the IPv6 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv6 subnet. |
| `currentState.location` | publicCloud.vpn.Location | read-only | Region of the VPN gateway. Immutable after creation. |
| `currentState.location.region` | string | yes | Region code, such as GRA11 |
| `currentState.name` | string | read-only | Name of the VPN gateway, at most 255 characters, unique in the project |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the VPN gateway, as observed on the platform. `UP`: running. `DOWN`: not running. `UNKNOWN`: not observed recently. `DISABLED`: never returned for a VPN gateway. Null until the VPN gateway is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the VPN gateway 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` |
| `currentState.subnets` | publicCloud.vpn.GatewaySubnet[] | read-only | Subnets the VPN gateway is attached to, with its address on each |
| `currentState.subnets[].id` | string (uuid) | read-only | Identifier of the Public Cloud subnet |
| `currentState.subnets[].ip` | ip | read-only | Address of the VPN gateway on the subnet. Set it as the next hop of the subnet host routes toward the remote networks. Null until the address is allocated. |
| `currentState.subnets[].network` | publicCloud.vpn.NetworkRef | read-only | Network of the subnet. Null until the platform reports it. |
| `currentState.subnets[].status` | common.ResourceStatusEnum | read-only | Provisioning status of the VPN gateway on the subnet. `CREATING`: being plugged into the subnet. `READY`: plugged into the subnet. `ERROR`: plugging failed. `DELETING`: being detached. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the VPN gateway |
| `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 VPN gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the VPN gateway: 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.GatewayTargetSpec | read-only | Last target specification requested for the VPN gateway |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.location` | publicCloud.vpn.Location | yes | Region of the VPN gateway. Immutable after creation. |
| `targetSpec.location.region` | string | yes | Region code, such as GRA11 |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty at creation plugs the VPN gateway into no subnet. Null in a response when it is plugged into none. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |
| `updatedAt` | string (date-time) | read-only | Date and time the VPN gateway was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "externalIpv4": "192.0.2.0",
    "externalIpv6": "192.0.2.0",
    "location": {
      "region": "string"
    },
    "name": "string",
    "operatingStatus": "DISABLED",
    "provisioningStatus": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "ip": "192.0.2.0",
        "network": {
          "id": "00000000-0000-0000-0000-000000000000"
        },
        "status": "CREATING"
      }
    ]
  },
  "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": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}" \
  -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.GatewayUpdate
result = client.put("/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}",
	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 VPN gateway. It replaces the previous one as a whole. (type: publicCloud.vpn.GatewayUpdateTargetSpec)
)

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

print_r($result);
?>
```

## Delete a VPN gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/site-to-site-vpn/vpn-gateways/#deleteVpnGateway

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

Deletes the VPN gateway, with its IPsec connections and their tunnels, and releases its public addresses. Refused while the VPN gateway is being created, updated or deleted: follow its resourceStatus and retry once it is READY or ERROR. Deletion is asynchronous: the VPN gateway stays listed with resourceStatus DELETING until it is gone.

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.vpn.Gateway | 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 VPN gateway was created |
| `currentState` | publicCloud.vpn.GatewayCurrentState | read-only | Observed state of the VPN gateway. Null while the VPN gateway is being created. |
| `currentState.description` | string | read-only | Free-form description of the VPN gateway. Null when none was given. At most 255 characters. |
| `currentState.externalGateway` | publicCloud.vpn.ExternalGateway | read-only | Attachment of the VPN gateway to the external network, as currently applied |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `currentState.externalIpv4` | ip | read-only | Public IPv4 address of the VPN gateway, for the IPv4 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv4 subnet. |
| `currentState.externalIpv6` | ip | read-only | Public IPv6 address of the VPN gateway, for the IPv6 peers. Null while the external gateway is disabled, until it is attached, or when the external network has no IPv6 subnet. |
| `currentState.location` | publicCloud.vpn.Location | read-only | Region of the VPN gateway. Immutable after creation. |
| `currentState.location.region` | string | yes | Region code, such as GRA11 |
| `currentState.name` | string | read-only | Name of the VPN gateway, at most 255 characters, unique in the project |
| `currentState.operatingStatus` | publicCloud.vpn.OperatingStatusEnum | read-only | Operating status of the VPN gateway, as observed on the platform. `UP`: running. `DOWN`: not running. `UNKNOWN`: not observed recently. `DISABLED`: never returned for a VPN gateway. Null until the VPN gateway is first observed, and while `provisioningStatus` is not `ACTIVE`. — one of `DISABLED`, `DOWN`, `UNKNOWN`, `UP` |
| `currentState.provisioningStatus` | publicCloud.vpn.ProvisioningStatusEnum | read-only | Provisioning status of the VPN gateway 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` |
| `currentState.subnets` | publicCloud.vpn.GatewaySubnet[] | read-only | Subnets the VPN gateway is attached to, with its address on each |
| `currentState.subnets[].id` | string (uuid) | read-only | Identifier of the Public Cloud subnet |
| `currentState.subnets[].ip` | ip | read-only | Address of the VPN gateway on the subnet. Set it as the next hop of the subnet host routes toward the remote networks. Null until the address is allocated. |
| `currentState.subnets[].network` | publicCloud.vpn.NetworkRef | read-only | Network of the subnet. Null until the platform reports it. |
| `currentState.subnets[].status` | common.ResourceStatusEnum | read-only | Provisioning status of the VPN gateway on the subnet. `CREATING`: being plugged into the subnet. `READY`: plugged into the subnet. `ERROR`: plugging failed. `DELETING`: being detached. — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `currentTasks` | common.CurrentTask[] | read-only | Asynchronous operations ongoing on the VPN gateway |
| `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 VPN gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Readiness of the VPN gateway: 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.GatewayTargetSpec | read-only | Last target specification requested for the VPN gateway |
| `targetSpec.description` | string |  | Free-form description of the VPN gateway. At most 255 characters. |
| `targetSpec.externalGateway` | publicCloud.vpn.ExternalGateway | yes | Attachment of the VPN gateway to the external network, which gives it its public addresses |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the VPN gateway is attached to the external network. When true, the VPN gateway gets the public addresses reported in currentState.externalIpv4 and externalIpv6. |
| `targetSpec.location` | publicCloud.vpn.Location | yes | Region of the VPN gateway. Immutable after creation. |
| `targetSpec.location.region` | string | yes | Region code, such as GRA11 |
| `targetSpec.name` | string | yes | Name of the VPN gateway, at most 255 characters, unique in the project |
| `targetSpec.subnets` | publicCloud.vpn.SubnetRef[] |  | Private subnets the VPN gateway is plugged into, as router interfaces: the IPsec connections carry the traffic of the networks behind them. Each subnet must belong to the project, or sit on a network shared with the project. The interfaces run without port security, so any host of these subnets can reach the VPN gateway. Replaced as a whole on update: a subnet added is plugged, a subnet removed is unplugged. Null or empty at creation plugs the VPN gateway into no subnet. Null in a response when it is plugged into none. |
| `targetSpec.subnets[].id` | string (uuid) | yes | Unique identifier of the Public Cloud subnet, as returned by /publicCloud/project/{projectId}/network/{networkId}/subnet |
| `updatedAt` | string (date-time) | read-only | Date and time the VPN gateway was last updated |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "externalIpv4": "192.0.2.0",
    "externalIpv6": "192.0.2.0",
    "location": {
      "region": "string"
    },
    "name": "string",
    "operatingStatus": "DISABLED",
    "provisioningStatus": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000",
        "ip": "192.0.2.0",
        "network": {
          "id": "00000000-0000-0000-0000-000000000000"
        },
        "status": "CREATING"
      }
    ]
  },
  "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": {
    "description": "string",
    "externalGateway": {
      "enabled": true
    },
    "location": {
      "region": "string"
    },
    "name": "string",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "updatedAt": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/v2/publicCloud/project/{projectId}/vpn/gateway/{gatewayId}" \
  -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}")

# 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}");

print_r($result);
?>
```
