# Get a quote for a plan change

`POST https://console.advinservers.com/api/v1/client/servers/{server}/upgrades/quote`

### Overview

Calculates the price of a plan change. Send `plan_key` from the catalogue and `resize_disk`.

The response includes the price, any location change fee, currency, remaining and total days in the current billing period, destination, migration requirements, IP replacement requirements and a signed `quote_token`. Use this token to purchase the change at the quoted price. A quote does not charge the account or reserve capacity. If the plan has no available capacity, the response explains why a quote cannot be provided. A plan the catalogue listed as available in the last ten minutes is quoted even if that capacity has since been taken, and purchasing with the resulting `quote_token` honors it the same way.

### Permissions

Requires the `server.read` (View servers) permission for the selected team. Resources outside that team return 404.

## Authorization

Send `Authorization: Bearer <token>` with the request. Your API key, sent as a bearer token. Create one in the control panel under API Keys, give it only the permissions the integration needs, and copy it when it is created. It cannot be shown again. Each key is restricted to one owned team. The key determines the team for every request.

## Path parameters

- `server` (string, required): The server uuid short

## Body

Sent as `application/json`.

- `plan_key` (string, required): The value of `plan_key`. Exactly 64 characters
- `resize_disk` (boolean, required): The value of `resize_disk`.

## Response 200

The record, as a JSON object. There is no envelope.

- `amount` (string, required): The amount in the currency shown by `currency`.
- `refund_amount` (string, required): The value of `refund_amount`.
- `location_change_fee` (string, required): The value of `location_change_fee`.
- `currency` (string, required): The three-letter currency code used for monetary amounts.
- `days_remaining` (integer, required): The value of `days_remaining`.
- `total_days` (integer, required): The value of `total_days`.
- `billing_cycle` (string, required): How often the service renews and is billed.
- `current_recurring_amount` (string, required): The value of `current_recurring_amount`.
- `target_recurring_amount` (string, required): The value of `target_recurring_amount`.
- `quote_token` (string, required): The value of `quote_token`.
- `plan_key` (string, required): The value of `plan_key`.
- `plan_name` (string, required): The value of `plan_name`.
- `source_location_id` (integer, required): The source location id ID.
- `target_location_id` (integer, required): The target location id ID.
- `source_location` (string, required): The value of `source_location`.
- `target_location` (string, required): The value of `target_location`.
- `requires_migration` (boolean, required): Whether this action requires migration.
- `requires_ip_replacement` (boolean, required): Whether this action requires ip replacement.
- `resize_disk` (boolean, required): The value of `resize_disk`.

```json
{
  "amount": "6.00",
  "refund_amount": "0.00",
  "location_change_fee": "0.00",
  "currency": "USD",
  "days_remaining": 18,
  "total_days": 30,
  "billing_cycle": "Monthly",
  "current_recurring_amount": "12.00",
  "target_recurring_amount": "22.00",
  "quote_token": "eyJpdiI6InZVUENaRU81VXMyL1psak9tNS8xTGc9PSIsInZhbHVlIjoib2JiS0ZkbXVmREY0OXBHeXorZEx5Wi81Z3F1UzF0L3RENFBnNTFIZHJ6YUl3RGZYclUrbWoydFpOYkkyT1Q2SklmbVlYdGU4WEVHaWlPRHBQbExSUnp4VkdZbk1ZY0JRZ0U4d0NNbDB1eFVSbVFIZ0xkdkxLdDZzZTZodkFZdEFqV3dBTk1HaTVPNWRpTmpJdjlQSEVNNjZjYWV1UnhGUW1pTEovY2VSQUdPMEg3MDRldWxEN2tBc0Rzd1VEK2pNa01uNEx1bXlLSExZUldobUw0ODVWbWlNZjlKRWIvTFJlaThQd1A0S2kwY3dFejgrZ2NmczZlWGdLVENRL1VoelBJczJ0LzgxMTBXZnlOaFRHSEplRk0zWTQ5cXZHRXhlUGFyV292ZGRHN0FpaWtVVzZhUnFBOGRLcm40TUx3TFIiLCJtYWMiOiJhNmViM2NiYTY0OWI5ZTUxMDkzNGQxYjBkMjRmMWIzZTg2NWE4MWMzYjk2YjIxZDc1NTAyMThjMTliYWQzZGM2IiwidGFnIjoiIn0=",
  "plan_key": "84ee2bf7fc22f495e76aead064154e1d5ae66fee1ac71cda7cf48d9e607a60bc",
  "plan_name": "Standard 8 GB",
  "source_location_id": 3,
  "target_location_id": 3,
  "source_location": "Kansas City, MO",
  "target_location": "Kansas City, MO",
  "requires_migration": false,
  "requires_ip_replacement": false,
  "resize_disk": true
}
```

## Errors

- `401`: The key was missing, malformed, revoked, or belongs to an account that no longer exists.
- `403`: Access denied. Check the key's team, permissions and allowed IP addresses. Some actions, such as managing API keys, require a browser session. The response message explains the reason.
- `404`: The resource was not found in the selected team. Resources in another account or team also return 404.
- `422`: A field is missing or invalid, or the resource cannot accept this change in its current state. Check `message` for details. Field validation also includes an `errors` object keyed by field name.
- `429`: Too many requests. The `Retry-After` header says how many seconds to wait. Limits are per account, so several keys on one account share them.

## Example request

```bash
curl --request POST \
  --url 'https://console.advinservers.com/api/v1/client/servers/{server}/upgrades/quote' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "plan_key": "84ee2bf7fc22f495e76aead064154e1d5ae66fee1ac71cda7cf48d9e607a60bc",
  "resize_disk": true
}'
```
