# Network › IP addresses › Bring Your Own IP 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

> 9 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/ip-addresses/bring-your-own-ip/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/network/ip-addresses/bring-your-own-ip.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/network/ip-addresses/bring-your-own-ip.json?format=openapi3

## Operations

- `GET /ip/service/{serviceName}/bringYourOwnIp/subRange` — List sub-ranges
- `GET /ip/{ip}/bringYourOwnIp/slice` — List slicing options
- `GET /ip/{ip}/bringYourOwnIp/aggregate` — List aggregation options
- `GET /ip/service/{serviceName}/bringYourOwnIp/importedRange` — Get the imported range
- `GET /ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}` — Get a sub-range
- `POST /ip/service/{serviceName}/bringYourOwnIp/subRange` — Create an IPv6 sub-range
- `POST /ip/{ip}/bringYourOwnIp/slice` — Slice an IPv4 block
- `POST /ip/{ip}/bringYourOwnIp/aggregate` — Aggregate IPv4 blocks
- `DELETE /ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}` — Delete an IPv6 sub-range

## List sub-ranges

`GET /1.0/ip/service/{serviceName}/bringYourOwnIp/subRange`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#get-ip-service-servicename-bringyourownip-subrange

**Status:** Beta version  
**IAM actions:** `ip:apiovh:service/bringYourOwnIp/subRange/get`

List sub-ranges. Returns the IPv4 and IPv6 sub-ranges of the imported range, as IP blocks in CIDR notation.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your IP services |

### Responses

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

```json
[
  "192.0.2.0/24"
]
```

### Example

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

# 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("/ip/service/{serviceName}/bringYourOwnIp/subRange");

print_r($result);
?>
```

## List slicing options

`GET /1.0/ip/{ip}/bringYourOwnIp/slice`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#get-ip-ip-bringyourownip-slice

**Status:** Beta version  
**IAM actions:** `ip:apiovh:bringYourOwnIp/slice/get`

List slicing options. Returns, for each allowed size, the Additional IPs that slicing this one would create. Slicing applies to IPv4 blocks only.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipBlock | yes | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.ByoipSlicingPreview[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `childrenIps` | ipBlock[] |  | Additional IP(s) that will be created |
| `slicingSize` | integer |  | Slicing size |

```json
[
  {
    "childrenIps": [
      "192.0.2.0/24"
    ],
    "slicingSize": 0
  }
]
```

### Example

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

# 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("/ip/{ip}/bringYourOwnIp/slice");

print_r($result);
?>
```

## List aggregation options

`GET /1.0/ip/{ip}/bringYourOwnIp/aggregate`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#get-ip-ip-bringyourownip-aggregate

**Status:** Beta version  
**IAM actions:** `ip:apiovh:bringYourOwnIp/aggregate/get`

List aggregation options. Returns the larger Additional IPs this one can merge into, with the neighbors each would absorb. Aggregation applies to IPv4 blocks only.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipBlock | yes | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.ByoipAggregationPreview[] | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `aggregationIp` | ipBlock |  | Aggregation Additional IP that will be created |
| `childrenIps` | ipBlock[] |  | Existing Additional IP(s) that will be aggregated |

```json
[
  {
    "aggregationIp": "192.0.2.0/24",
    "childrenIps": [
      "192.0.2.0/24"
    ]
  }
]
```

### Example

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

# 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("/ip/{ip}/bringYourOwnIp/aggregate");

print_r($result);
?>
```

## Get the imported range

`GET /1.0/ip/service/{serviceName}/bringYourOwnIp/importedRange`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#get-ip-service-servicename-bringyourownip-importedrange

**Status:** Beta version  
**IAM actions:** `ip:apiovh:service/bringYourOwnIp/importedRange/get`

Get the imported range. Returns the imported range, its RIR and region, and the AS number that announces it.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your IP services |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.BringYourOwnIpImportedRange | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `asNumber` | integer |  | AS number used to annouce the IP in BGP |
| `asRir` | string |  | AS number's RIR |
| `ip` | ipBlock |  | Imported IP range |
| `ipRir` | string |  | IP's RIR |
| `region` | coreTypes.RegionCodenameEnum |  | IP's region — one of `af-central-lz-abj`, `af-north-lz-rba`, `ap-south-lz-akl`, `ap-south-lz-blr`, `ap-south-lz-icd`, `ap-south-mum`, `ap-southeast-sgp`, `ap-southeast-syd`, `ca-east-bhs`, `ca-east-tor`, `eu-central-lz-buh`, `eu-central-lz-sof`, … |
| `version` | ip.IpVersionEnum |  | IP's version — one of `4`, `6` |

```json
{
  "asNumber": 0,
  "asRir": "string",
  "ip": "192.0.2.0/24",
  "ipRir": "string",
  "region": "af-central-lz-abj",
  "version": 4
}
```

### Example

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

# 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("/ip/service/{serviceName}/bringYourOwnIp/importedRange");

print_r($result);
?>
```

## Get a sub-range

`GET /1.0/ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#get-ip-service-servicename-bringyourownip-subrange-ip

**Status:** Beta version  
**IAM actions:** `ip:apiovh:service/bringYourOwnIp/subRange/get`

Get a sub-range. Returns the IPv4 or IPv6 sub-range, as an IP block, and the custom description set when it was created.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipBlock | yes | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |
| `serviceName` | path | string | yes | The internal name of your IP services |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.byoipFailoverSubRange | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | read-only | Custom description on your ip |
| `ip` | ipBlock | read-only | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |

```json
{
  "description": "string",
  "ip": "192.0.2.0/24"
}
```

### Example

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

# 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("/ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}");

print_r($result);
?>
```

## Create an IPv6 sub-range

`POST /1.0/ip/service/{serviceName}/bringYourOwnIp/subRange`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#post-ip-service-servicename-bringyourownip-subrange

**Status:** Beta version  
**IAM actions:** `ip:apiovh:service/bringYourOwnIp/subRange/create`

Create an IPv6 sub-range. Creates an IPv6 /56 sub-range of the imported range, with an optional description.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `serviceName` | path | string | yes | The internal name of your IP services |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string |  | Sub range description |
| `ip` | ipBlock | yes | IP sub range to create |

```json
{
  "description": "string",
  "ip": "192.0.2.0/24"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.byoipFailoverSubRange | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `description` | string | read-only | Custom description on your ip |
| `ip` | ipBlock | read-only | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |

```json
{
  "description": "string",
  "ip": "192.0.2.0/24"
}
```

### Example

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

result = client.post("/ip/service/{serviceName}/bringYourOwnIp/subRange",
	description = None, # Sub range description (type: string, nullable)
	ip = None, # IP sub range to create (type: ipBlock)
)

# 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("/ip/service/{serviceName}/bringYourOwnIp/subRange", array(
	description => null, // Sub range description (type: string, nullable)
	ip => null, // IP sub range to create (type: ipBlock)
));

print_r($result);
?>
```

## Slice an IPv4 block

`POST /1.0/ip/{ip}/bringYourOwnIp/slice`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#post-ip-ip-bringyourownip-slice

**Status:** Beta version  
**IAM actions:** `ip:apiovh:bringYourOwnIp/slice/create`

Slice an IPv4 block. Splits this BYOIP Additional IP into smaller Additional IPs of the chosen size (async task).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipBlock | yes | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `slicingSize` | integer | yes | Size (ip mask) of the IPs to create inside given IP |

```json
{
  "slicingSize": 0
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.IpTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string | read-only | Details of this task |
| `destination` | ip.RoutedTo | read-only | Destination for moveFloatingIp tasks |
| `destination.serviceName` | string |  | Service where ip is routed to |
| `doneDate` | string (date-time) | read-only | Completion date |
| `function` | ip.TaskFunctionEnum | read-only | Function name — one of `arinBlockReassign`, `changeRipeOrg`, `checkAndReleaseIp`, `genericMoveFloatingIp`, `supernetByoipFailoverPartitioning` |
| `lastUpdate` | string (date-time) | read-only | last update |
| `startDate` | string (date-time) | read-only | Task Creation date |
| `status` | ip.TaskStatusEnum | read-only | Task status — one of `cancelled`, `customerError`, `doing`, `done`, `init`, `ovhError`, `todo` |
| `taskId` | integer | read-only | the id of the task |

```json
{
  "comment": "string",
  "destination": {
    "serviceName": "string"
  },
  "doneDate": "2024-01-01T12:00:00Z",
  "function": "arinBlockReassign",
  "lastUpdate": "2024-01-01T12:00:00Z",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "taskId": 0
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/ip/{ip}/bringYourOwnIp/slice" \
  -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: long
result = client.post("/ip/{ip}/bringYourOwnIp/slice",
	slicingSize = None, # Size (ip mask) of the IPs to create inside given IP (type: long)
)

# 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: long
$result = $ovh->post("/ip/{ip}/bringYourOwnIp/slice", array(
	slicingSize => null, // Size (ip mask) of the IPs to create inside given IP (type: long)
));

print_r($result);
?>
```

## Aggregate IPv4 blocks

`POST /1.0/ip/{ip}/bringYourOwnIp/aggregate`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#post-ip-ip-bringyourownip-aggregate

**Status:** Beta version  
**IAM actions:** `ip:apiovh:bringYourOwnIp/aggregate/create`

Aggregate IPv4 blocks. Merges this BYOIP Additional IP and its neighbors into the chosen larger block (async task).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipBlock | yes | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `aggregationIp` | ipBlock | yes | IP range to create by aggregation of all it's children |

```json
{
  "aggregationIp": "192.0.2.0/24"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | ip.IpTask | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string | read-only | Details of this task |
| `destination` | ip.RoutedTo | read-only | Destination for moveFloatingIp tasks |
| `destination.serviceName` | string |  | Service where ip is routed to |
| `doneDate` | string (date-time) | read-only | Completion date |
| `function` | ip.TaskFunctionEnum | read-only | Function name — one of `arinBlockReassign`, `changeRipeOrg`, `checkAndReleaseIp`, `genericMoveFloatingIp`, `supernetByoipFailoverPartitioning` |
| `lastUpdate` | string (date-time) | read-only | last update |
| `startDate` | string (date-time) | read-only | Task Creation date |
| `status` | ip.TaskStatusEnum | read-only | Task status — one of `cancelled`, `customerError`, `doing`, `done`, `init`, `ovhError`, `todo` |
| `taskId` | integer | read-only | the id of the task |

```json
{
  "comment": "string",
  "destination": {
    "serviceName": "string"
  },
  "doneDate": "2024-01-01T12:00:00Z",
  "function": "arinBlockReassign",
  "lastUpdate": "2024-01-01T12:00:00Z",
  "startDate": "2024-01-01T12:00:00Z",
  "status": "cancelled",
  "taskId": 0
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/ip/{ip}/bringYourOwnIp/aggregate" \
  -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: ipBlock
result = client.post("/ip/{ip}/bringYourOwnIp/aggregate",
	aggregationIp = None, # IP range to create by aggregation of all it's children (type: ipBlock)
)

# 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: ipBlock
$result = $ovh->post("/ip/{ip}/bringYourOwnIp/aggregate", array(
	aggregationIp => null, // IP range to create by aggregation of all it's children (type: ipBlock)
));

print_r($result);
?>
```

## Delete an IPv6 sub-range

`DELETE /1.0/ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}`

Link: https://developers.eu.ovhcloud.com/reference/network/ip-addresses/bring-your-own-ip/#delete-ip-service-servicename-bringyourownip-subrange-ip

**Status:** Beta version  
**IAM actions:** `ip:apiovh:service/bringYourOwnIp/subRange/delete`

Delete an IPv6 sub-range. Deletes the IPv6 sub-range from the imported range. The call returns no content.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ip` | path | ipBlock | yes | IP (v4 or v6) CIDR notation (e.g., 192.0.2.0/24) |
| `serviceName` | path | string | yes | The internal name of your IP services |

### Responses

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

### Example

```bash
curl -X DELETE \
  "https://api.eu.ovhcloud.com/1.0/ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}" \
  -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("/ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}")

# 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("/ip/service/{serviceName}/bringYourOwnIp/subRange/{ip}");

print_r($result);
?>
```
