# Public Cloud › Network › Gateway 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/gateway/

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

## Operations

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

## List gateways

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/gateway/#getGateways

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

Returns the gateways of the project. Filter by region with the `region` query parameter.

### 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 |
| `region` | query | string |  | Optional region filter |

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the gateway |
| `currentState` | publicCloud.gateway.GatewayCurrentState | read-only | Current state of the gateway |
| `currentState.description` | string | read-only | Gateway description |
| `currentState.externalGateway` | publicCloud.gateway.ExternalGateway | read-only | External gateway configuration |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `currentState.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `currentState.externalIp` | ip | read-only | External IP address assigned to the gateway |
| `currentState.location` | publicCloud.gateway.GatewayLocation | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Gateway name |
| `currentState.status` | publicCloud.gateway.GatewayStatusEnum | read-only | OpenStack router status — one of `ACTIVE`, `BUILD`, `DOWN`, `ERROR` |
| `currentState.subnets` | publicCloud.gateway.GatewaySubnet[] | read-only | Currently attached subnets |
| `currentState.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the 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 gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Gateway readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.gateway.GatewayTargetSpec | read-only | Last target specification of the gateway |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.location` | publicCloud.gateway.GatewayLocation | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `updatedAt` | string (date-time) | read-only | Last update date of the gateway |

```json
[
  {
    "checksum": "string",
    "createdAt": "2024-01-01T12:00:00Z",
    "currentState": {
      "description": "string",
      "externalGateway": {
        "enabled": true,
        "model": "2XL"
      },
      "externalIp": "192.0.2.0",
      "location": {
        "availabilityZone": "string",
        "region": "string"
      },
      "name": "string",
      "status": "ACTIVE",
      "subnets": [
        {
          "id": "00000000-0000-0000-0000-000000000000"
        }
      ]
    },
    "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,
        "model": "2XL"
      },
      "location": {
        "availabilityZone": "string",
        "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}/gateway" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

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

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

result = client.get("/v2/publicCloud/project/{projectId}/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}/gateway");

print_r($result);
?>
```

## Get a gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/gateway/#getGateway

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

Returns the gateway, including its attached subnets and external IP.

### 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.gateway.Gateway | successful operation |
| 404 | object | Error 404 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the gateway |
| `currentState` | publicCloud.gateway.GatewayCurrentState | read-only | Current state of the gateway |
| `currentState.description` | string | read-only | Gateway description |
| `currentState.externalGateway` | publicCloud.gateway.ExternalGateway | read-only | External gateway configuration |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `currentState.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `currentState.externalIp` | ip | read-only | External IP address assigned to the gateway |
| `currentState.location` | publicCloud.gateway.GatewayLocation | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Gateway name |
| `currentState.status` | publicCloud.gateway.GatewayStatusEnum | read-only | OpenStack router status — one of `ACTIVE`, `BUILD`, `DOWN`, `ERROR` |
| `currentState.subnets` | publicCloud.gateway.GatewaySubnet[] | read-only | Currently attached subnets |
| `currentState.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the 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 gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Gateway readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.gateway.GatewayTargetSpec | read-only | Last target specification of the gateway |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.location` | publicCloud.gateway.GatewayLocation | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `updatedAt` | string (date-time) | read-only | Last update date of the gateway |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true,
      "model": "2XL"
    },
    "externalIp": "192.0.2.0",
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "status": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "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,
      "model": "2XL"
    },
    "location": {
      "availabilityZone": "string",
      "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}/gateway/{gatewayId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

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

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

result = client.get("/v2/publicCloud/project/{projectId}/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}/gateway/{gatewayId}");

print_r($result);
?>
```

## Create a gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/gateway/#createGateway

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

Creates a gateway. An external gateway is required. Subnets can be attached as router interfaces.

### Parameters

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

### Request body (required)

Type: `publicCloud.gateway.GatewayCreation`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `targetSpec` | publicCloud.gateway.GatewayTargetSpec | yes | Desired target specification for the gateway to create |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.location` | publicCloud.gateway.GatewayLocation | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.gateway.Gateway | successful operation |
| 400 | object | Error 400 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the gateway |
| `currentState` | publicCloud.gateway.GatewayCurrentState | read-only | Current state of the gateway |
| `currentState.description` | string | read-only | Gateway description |
| `currentState.externalGateway` | publicCloud.gateway.ExternalGateway | read-only | External gateway configuration |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `currentState.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `currentState.externalIp` | ip | read-only | External IP address assigned to the gateway |
| `currentState.location` | publicCloud.gateway.GatewayLocation | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Gateway name |
| `currentState.status` | publicCloud.gateway.GatewayStatusEnum | read-only | OpenStack router status — one of `ACTIVE`, `BUILD`, `DOWN`, `ERROR` |
| `currentState.subnets` | publicCloud.gateway.GatewaySubnet[] | read-only | Currently attached subnets |
| `currentState.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the 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 gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Gateway readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.gateway.GatewayTargetSpec | read-only | Last target specification of the gateway |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.location` | publicCloud.gateway.GatewayLocation | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `updatedAt` | string (date-time) | read-only | Last update date of the gateway |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true,
      "model": "2XL"
    },
    "externalIp": "192.0.2.0",
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "status": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "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,
      "model": "2XL"
    },
    "location": {
      "availabilityZone": "string",
      "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}/gateway" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

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

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

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

print_r($result);
?>
```

## Delete a gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/gateway/#deleteGateway

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

Deletes the gateway.

### 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.gateway.Gateway | successful operation |
| 404 | object | Error 404 response |
| 409 | object | Error 409 response |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `checksum` | string | read-only | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the gateway |
| `currentState` | publicCloud.gateway.GatewayCurrentState | read-only | Current state of the gateway |
| `currentState.description` | string | read-only | Gateway description |
| `currentState.externalGateway` | publicCloud.gateway.ExternalGateway | read-only | External gateway configuration |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `currentState.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `currentState.externalIp` | ip | read-only | External IP address assigned to the gateway |
| `currentState.location` | publicCloud.gateway.GatewayLocation | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Gateway name |
| `currentState.status` | publicCloud.gateway.GatewayStatusEnum | read-only | OpenStack router status — one of `ACTIVE`, `BUILD`, `DOWN`, `ERROR` |
| `currentState.subnets` | publicCloud.gateway.GatewaySubnet[] | read-only | Currently attached subnets |
| `currentState.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the 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 gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Gateway readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.gateway.GatewayTargetSpec | read-only | Last target specification of the gateway |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.location` | publicCloud.gateway.GatewayLocation | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `updatedAt` | string (date-time) | read-only | Last update date of the gateway |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true,
      "model": "2XL"
    },
    "externalIp": "192.0.2.0",
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "status": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "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,
      "model": "2XL"
    },
    "location": {
      "availabilityZone": "string",
      "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}/gateway/{gatewayId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN"
```

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

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

result = client.delete("/v2/publicCloud/project/{projectId}/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}/gateway/{gatewayId}");

print_r($result);
?>
```

## Update a gateway

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

Link: https://developers.eu.ovhcloud.com/reference/public-cloud/network/gateway/#editGateway

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

Updates the gateway's name, description, external gateway or attached subnets. Location is immutable after creation.

### Parameters

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

### Request body (required)

Type: `publicCloud.gateway.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.gateway.GatewayUpdateTargetSpec | yes | Desired target specification for the gateway |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | publicCloud.gateway.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 | Computed hash representing the current target specification value |
| `createdAt` | string (date-time) | read-only | Creation date of the gateway |
| `currentState` | publicCloud.gateway.GatewayCurrentState | read-only | Current state of the gateway |
| `currentState.description` | string | read-only | Gateway description |
| `currentState.externalGateway` | publicCloud.gateway.ExternalGateway | read-only | External gateway configuration |
| `currentState.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `currentState.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `currentState.externalIp` | ip | read-only | External IP address assigned to the gateway |
| `currentState.location` | publicCloud.gateway.GatewayLocation | read-only | Current location |
| `currentState.location.availabilityZone` | string |  | Availability zone within the region |
| `currentState.location.region` | string | yes | Region code |
| `currentState.name` | string | read-only | Gateway name |
| `currentState.status` | publicCloud.gateway.GatewayStatusEnum | read-only | OpenStack router status — one of `ACTIVE`, `BUILD`, `DOWN`, `ERROR` |
| `currentState.subnets` | publicCloud.gateway.GatewaySubnet[] | read-only | Currently attached subnets |
| `currentState.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `currentTasks` | common.CurrentTask[] | read-only | Ongoing asynchronous tasks related to the 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 gateway |
| `resourceStatus` | common.ResourceStatusEnum | read-only | Gateway readiness in the system — one of `CREATING`, `CREATION_PLANNED`, `DELETING`, `ERROR`, `OUT_OF_SYNC`, `READY`, `SUSPENDED`, `UNKNOWN`, `UPDATING` |
| `targetSpec` | publicCloud.gateway.GatewayTargetSpec | read-only | Last target specification of the gateway |
| `targetSpec.description` | string |  | Gateway description |
| `targetSpec.externalGateway` | publicCloud.gateway.ExternalGateway | yes | External gateway configuration |
| `targetSpec.externalGateway.enabled` | boolean | yes | Whether the external gateway is enabled |
| `targetSpec.externalGateway.model` | publicCloud.gateway.ExternalGatewayModelEnum |  | External gateway sizing model. Present only when enabled is true. — one of `2XL`, `3XL`, `L`, `M`, `S`, `XL` |
| `targetSpec.location` | publicCloud.gateway.GatewayLocation | yes | Target location |
| `targetSpec.location.availabilityZone` | string |  | Availability zone within the region |
| `targetSpec.location.region` | string | yes | Region code |
| `targetSpec.name` | string | yes | Gateway name |
| `targetSpec.subnets` | publicCloud.gateway.GatewaySubnet[] |  | Subnets to attach as router interfaces |
| `targetSpec.subnets[].id` | string (uuid) | yes | Identifier of the subnet |
| `updatedAt` | string (date-time) | read-only | Last update date of the gateway |

```json
{
  "checksum": "string",
  "createdAt": "2024-01-01T12:00:00Z",
  "currentState": {
    "description": "string",
    "externalGateway": {
      "enabled": true,
      "model": "2XL"
    },
    "externalIp": "192.0.2.0",
    "location": {
      "availabilityZone": "string",
      "region": "string"
    },
    "name": "string",
    "status": "ACTIVE",
    "subnets": [
      {
        "id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  },
  "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,
      "model": "2XL"
    },
    "location": {
      "availabilityZone": "string",
      "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}/gateway/{gatewayId}" \
  -H "accept: application/json" \
  -H "authorization: Bearer $OVH_TOKEN" \
  -H "content-type: application/json" \
  -d '{ }'
```

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

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

# Request body type: publicCloud.gateway.GatewayUpdate
result = client.put("/v2/publicCloud/project/{projectId}/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 target specification for the gateway (type: publicCloud.gateway.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.gateway.GatewayUpdate
$result = $ovh->put("/v2/publicCloud/project/{projectId}/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 target specification for the gateway (type: publicCloud.gateway.GatewayUpdateTargetSpec)
));

print_r($result);
?>
```
