# Change an instance's plan or cancel it

> Move an instance to another billing period, see what the switch costs first, get a different size, or cancel the instance.

Source: https://www.coritan.com/docs/cloud-compute/billing/

In the dashboard:

- /dashboard/compute/…/billing: https://www.coritan.com/dashboard/compute

An instance's **Billing** tab shows its plan and what it costs. On this tab you move the instance to another billing period, such as from monthly to quarterly, or cancel it.

The size you ordered sets the instance's vCPU, memory, disk and monthly traffic allowance, and it stays with the instance. [Get a different size](#get-a-different-size) explains how to move to another one.

[Change a service's plan](/docs/billing/change-plan/) and [Cancel a service](/docs/billing/cancel-a-service/) explain how plan changes and cancellations are billed for every product. This page covers what they do to an instance.

## Before you begin

- The service must be active. You cannot change the plan of a suspended instance until you pay the open invoice.
- A plan change shuts the instance down and starts it again, even though its size stays the same. Choose a time when a short outage does no harm.

## See your plan

1. In the [dashboard](https://www.coritan.com/dashboard/compute), go to **Cloud Compute**, open the instance and select the **Billing** tab.
2. Read the **Current plan** card.

**Product**
: The product you ordered.

**Plan**
: The size and billing period the instance is on now, such as `RX-2 (Monthly)`.

**Price**
: What the plan costs for each billing period.

**Status**
: The state of the service, such as `Active` or `Suspended`.

**Next renewal**
: The date of the next invoice. An hourly instance shows **Used this month** instead: what it has cost so far this month.

**Set up**
: When we created the instance.

**Service ID**
: The number to quote when you contact support.

The **Activity** table under the card lists setup, renewals and plan changes, with who made each one.

## Change the billing period

1. On the **Billing** tab, select **Change plan…** on the **Current plan** card.
2. In **New plan**, choose the plan you want. The list holds the other billing periods of the instance's size, such as `RX-2 (Quarterly)`, each with its price.
3. Select **Preview**. The preview shows how many days are left in this billing period and what the switch costs today:
   - **Credit for unused time** is the value of the days left on your current plan.
   - **Charge for the new plan** is the price of the new plan for the same days.
   - **Due now** is the difference.
   - When you move to a cheaper plan, **Credit you receive** is the credit we give you.
4. Select **Apply change**.

If the switch needs a payment, we take it from your credit balance first. When your balance does not cover all of it, the dashboard shows `Pay the upgrade invoice to apply the plan change`. [Pay the invoice](/docs/billing/invoices/), and the new plan applies once it is paid.

When the new plan applies, we shut the instance down and start it again. An instance that was stopped starts too.

## Get a different size

You cannot change the size of an existing instance. The **New plan** list offers only the billing periods of the size you ordered. To move to more or fewer vCPUs, more memory, a larger disk or a larger traffic allowance:

1. [Create an instance](/docs/cloud-compute/create-an-instance/) of the size you want.
2. Copy your data to it, for example with `rsync` over SSH:

   ```bash
   rsync -a /srv/ alex@203.0.113.20:/srv/
   ```

3. Point your DNS records at the new instance's address. Floating IPs that you ordered on their own can move to the new instance instead, as [Attach and detach a floating IP](/docs/floating-ips/attach-and-detach/) describes.
4. Cancel the old instance, as below.

> [!IMPORTANT]
> The IPv4 address that came with the old instance cannot move with you. We release it when the old instance ends, even if you have attached it to the new one.

[Contact support](/docs/support/conversations/) if you need help with the move.

## Cancel the instance

1. On the **Billing** tab, select **Cancel service…** on the **Cancel service** card.
2. Under **When**, choose when the instance ends:
   - **At the end of the current term** keeps it running until the paid period ends. The dialog shows the date.
   - **Immediately** stops and deletes it now. We do not refund the unused time.

   An hourly instance has no choice. It ends at once, and billing stops at the hour.
3. Type `cancel` and select **Cancel service**.

> [!WARNING]
> The dialog also offers **Take a snapshot first**. It keeps nothing for an instance. The instance's snapshots are stored on its disk, and we delete its backups with it. Copy anything you need off the instance before you cancel.

When the instance ends, we delete:

- the instance and its disk, with every snapshot on it
- every backup of the instance
- the IPv4 address that came with the instance, wherever it is attached, which goes back to our pool
- the instance's tags

Other floating IPs you attached to the instance are detached and stay on your account. We keep billing them until you [cancel them](/docs/floating-ips/billing/). DNS records and web proxies that point at the instance also stay, so delete them once the instance has gone.

## Result

After a plan change, the **Current plan** card shows the new plan and the **Activity** table lists the change. The instance runs again once it has restarted.

After you cancel at the end of the term, the tab shows **Cancellation scheduled** with the date the instance ends. The instance keeps running until then. After an immediate cancellation, we stop and delete the instance.

## Troubleshooting

`No other plan to switch to` in place of **Change plan…**
: The instance's size has no other billing period on offer. Keep the plan, or move to another size as [Get a different size](#get-a-different-size) describes.

`Could not check that the host can take the new plan. Try again in a moment.`
: The check the dashboard runs before a plan change did not get an answer. Select **Apply change** again. If the message stays, [contact support](/docs/support/conversations/).

`Service is not active`
: The instance is suspended, or its service has ended. Pay the open invoice to lift a suspension, then change the plan.

`Pay the upgrade invoice to apply the plan change`
: Your credit balance did not cover the switch. [Pay the invoice](/docs/billing/invoices/). The plan applies when it is paid.

The instance is stopped after a plan change
: The restart did not finish. Select **Start** in the instance header. If it does not start, [contact support](/docs/support/conversations/).

`Cancellation scheduled`
: You asked for the instance to end at the end of its term. To keep it, [contact support](/docs/support/conversations/) before the date shown.

`Suspended`
: We suspended the instance, usually for an unpaid invoice. The alert gives the reason. [Pay the open invoice](/docs/billing/invoices/) to restore it.

## Related

- [Change a service's plan](/docs/billing/change-plan/)
- [Cancel a service](/docs/billing/cancel-a-service/)
- [How hourly billing works](/docs/billing/hourly-billing/)
- [Create an instance](/docs/cloud-compute/create-an-instance/)
- [How instance traffic is counted](/docs/cloud-compute/traffic/)
- [Cancel a floating IP](/docs/floating-ips/billing/)

## With the API

A plan change goes through the services API, which accepts the instance's UUID as the service reference. Read the service to find its `product_id` and `pricing_id`, then read the product. Its `pricing` list holds one row for each billing period, and each row's `id` is a plan you can move to.

```bash
curl -s https://api.coritan.com/api/v1/services/$INSTANCE_UUID \
  -H "Authorization: Bearer $CORITAN_TOKEN"

curl -s https://api.coritan.com/api/v1/products/$PRODUCT_ID \
  -H "Authorization: Bearer $CORITAN_TOKEN"
```

Preview the cost, then change the plan:

```bash
curl -s "https://api.coritan.com/api/v1/services/$INSTANCE_UUID/upgrade-preview?new_pricing_id=42" \
  -H "Authorization: Bearer $CORITAN_TOKEN"

curl -s -X POST https://api.coritan.com/api/v1/services/$INSTANCE_UUID/change-plan \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"new_pricing_id": 42}'
```

The response's `status` is `applied` when the new plan applies now. It is `payment_required` when the switch waits for its invoice, whose number is in `invoice_id`. A plan from another product answers `400` with `New pricing must belong to the same product` or `Plan changes must stay within the same hardware tier`. The change also answers `400` with `Service is not active` or `Already on this plan`, and `404` with `Pricing tier not found`.

Before it changes the plan, the dashboard sends the new plan's vCPU, memory and disk to `resize-preview`. A field you leave out keeps its current value.

```bash
curl -s -X POST https://api.coritan.com/api/v1/client/vps/$INSTANCE_UUID/resize-preview \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"cpu_cores": 2, "memory_mb": 2048, "disk_gb": 40}'
```

```json
{
  "current": {"cpu_cores": 2, "memory_mb": 2048, "disk_gb": 40},
  "requested": {"cpu_cores": 2, "memory_mb": 2048, "disk_gb": 40},
  "hotplug_eligible": true,
  "requires_stop": false
}
```

`hotplug_eligible` is `true` when the disk stays the same, vCPU and memory do not shrink, and the instance is running. `requires_stop` is its opposite. A plan change restarts the instance whatever they say. A `disk_gb` smaller than the instance's disk answers `400` with `Disk can only grow`.

To cancel, send `immediate` as `true` to end the instance now, or `false` (the default) to end it at the end of its term. `reason` is optional. `keep_snapshot` keeps nothing for an instance, and the response's `snapshot_taken` is always `false`.

```bash
curl -s -X POST https://api.coritan.com/api/v1/services/$INSTANCE_UUID/cancel \
  -H "Authorization: Bearer $CORITAN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"immediate": false, "reason": "Moved to a larger instance"}'
```

The response gives the new `status` and the `termination_date`. A second request answers `400` with `Service already scheduled for end-of-term termination` or `Service already cancelled/terminated`.

The [Cloud Compute API reference](/docs/api/reference/client/cloud-compute/#op-post-api-v1-client-vps-uuid-resize-preview) and the [services API reference](/docs/api/reference/client/services/#op-post-api-v1-services-service-ref-change-plan) list every field.

## API

- `POST /api/v1/client/vps/{uuid}/resize-preview`: Capacity/mode preview for a plan change resize (billing via /services change-plan) (https://www.coritan.com/docs/api/reference/client/cloud-compute/#op-post-api-v1-client-vps-uuid-resize-preview)
