# Get a quote for a server order

`POST https://console.advinservers.com/api/v1/client/servers/quote`

### Overview

Calculates a server price and returns a signed `quote_token`. Send `plan_key` from the catalogue. Optionally send `billing_cycle` to use a cycle other than the default.

The response includes the plan, product group, location, price, currency, billing cycle, cycle length in months and payment window. Use the token to place the order at the quoted price.

`postpaid` is true when the servers would go into a postpaid team. `amount` is then the monthly price, billed by the hour, the billing cycle is always monthly, and the order is checked against the postpaid spending limit instead of account credit.

Requesting a quote does not charge the account or reserve capacity.

### 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.

## Body

Sent as `application/json`.

- `plan_key` (string, required): The value of `plan_key`. Exactly 64 characters
- `billing_cycle` (string): How often the service renews and is billed. One of: `monthly`, `quarterly`, `semiannually`, `annually`, `biennially`, `triennially`.

## Response 200

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

- `plan` (object, required): The value of `plan`.
  - `key` (string, required): The value of `key`.
  - `id` (string, required): The id ID.
  - `name` (string, required): The name shown to customers.
  - `vcpu_cores` (integer, required): The value of `vcpu_cores`.
  - `memory` (integer, required): Memory in advertised units; 1000 represents 1 GiB.
  - `disk` (integer, required): Advertised disk capacity in GiB.
  - `bandwidth` (integer, required): Transfer allowance in advertised units; 1000 represents 1 TiB and zero means unlimited.
  - `hdd` (boolean, required): The value of `hdd`.
  - `primary_disk` (integer, required): Primary disk capacity in GiB.
  - `hdd_disk` (integer, required): Secondary hard disk capacity in GiB.
  - `price` (string, required): The value of `price`.
  - `deployment_time` (string | null, required): The value of `deployment_time`.
  - `whmcs_id` (string, required): The billing product identifier.
- `plan_key` (string, required): The value of `plan_key`.
- `group` (object, required): The value of `group`.
  - `id` (string, required): The id ID.
  - `name` (string, required): The name shown to customers.
- `location` (object, required): The value of `location`.
  - `id` (string, required): The id ID.
  - `display_name` (string, required): The value of `display_name`.
  - `name` (string, required): The name shown to customers.
  - `flag_url` (string | null, required): The value of `flag_url`.
  - `cid` (integer, required): The value of `cid`.
  - `group_name` (string, required): The value of `group_name`.
- `location_id` (integer | null, required): The location id ID.
- `product_group_id` (integer | null, required): The product group id ID.
- `amount` (string, required): The amount in the currency shown by `currency`.
- `currency` (string, required): The three-letter currency code used for monetary amounts.
- `billing_cycle` (string, required): How often the service renews and is billed.
- `billing_cycle_months` (integer, required): The value of `billing_cycle_months`.
- `payment_window_minutes` (integer, required): How many minutes the original payment window allowed.
- `postpaid` (boolean, required): The value of `postpaid`.
- `quote_token` (string, required): The value of `quote_token`.

```json
{
  "plan": {
    "key": "032f97c3b0f718ae9a2edfba83d5adf321025b5d9af1e90d397e79b8667bb3a4",
    "id": "standard-4gb",
    "name": "Standard 4 GB",
    "vcpu_cores": 4,
    "memory": 4000,
    "disk": 80,
    "bandwidth": 5000,
    "hdd": false,
    "primary_disk": 80,
    "hdd_disk": 0,
    "price": "12.00",
    "deployment_time": "Instant",
    "whmcs_id": "48"
  },
  "plan_key": "032f97c3b0f718ae9a2edfba83d5adf321025b5d9af1e90d397e79b8667bb3a4",
  "group": {
    "id": "2",
    "name": "Standard VPS"
  },
  "location": {
    "id": "2-3",
    "display_name": "Kansas City, MO",
    "name": "Kansas City, MO",
    "flag_url": null,
    "cid": 3,
    "group_name": "Standard VPS"
  },
  "location_id": 3,
  "product_group_id": 2,
  "amount": "12.00",
  "currency": "USD",
  "billing_cycle": "monthly",
  "billing_cycle_months": 1,
  "payment_window_minutes": 30,
  "postpaid": false,
  "quote_token": "eyJ2ZXJzaW9uIjoxLCJub25jZSI6IjNmYWRiNjgyM2ZmZTkyY2Q0ZDkwYzRkNjg4YTdjZWY5ZjBiYjBjZDE1YjVhM2VlMGE2MzMyZmU1YmQ4Njg1YWYiLCJvd25lcl9pZCI6MTg3Mywib3duZXJfZW1haWwiOiJnb3Jkb24uZnJlZW1hbkBibGFja21lc2EuZXhhbXBsZS5jb20iLCJleHBpcmVzX2F0IjoxNzg5NDA0NzI5LCJ3aG1jc19jb25maWd1cmF0aW9uX2ZpbmdlcnByaW50IjoiZTY3ZDIzZTc4MjBjNDlhOCJ9.f84ed5bfb2e3e24710926d5ccf5902fc93d0c9a0a45365dd784e1aa72d4083f0"
}
```

## 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.
- `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/quote' \
  --header 'Authorization: Bearer <token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "plan_key": "032f97c3b0f718ae9a2edfba83d5adf321025b5d9af1e90d397e79b8667bb3a4",
  "billing_cycle": "monthly"
}'
```
