---
title: "Resize VM"
method: POST
path: "/api/v1/vms/{id}/resize"
tags: ["Virtual Machines"]
---

# Resize VM

`POST /api/v1/vms/{id}/resize`

Resize a virtual machine's CPU and RAM by selecting a new pricing plan.
The VM must be stopped before resizing.

## Billing

For subscription VMs, the price difference is calculated pro-rata for the
remaining billing period:

- **Upgrade** — the difference is deducted from credits, then account balance.
  If your balance is insufficient, the request fails with `402`.
- **Downgrade** — the pro-rata credit is added to your account balance.

The new subscription price takes effect immediately.

## Path parameters

- `id` string, uuid, required

## Headers

- `X-Project-ID` string, uuid, required

## Request body

- ResizeVMRequest
  - `pricing_id` integer, required — Target pricing plan ID. Determines CPU, RAM, and included storage. Use `GET /api/v1/public/pricing/vm` to list available plans.

## Response `200`

VM resized

- ResizeResponse
  - `success` boolean
  - `message` string
  - `id` string — Resource ID.
  - `billing` ResizeBillingDetails — Present only for subscription-based resources.
    - `type` 'upgrade' | 'downgrade' | 'none'
    - `pro_rata_amount` number — Amount charged (positive) or credited (negative).
    - `credits_applied` number
    - `balance_applied` number
    - `new_monthly_price` number
    - `new_price_per_hour` string

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required
- `402` — Account balance is insufficient for this operation. Top up the balance and retry.
- `404` — Resource not found

---

[API](https://skmtc.net/rafftechnologies/apis/raff-api.md) · [All operations](https://skmtc.net/rafftechnologies/apis/raff-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/rafftechnologies/raff-api/revisions/a3f123570011/schema)
