Server Actions

Rebuild a Server from an Image

Rebuilds a Server overwriting its disk with the content of an Image, thereby destroying all data on the target Server

The Image can either be one you have created earlier (backup or snapshot Image) or it can be a completely fresh system Image provided by us. You can get a list of all available Images with GET /images.

Your Server will automatically be powered off before the rebuild command executes.

post/servers/{id}/actions/rebuild

Request

  • Base URL: https://api.hetzner.cloud/v1
  • URL: https://api.hetzner.cloud/v1/servers/{id}/actions/rebuild
  • Auth: HTTP bearer

Path parameters

idinteger required

ID of the Server.

Example:42

ID of the Server.

Request body

imagestring required

ID or name of Image to rebuilt from.

user_datastring

Cloud-Init user data to use during Server rebuild. This field is limited to 32KiB. If not specified, the Server's previous user_data value will be re-used (if any was set).

Example request

{
  "image": "ubuntu-24.04",
  "user_data": "#cloud-config\nruncmd:\n- [touch, /root/cloud-init-worked]\n"
}

Response

Request succeeded.

root_passwordstring nullable

New root password when not using SSH keys.

Example response

{
  "action": {
    "id": 42,
    "command": "start_resource",
    "started": "2016-01-30T23:55:00Z",
    "finished": "2016-01-30T23:55:00Z",
    "progress": 100,
    "resources": [
      {
        "id": 42,
        "type": "server"
      }
    ],
    "error": {
      "code": "action_failed",
      "message": "Action failed"
    }
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.