---
title: "Recreate virtual machine"
method: POST
path: "/api/vps/v1/virtual-machines/{virtualMachineId}/recreate"
tags: ["VPS: Virtual machine"]
---

# Recreate virtual machine

`POST /api/vps/v1/virtual-machines/{virtualMachineId}/recreate`

Recreate a virtual machine from scratch.

The recreation process involves reinstalling the operating system and
resetting the virtual machine to its initial state.
Snapshots, if there are any, will be deleted.

## Password Requirements
Password will be checked against leaked password databases. 
Requirements for the password are:
- At least 12 characters long
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- Is not leaked publicly

**This operation is irreversible and will result in the loss of all data stored on the virtual machine!**

Use this endpoint to completely rebuild VPS instances with fresh OS installation.

## Path parameters

- `virtualMachineId` integer, required

## Request body

- VPSV1VirtualMachineRecreateRequest
  - `template_id` integer, required — Template ID
  - `password` string, password — Root password for the virtual machine. If not provided, random password will be generated. Password will not be shown in the response.
  - `panel_password` string, password — Panel password for the panel-based OS template. If not provided, random password will be generated. If OS does not support panel_password this field will be ignored. Password will not be shown in the response.
  - `post_install_script_id` integer — Post-install script to execute after virtual machine was recreated

## Response `200`

Success response

- VPSV1ActionActionResource
  - `id` integer — Action ID
  - `name` string — Action name
  - `state` 'success' | 'error' | 'delayed' | 'sent' | 'created' — Action state
  - `created_at` string, date-time
  - `updated_at` string, date-time

## Other responses

- `401` — Unauthenticated response
- `422` — Validation error response
- `500` — Error response

---

[API](https://skmtc.net/hostinger/apis/hostinger-api.md) · [All operations](https://skmtc.net/hostinger/apis/hostinger-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hostinger/hostinger-api/versions/796bd5194565/schema)
