# Web Cloud › OverTheBox › Wireguard API

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

> 3 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/web-cloud/overthebox/wireguard/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/web-cloud/overthebox/wireguard.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/web-cloud/overthebox/wireguard.json?format=openapi3

## Operations

- `POST /overTheBox/{serviceName}/wireguard/regenerate` — Regenerate the WireGuard server key of an OverTheBox service
- `POST /overTheBox/{serviceName}/wireguard/reset` — Reset the WireGuard configuration of an OverTheBox service
- `GET /overTheBox/{serviceName}/wireguard` — Get the WireGuard server of an OverTheBox service

## Regenerate the WireGuard server key of an OverTheBox service

`POST /1.0/overTheBox/{serviceName}/wireguard/regenerate`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/overthebox/wireguard/#post-overthebox-servicename-wireguard-regenerate

**Status:** Beta version  
**IAM actions:** `overTheBox:apiovh:wireguard/regenerate`

Regenerates the key of the WireGuard server of the service, which changes the server public key the peers use. Returns the task that performs the change.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | otb.service.task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | read-only | Service task name |
| `status` | otb.service.task.statusEnum | read-only | Service task status — one of `doing`, `done`, `error`, `todo` |
| `taskId` | string | read-only | Service task ID |

```json
{
  "name": "string",
  "status": "doing",
  "taskId": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/overTheBox/{serviceName}/wireguard/regenerate" \
  -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.post("/overTheBox/{serviceName}/wireguard/regenerate")

# 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->post("/overTheBox/{serviceName}/wireguard/regenerate");

print_r($result);
?>
```

## Reset the WireGuard configuration of an OverTheBox service

`POST /1.0/overTheBox/{serviceName}/wireguard/reset`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/overthebox/wireguard/#post-overthebox-servicename-wireguard-reset

**Status:** Beta version  
**IAM actions:** `overTheBox:apiovh:wireguard/reset`

Resets the WireGuard configuration of the service to its default. Returns the task that performs the reset.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | otb.service.task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | read-only | Service task name |
| `status` | otb.service.task.statusEnum | read-only | Service task status — one of `doing`, `done`, `error`, `todo` |
| `taskId` | string | read-only | Service task ID |

```json
{
  "name": "string",
  "status": "doing",
  "taskId": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/overTheBox/{serviceName}/wireguard/reset" \
  -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.post("/overTheBox/{serviceName}/wireguard/reset")

# 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->post("/overTheBox/{serviceName}/wireguard/reset");

print_r($result);
?>
```

## Get the WireGuard server of an OverTheBox service

`GET /1.0/overTheBox/{serviceName}/wireguard`

Link: https://developers.eu.ovhcloud.com/reference/web-cloud/overthebox/wireguard/#get-overthebox-servicename-wireguard

**Status:** Beta version  
**IAM actions:** `overTheBox:apiovh:wireguard/get`

Returns the WireGuard server configuration: its public key, private IPv4 block, connection endpoint (IPv4 and port), and the maximum number of peers configured and simultaneously active.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | otb.service.wg.server | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `endpoint` | otb.service.wg.server.endpoint | read-only | Wireguard server connection endpoint |
| `endpoint.ipv4` | ipv4 | read-only | Wireguard server IPv4 connection endpoint |
| `endpoint.port` | integer | read-only | Wireguard server connection port |
| `maxPeerActive` | integer | read-only | Maximum peers simultaneously active |
| `maxPeerAllowed` | integer | read-only | Maximum peers simultaneously configured |
| `privateIpv4` | ipv4Block | read-only | Wireguard server private IP block |
| `publicKey` | string | read-only | Wireguard server public key |

```json
{
  "endpoint": {
    "ipv4": "192.0.2.0",
    "port": 0
  },
  "maxPeerActive": 0,
  "maxPeerAllowed": 0,
  "privateIpv4": "192.0.2.0/24",
  "publicKey": "string"
}
```

### Example

```bash
curl -X GET \
  "https://api.eu.ovhcloud.com/1.0/overTheBox/{serviceName}/wireguard" \
  -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("/overTheBox/{serviceName}/wireguard")

# 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("/overTheBox/{serviceName}/wireguard");

print_r($result);
?>
```
