# Bare Metal Cloud › VPS › Migration API

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

> 4 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/bare-metal-cloud/vps/migration/

OpenAPI v1: https://api.eu.ovhcloud.com/1.0/__schemas/developer-hub-navigation/bare-metal-cloud/vps/migration.json?format=openapi3
OpenAPI v2: https://api.eu.ovhcloud.com/v2/__schemas/developer-hub-navigation/bare-metal-cloud/vps/migration.json?format=openapi3

## Operations

- `GET /vps/{serviceName}/migration2020` — Retrieve information about the possible/ongoing migration from VPS 2020 to VPS 2025
- `POST /vps/{serviceName}/migration2020` — Request to be queued for migration from VPS 2020 to VPS 2025
- `DELETE /vps/{serviceName}/migration2020` — Cancel the migration request from VPS 2020 to VPS 2025
- `PUT /vps/{serviceName}/migration2020` — Update migration parameters for the VPS 2020 to VPS 2025 migration

## Retrieve information about the possible/ongoing migration from VPS 2020 to VPS 2025

`GET /1.0/vps/{serviceName}/migration2020`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/migration/#getVpsMigration2020

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:migration2020/get`

Returns the state of the migration of the VPS 2020 to VPS 2025, with the current and target plans, the available plans, the position in the queue and the date.

### Parameters

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

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vps.migration.VPS2020to2025 | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availablePlans` | vps.migration.VPS2020to2025Plan[] | read-only | List of available plans to migrate |
| `availablePlans[].planCode` | string | read-only | VPS plan code available for migration |
| `currentPlan` | string | read-only | VPS current plan code |
| `date` | string (date-time) | read-only | Date of planned migration, null if not scheduled |
| `position` | integer | read-only | Position on the migration queue, null if not in queue |
| `status` | vps.migration.StatusEnum | read-only | All status a migration task can be in — one of `available`, `done`, `notAvailable`, `ongoing`, `planned`, `toPlan` |
| `targetPlan` | string | read-only | VPS target plan code after migration |

```json
{
  "availablePlans": [
    {
      "planCode": "string"
    }
  ],
  "currentPlan": "string",
  "date": "2024-01-01T12:00:00Z",
  "position": 0,
  "status": "available",
  "targetPlan": "string"
}
```

### Example

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

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

print_r($result);
?>
```

## Request to be queued for migration from VPS 2020 to VPS 2025

`POST /1.0/vps/{serviceName}/migration2020`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/migration/#createVpsMigration2020

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:migration2020/create`

Queues the VPS 2020 for migration to VPS 2025 with the given target plan and returns the migration state.

### Parameters

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

### Request body (required)

Type: `vps.migration.VPS2020to2025.Post`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `plan` | string | yes | VPS target plan code |

```json
{
  "plan": "string"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vps.migration.VPS2020to2025 | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availablePlans` | vps.migration.VPS2020to2025Plan[] | read-only | List of available plans to migrate |
| `availablePlans[].planCode` | string | read-only | VPS plan code available for migration |
| `currentPlan` | string | read-only | VPS current plan code |
| `date` | string (date-time) | read-only | Date of planned migration, null if not scheduled |
| `position` | integer | read-only | Position on the migration queue, null if not in queue |
| `status` | vps.migration.StatusEnum | read-only | All status a migration task can be in — one of `available`, `done`, `notAvailable`, `ongoing`, `planned`, `toPlan` |
| `targetPlan` | string | read-only | VPS target plan code after migration |

```json
{
  "availablePlans": [
    {
      "planCode": "string"
    }
  ],
  "currentPlan": "string",
  "date": "2024-01-01T12:00:00Z",
  "position": 0,
  "status": "available",
  "targetPlan": "string"
}
```

### Example

```bash
curl -X POST \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/migration2020" \
  -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: vps.migration.VPS2020to2025.Post
result = client.post("/vps/{serviceName}/migration2020",
	plan = None, # VPS target plan code (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: vps.migration.VPS2020to2025.Post
$result = $ovh->post("/vps/{serviceName}/migration2020", array(
	plan => null, // VPS target plan code (type: string)
));

print_r($result);
?>
```

## Cancel the migration request from VPS 2020 to VPS 2025

`DELETE /1.0/vps/{serviceName}/migration2020`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/migration/#cancelVpsMigration2020

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:migration2020/create`

Cancels the pending migration request of the VPS 2020 to VPS 2025.

### Parameters

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

### Responses

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

### Example

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

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

print_r($result);
?>
```

## Update migration parameters for the VPS 2020 to VPS 2025 migration

`PUT /1.0/vps/{serviceName}/migration2020`

Link: https://developers.eu.ovhcloud.com/reference/bare-metal-cloud/vps/migration/#editVpsMigration2020

**Status:** Stable production version  
**IAM actions:** `vps:apiovh:migration2020/create`

Updates the target plan of the pending migration of the VPS 2020 to VPS 2025 and returns the migration state.

### Parameters

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

### Request body (required)

Type: `vps.migration.VPS2020to2025.Put`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `date` | string (date-time) |  | Date of migration. Use current date to trigger migration as soon as possible. |

```json
{
  "date": "2024-01-01T12:00:00Z"
}
```

### Responses

| Status | Type | Description |
| --- | --- | --- |
| 200 | vps.migration.VPS2020to2025 | successful operation |

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `availablePlans` | vps.migration.VPS2020to2025Plan[] | read-only | List of available plans to migrate |
| `availablePlans[].planCode` | string | read-only | VPS plan code available for migration |
| `currentPlan` | string | read-only | VPS current plan code |
| `date` | string (date-time) | read-only | Date of planned migration, null if not scheduled |
| `position` | integer | read-only | Position on the migration queue, null if not in queue |
| `status` | vps.migration.StatusEnum | read-only | All status a migration task can be in — one of `available`, `done`, `notAvailable`, `ongoing`, `planned`, `toPlan` |
| `targetPlan` | string | read-only | VPS target plan code after migration |

```json
{
  "availablePlans": [
    {
      "planCode": "string"
    }
  ],
  "currentPlan": "string",
  "date": "2024-01-01T12:00:00Z",
  "position": 0,
  "status": "available",
  "targetPlan": "string"
}
```

### Example

```bash
curl -X PUT \
  "https://api.eu.ovhcloud.com/1.0/vps/{serviceName}/migration2020" \
  -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: vps.migration.VPS2020to2025.Put
result = client.put("/vps/{serviceName}/migration2020",
	date = None, # Date of migration. Use current date to trigger migration as soon as possible. (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: vps.migration.VPS2020to2025.Put
$result = $ovh->put("/vps/{serviceName}/migration2020", array(
	date => null, // Date of migration. Use current date to trigger migration as soon as possible. (type: string)
));

print_r($result);
?>
```
