# Network › OVHcloud Connect › Family : Direct API

> Part of the OVHcloud developer hub. Index of every page and section: https://developers.eu.ovhcloud.com/llms.txt
> The Network product's sections: https://developers.eu.ovhcloud.com/reference/network/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/network/ovhcloud-connect/family-direct/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/network/ovhcloud-connect/family-direct.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/network/ovhcloud-connect/family-direct.json?format=openapi3

## Operations

- `POST /ovhCloudConnect/{serviceName}/interface/{id}/lock` — Lock interface
- `POST /ovhCloudConnect/{serviceName}/interface/{id}/unlock` — Unlock interface
- `POST /ovhCloudConnect/{serviceName}/loa` — Generate LOA

## Lock interface

`POST /1.0/ovhCloudConnect/{serviceName}/interface/{id}/lock`

Link: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/family-direct/#post-ovhcloudconnect-servicename-interface-id-lock

**Status:** Stable production version  
**IAM actions:** `ovhCloudConnect:apiovh:interface/lock`

Blocks all traffic on the port until it is unlocked (async task).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string (uuid) | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ovhcloudconnect.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | ovhcloudconnect.task.FunctionEnum | read-only | Task function — one of `addDatacenterConfiguration`, `addDatacenterExtraConfiguration`, `addPopConfiguration`, `addVrack`, `consumePairingKey`, `delDatacenterConfiguration`, `delDatacenterExtraConfiguration`, `delPopConfiguration`, `deleteCircuit`, `diagAccessEdge`, `diagMacs`, `diagPeering`, … |
| `id` | integer | read-only | Task id |
| `resourceId` | integer | read-only | Reference of the created resource |
| `status` | ovhcloudconnect.task.StatusEnum | read-only | Task status — one of `denied`, `doing`, `done`, `error`, `pause`, `todo` |

```json
{
  "function": "addDatacenterConfiguration",
  "id": 0,
  "resourceId": 0,
  "status": "denied"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/ovhCloudConnect/{serviceName}/interface/{id}/lock" \
  -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("/ovhCloudConnect/{serviceName}/interface/{id}/lock")

# 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("/ovhCloudConnect/{serviceName}/interface/{id}/lock");

print_r($result);
?>
```

## Unlock interface

`POST /1.0/ovhCloudConnect/{serviceName}/interface/{id}/unlock`

Link: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/family-direct/#post-ovhcloudconnect-servicename-interface-id-unlock

**Status:** Stable production version  
**IAM actions:** `ovhCloudConnect:apiovh:interface/unlock`

Restores traffic on a locked port (async task).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | integer | yes | Id |
| `serviceName` | path | string (uuid) | yes | Service name |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ovhcloudconnect.Task | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | ovhcloudconnect.task.FunctionEnum | read-only | Task function — one of `addDatacenterConfiguration`, `addDatacenterExtraConfiguration`, `addPopConfiguration`, `addVrack`, `consumePairingKey`, `delDatacenterConfiguration`, `delDatacenterExtraConfiguration`, `delPopConfiguration`, `deleteCircuit`, `diagAccessEdge`, `diagMacs`, `diagPeering`, … |
| `id` | integer | read-only | Task id |
| `resourceId` | integer | read-only | Reference of the created resource |
| `status` | ovhcloudconnect.task.StatusEnum | read-only | Task status — one of `denied`, `doing`, `done`, `error`, `pause`, `todo` |

```json
{
  "function": "addDatacenterConfiguration",
  "id": 0,
  "resourceId": 0,
  "status": "denied"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/ovhCloudConnect/{serviceName}/interface/{id}/unlock" \
  -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("/ovhCloudConnect/{serviceName}/interface/{id}/unlock")

# 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("/ovhCloudConnect/{serviceName}/interface/{id}/unlock");

print_r($result);
?>
```

## Generate LOA

`POST /1.0/ovhCloudConnect/{serviceName}/loa`

Link: https://developers.eu.ovhcloud.com/reference/network/ovhcloud-connect/family-direct/#post-ovhcloudconnect-servicename-loa

**Status:** Stable production version  
**IAM actions:** `ovhCloudConnect:apiovh:loa/create`

Generates the Letter of Authorization the PoP operator needs to set up your cross-connect.

### Parameters

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

### Responses

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

```json
"string"
```

### Example

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

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

print_r($result);
?>
```
