# Network › vRack › Public IP connectivity › Failover priorities 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

> 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/network/vrack/public-ip-connectivity/failover-priorities/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/network/vrack/public-ip-connectivity/failover-priorities.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/network/vrack/public-ip-connectivity/failover-priorities.json?format=openapi3

## Operations

- `GET /vrack/{serviceName}/publicRoutingPriority` — List priorities. Returns the identifiers of the 3-AZ failover priorities of the vRack.
- `GET /vrack/{serviceName}/publicRoutingPriority/{priorityId}` — Get a priority
- `POST /vrack/{serviceName}/publicRoutingPriority` — Create a priority
- `PUT /vrack/{serviceName}/publicRoutingPriority/{priorityId}` — Update a priority
- `DELETE /vrack/{serviceName}/publicRoutingPriority/{priorityId}` — Delete a priority

## List priorities. Returns the identifiers of the 3-AZ failover priorities of the vRack.

`GET /1.0/vrack/{serviceName}/publicRoutingPriority`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/public-ip-connectivity/failover-priorities/#get-vrack-servicename-publicroutingpriority

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:publicRoutingPriority/get`

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | string (uuid)[] | successful operation |

```json
[
  "00000000-0000-0000-0000-000000000000"
]
```

### Example

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

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

print_r($result);
?>
```

## Get a priority

`GET /1.0/vrack/{serviceName}/publicRoutingPriority/{priorityId}`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/public-ip-connectivity/failover-priorities/#get-vrack-servicename-publicroutingpriority-priorityid

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:publicRoutingPriority/get`

Get a priority. Returns the region, the type, default or custom, and the priority of each availability zone.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `priorityId` | path | string (uuid) | yes | Public routing priority identifier |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vrack.publicRoutingPriority | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availabilityZones` | vrack.PublicRoutingDefinition[] |  | Priority definition per availability zone |
| `availabilityZones[].name` | string |  | Availability zone name |
| `availabilityZones[].priority` | integer |  | Unique priority value [1..3] |
| `priorityId` | string (uuid) | read-only | Public routing priority identifier |
| `region` | string | read-only | Name of the region where public routing priority is defined |
| `type` | vrack.PublicRoutingPriorityTypeEnum | read-only | Public routing priority type — one of `custom`, `default` |
| `vrack` | string | read-only | vrack name |

```json
{
  "availabilityZones": [
    {
      "name": "string",
      "priority": 0
    }
  ],
  "priorityId": "00000000-0000-0000-0000-000000000000",
  "region": "string",
  "type": "custom",
  "vrack": "string"
}
```

### Example

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

# 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("/vrack/{serviceName}/publicRoutingPriority/{priorityId}");

print_r($result);
?>
```

## Create a priority

`POST /1.0/vrack/{serviceName}/publicRoutingPriority`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/public-ip-connectivity/failover-priorities/#post-vrack-servicename-publicroutingpriority

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:publicRoutingPriority/create`

Create a priority.

This endpoint will create a new 'custom' routing priority.

You can create a new 'custom' routing priority if you have an additional IP block in your vRack in the same region or not.

You do not have to create a 'custom' routing priority for RTvRack 3AZ to work. If you add an additional IP block in a 3AZ region without any routing priority and any additional IP block, a 'default' routing priority will automatically be chosen for you.

Priorities must be set to `1`, `2` or `3` for each availability zone.

`1` stands for the availability zone with highest priority, which will handle traffic by default.

`2` is the availability zone with second-highest priority, which will handle traffic as soon as priority `1` availability zone is not available.

`3` is the availability zone with lowest priority, it will handle traffic if neither the availability zone with priority `1` nor the availability zone with priority `2` are available.

All availability zones in a 3AZ region must be set in the payload in order for the 'custom' routing priority to be created.

### Parameters

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

### Request body (required)

Type: `object`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availabilityZones` | vrack.PublicRoutingDefinition[] | yes | Priority definition, every region's availability zones MUST be listed |
| `availabilityZones[].name` | string |  | Availability zone name |
| `availabilityZones[].priority` | integer |  | Unique priority value [1..3] |
| `region` | string | yes | Name of the region where Public routing priority is defined |

```json
{
  "availabilityZones": [
    {
      "name": "string",
      "priority": 0
    }
  ],
  "region": "string"
}
```

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | string | read-only |  |
| `id` | integer | read-only |  |
| `lastUpdate` | string (date-time) | read-only |  |
| `orderId` | integer | read-only |  |
| `serviceName` | string | read-only |  |
| `status` | vrack.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `init`, `todo` |
| `targetDomain` | string | read-only |  |
| `todoDate` | string (date-time) | read-only |  |

```json
{
  "function": "string",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "orderId": 0,
  "serviceName": "string",
  "status": "cancelled",
  "targetDomain": "string",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/vrack/{serviceName}/publicRoutingPriority" \
  -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("/vrack/{serviceName}/publicRoutingPriority",
	availabilityZones = None, # Priority definition, every region's availability zones MUST be listed (type: vrack.PublicRoutingDefinition[])
	region = None, # Name of the region where Public routing priority is defined (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

$result = $ovh->post("/vrack/{serviceName}/publicRoutingPriority", array(
	availabilityZones => null, // Priority definition, every region's availability zones MUST be listed (type: vrack.PublicRoutingDefinition[])
	region => null, // Name of the region where Public routing priority is defined (type: string)
));

print_r($result);
?>
```

## Update a priority

`PUT /1.0/vrack/{serviceName}/publicRoutingPriority/{priorityId}`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/public-ip-connectivity/failover-priorities/#put-vrack-servicename-publicroutingpriority-priorityid

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:publicRoutingPriority/update`

Update a priority. Updates the priority of each availability zone of a custom failover priority. A default one cannot be updated: create a custom one first.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `priorityId` | path | string (uuid) | yes | Public routing priority identifier |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Request body (required)

Type: `vrack.publicRoutingPriority`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availabilityZones` | vrack.PublicRoutingDefinition[] |  | Priority definition per availability zone |
| `availabilityZones[].name` | string |  | Availability zone name |
| `availabilityZones[].priority` | integer |  | Unique priority value [1..3] |
| `priorityId` | string (uuid) | read-only | Public routing priority identifier |
| `region` | string | read-only | Name of the region where public routing priority is defined |
| `type` | vrack.PublicRoutingPriorityTypeEnum | read-only | Public routing priority type — one of `custom`, `default` |
| `vrack` | string | read-only | vrack name |

```json
{
  "availabilityZones": [
    {
      "name": "string",
      "priority": 0
    }
  ]
}
```

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | string | read-only |  |
| `id` | integer | read-only |  |
| `lastUpdate` | string (date-time) | read-only |  |
| `orderId` | integer | read-only |  |
| `serviceName` | string | read-only |  |
| `status` | vrack.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `init`, `todo` |
| `targetDomain` | string | read-only |  |
| `todoDate` | string (date-time) | read-only |  |

```json
{
  "function": "string",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "orderId": 0,
  "serviceName": "string",
  "status": "cancelled",
  "targetDomain": "string",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/vrack/{serviceName}/publicRoutingPriority/{priorityId}" \
  -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: vrack.publicRoutingPriority
result = client.put("/vrack/{serviceName}/publicRoutingPriority/{priorityId}",
	availabilityZones = None, # Priority definition per availability zone (type: array)
)

# 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: vrack.publicRoutingPriority
$result = $ovh->put("/vrack/{serviceName}/publicRoutingPriority/{priorityId}", array(
	availabilityZones => null, // Priority definition per availability zone (type: array)
));

print_r($result);
?>
```

## Delete a priority

`DELETE /1.0/vrack/{serviceName}/publicRoutingPriority/{priorityId}`

Link: https://developers.eu.ovhcloud.com/reference/network/vrack/public-ip-connectivity/failover-priorities/#delete-vrack-servicename-publicroutingpriority-priorityid

**Status:** Stable production version  
**IAM actions:** `vrack:apiovh:publicRoutingPriority/delete`

Delete a priority. Deletes a custom failover priority. If Additional IP blocks remain in the region, a default priority is generated from the infrastructure usage.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `priorityId` | path | string (uuid) | yes | Public routing priority identifier |
| `serviceName` | path | string | yes | The internal name of your vrack |

### Responses

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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `function` | string | read-only |  |
| `id` | integer | read-only |  |
| `lastUpdate` | string (date-time) | read-only |  |
| `orderId` | integer | read-only |  |
| `serviceName` | string | read-only |  |
| `status` | vrack.TaskStatusEnum | read-only | Task status — one of `cancelled`, `doing`, `done`, `init`, `todo` |
| `targetDomain` | string | read-only |  |
| `todoDate` | string (date-time) | read-only |  |

```json
{
  "function": "string",
  "id": 0,
  "lastUpdate": "2024-01-01T12:00:00Z",
  "orderId": 0,
  "serviceName": "string",
  "status": "cancelled",
  "targetDomain": "string",
  "todoDate": "2024-01-01T12:00:00Z"
}
```

### Example

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

# 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("/vrack/{serviceName}/publicRoutingPriority/{priorityId}");

print_r($result);
?>
```
