---
title: "Save VM disk as custom image"
method: POST
path: "/api/v1/vms/{id}/save-image"
tags: ["Virtual Machines"]
---

# Save VM disk as custom image

`POST /api/v1/vms/{id}/save-image`

Save a VM's disk (live state or a snapshot) as a reusable custom OS image. The new image becomes available alongside the public OS templates and can be passed as `template_id` when creating a new VM.

## Sources

Pick what to capture with `disk_id` and `snapshot_id`:

- `disk_id: 0` — the OS disk
- `disk_id: 1+` — an attached volume
- `snapshot_id: -1` — capture the **current live disk state** (stop the VM first for a consistent image)
- `snapshot_id: <id>` — capture from a specific saved snapshot

## Path parameters

- `id` string, uuid, required

## Headers

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

## Request body

- SaveImageRequest
  - `name` string, required — Custom image name.
  - `description` string — Optional description for the saved image.
  - `disk_id` integer — Which disk to capture. `0` for the OS disk, `1+` for attached volumes.
  - `snapshot_id` integer — Source for the image. `-1` captures the current live disk state. Pass a snapshot ID to capture from a saved snapshot.

## Response `201`

Image creation initiated

- object
  - `success` boolean
  - `data` VMImage — A custom OS image saved from a VM disk. Use `id` as `template_id` when creating new VMs.
    - `id` string, uuid, required — Image ID — use as `template_id` when creating a VM.
    - `name` string, required — Image name.
    - `version` string
    - `description` string
    - `os_type` string
    - `is_windows` boolean
    - `region` 'us-east', required
    - `created_at` string, date-time

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required
- `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/versions/a3f123570011/schema)
