# Web Cloud › OverTheBox › Wireguard › Peers 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

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

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

## Operations

- `GET /overTheBox/{serviceName}/wireguard/peers` — List the WireGuard peers of an OverTheBox service
- `POST /overTheBox/{serviceName}/wireguard/peers` — Create a WireGuard peer on an OverTheBox service
- `GET /overTheBox/{serviceName}/wireguard/peers/{peerId}` — Get a WireGuard peer of an OverTheBox service
- `PUT /overTheBox/{serviceName}/wireguard/peers/{peerId}` — Update a WireGuard peer of an OverTheBox service
- `DELETE /overTheBox/{serviceName}/wireguard/peers/{peerId}` — Delete a WireGuard peer of an OverTheBox service

## List the WireGuard peers of an OverTheBox service

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

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

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

Returns the IDs of the WireGuard peers configured on the OverTheBox service.

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string[] | successful operation |

```json
[
  "string"
]
```

### Example

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

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

print_r($result);
?>
```

## Create a WireGuard peer on an OverTheBox service

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

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

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

Adds a WireGuard peer to the service from its name, description, public key and private IPv4. Returns the created peer.

### Parameters

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

### Request body (required)

Type: `otb.service.wg.peer.create`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | yes | Wireguard peer description |
| `name` | string | yes | Wireguard peer name |
| `privateIpv4` | ipv4Block | yes | Wireguard peer private IP |
| `publicKey` | string | yes | Wireguard peer public key |

```json
{
  "description": "string",
  "name": "string",
  "privateIpv4": "192.0.2.0/24",
  "publicKey": "string"
}
```

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `active` | boolean | read-only | Wireguard peer status |
| `description` | string | read-only | Wireguard peer description |
| `name` | string | read-only | Wireguard peer name |
| `peerId` | string | read-only | Wireguard peer id |
| `privateIpv4` | ipv4Block | read-only | Wireguard peer private IP |
| `publicKey` | string | read-only | Wireguard peer public key |

```json
{
  "active": true,
  "description": "string",
  "name": "string",
  "peerId": "string",
  "privateIpv4": "192.0.2.0/24",
  "publicKey": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/overTheBox/{serviceName}/wireguard/peers" \
  -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: otb.service.wg.peer.create
result = client.post("/overTheBox/{serviceName}/wireguard/peers",
	description = None, # Wireguard peer description (type: string)
	name = None, # Wireguard peer name (type: string)
	privateIpv4 = None, # Wireguard peer private IP (type: ipv4Block)
	publicKey = None, # Wireguard peer public key (type: string)
)

# 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: otb.service.wg.peer.create
$result = $ovh->post("/overTheBox/{serviceName}/wireguard/peers", array(
	description => null, // Wireguard peer description (type: string)
	name => null, // Wireguard peer name (type: string)
	privateIpv4 => null, // Wireguard peer private IP (type: ipv4Block)
	publicKey => null, // Wireguard peer public key (type: string)
));

print_r($result);
?>
```

## Get a WireGuard peer of an OverTheBox service

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

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

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

Returns a WireGuard peer with its name, description, public key, private IPv4 and whether it is active.

### Parameters

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

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `active` | boolean | read-only | Wireguard peer status |
| `description` | string | read-only | Wireguard peer description |
| `name` | string | read-only | Wireguard peer name |
| `peerId` | string | read-only | Wireguard peer id |
| `privateIpv4` | ipv4Block | read-only | Wireguard peer private IP |
| `publicKey` | string | read-only | Wireguard peer public key |

```json
{
  "active": true,
  "description": "string",
  "name": "string",
  "peerId": "string",
  "privateIpv4": "192.0.2.0/24",
  "publicKey": "string"
}
```

### Example

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

# 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/peers/{peerId}");

print_r($result);
?>
```

## Update a WireGuard peer of an OverTheBox service

`PUT /1.0/overTheBox/{serviceName}/wireguard/peers/{peerId}`

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

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

Changes the name, description, public key, private IPv4 or active status of a WireGuard peer. Returns the task that applies the change.

### Parameters

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

### Request body (required)

Type: `otb.service.wg.peer.edit`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `active` | boolean |  | Wireguard peer status |
| `description` | string |  | Wireguard peer description |
| `name` | string |  | Wireguard peer name |
| `privateIpv4` | ipv4Block |  | Wireguard peer private IP |
| `publicKey` | string |  | Wireguard peer public key |

```json
{
  "active": true,
  "description": "string",
  "name": "string",
  "privateIpv4": "192.0.2.0/24",
  "publicKey": "string"
}
```

### 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 PUT \
  "https://api.eu.ovhcloud.com/1.0/overTheBox/{serviceName}/wireguard/peers/{peerId}" \
  -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: otb.service.wg.peer.edit
result = client.put("/overTheBox/{serviceName}/wireguard/peers/{peerId}",
	active = None, # Wireguard peer status (type: boolean)
	description = None, # Wireguard peer description (type: string)
	name = None, # Wireguard peer name (type: string)
	privateIpv4 = None, # Wireguard peer private IP (type: ipv4Block)
	publicKey = None, # Wireguard peer public key (type: string)
)

# 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: otb.service.wg.peer.edit
$result = $ovh->put("/overTheBox/{serviceName}/wireguard/peers/{peerId}", array(
	active => null, // Wireguard peer status (type: boolean)
	description => null, // Wireguard peer description (type: string)
	name => null, // Wireguard peer name (type: string)
	privateIpv4 => null, // Wireguard peer private IP (type: ipv4Block)
	publicKey => null, // Wireguard peer public key (type: string)
));

print_r($result);
?>
```

## Delete a WireGuard peer of an OverTheBox service

`DELETE /1.0/overTheBox/{serviceName}/wireguard/peers/{peerId}`

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

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

Removes the WireGuard peer from the service. Returns the task that performs the removal.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `peerId` | path | string | yes | Peer ID |
| `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 DELETE \
  "https://api.eu.ovhcloud.com/1.0/overTheBox/{serviceName}/wireguard/peers/{peerId}" \
  -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("/overTheBox/{serviceName}/wireguard/peers/{peerId}")

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

print_r($result);
?>
```
