# Reinstall your servers

{% hint style="danger" %}
Warning: The operation will always cause a **full disk wipe**. All data will be lost! Proceed with caution.
{% endhint %}

To reinstall your servers, use the endpoint provided in the [API documentation](https://docs.i3d.net/api/api_flexmetal#patch-v3-flexmetal-servers-uuid). Ensure you obtain the required UUID from the POST /servers response body. You may pass optional parameters such as:

* `name` (hostname)
* `os` (operating system), which must include a slug property. If the OS is not Windows or Talos, the `sshKey` is mandatory.
* `kernelParam` (optional)
* `partitions` (optional)
* `sshKey` (essential if the OS is not Windows or Talos)
* `postInstallScript` (must be a valid Shell script)

### Usage Scenarios

{% tabs %}
{% tab title="Reinstall with the Initially Requested OS" %}

* **Parameters:**
  * `name`: (string)\
    Optionally include `kernelParam`, `partitions`, `sshKey`
* **Behavior:**\
  The originally provisioned OS will be reinstalled, including any specified `kernelParam`, custom `partitions`, and/or `sshKey`.
  * If you pass a new `sshKey`, it replaces the original.
    {% endtab %}

{% tab title="Reinstall with a Different OS" %}

* **Parameters:**
  * `os`: (object)\
    Fully specify the OS you want to install.
* **Behavior:**\
  The originally provisioned OS will be replaced by the provided OS object, which is installed instead.
  {% endtab %}

{% tab title="Reinstall with Specific SSH Keys" %}

* **Parameters:**
  * `sshKey`: (array)
* **Behavior:**\
  The originally provisioned OS is reinstalled, but **only** the passed SSH keys are injected (not the default/original ones).
  {% endtab %}
  {% endtabs %}

**Example PATCH request with all of the options**

```json
{
  "name": "host.example.com",
  "os": {
    "slug": "ubuntu-2404-lts",
    "kernelParams": [
      {
        "key": "test-kernel-param-key",
        "value": "test-kernel-param-value"
      }
    ],
    "partitions": [
      {
        "target": "/custom",
        "filesystem": "ext4",
        "size": 10240
      }
    ]
  },
  "sshKey": [
    "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHo8IaPkQ6UnDZvi4F4RBSouRa6Gtysdg2EF+SIXheVF2SGBQ2uH7RfDjXRfvq4VpHJrKYs4kWfNoHQg8ZG6PH4= ecdsa-key-20240131"
  ],
  "postInstallScript": "#!/bin/bash\necho \"Hello world!\" > /root/test.txt"
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.i3d.net/compute/flexmetal/reinstall-your-servers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
