> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gcore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage a Bare Metal server

export const MethodSection = ({children}) => children ?? null;

export const MethodSwitch = ({children}) => {
  const tabs = React.Children.toArray(children).map(c => {
    if (!c || !c.props) return null;
    if (c.props.id) return c;
    const inner = c.props.children;
    if (inner && inner.props && inner.props.id) return inner;
    return null;
  }).filter(Boolean);
  const firstId = tabs.length > 0 ? tabs[0].props.id : "";
  const [active, setActive] = React.useState(firstId);
  React.useEffect(() => {
    try {
      const saved = localStorage.getItem("gcore_docs_method");
      if (saved && tabs.find(t => t.props.id === saved)) {
        setActive(saved);
      }
    } catch (_) {}
  }, []);
  React.useEffect(() => {
    try {
      document.querySelectorAll("h2[id], h3[id]").forEach(heading => {
        const visible = heading.offsetParent !== null;
        document.querySelectorAll(`a[href="#${heading.id}"]`).forEach(link => {
          if (link.closest("h1,h2,h3,h4,h5,h6")) return;
          const li = link.closest("li");
          if (li) li.style.display = visible ? "" : "none";
        });
      });
    } catch (_) {}
    window.dispatchEvent(new Event("scroll"));
  }, [active]);
  const handleClick = id => {
    setActive(id);
    try {
      localStorage.setItem("gcore_docs_method", id);
    } catch (_) {}
  };
  return <div>
      <div className="not-prose flex gap-0 border-b border-zinc-200 dark:border-zinc-800 mb-8 mt-2" role="tablist">
        {tabs.map(tab => {
    const isActive = active === tab.props.id;
    return <button key={tab.props.id} role="tab" aria-selected={isActive} onClick={() => handleClick(tab.props.id)} className={["px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors cursor-pointer", isActive ? "border-primary text-primary" : "border-transparent text-zinc-500 hover:text-zinc-800 dark:hover:text-zinc-200"].join(" ")}>
              {tab.props.label}
            </button>;
  })}
      </div>

      {tabs.map(tab => <div key={tab.props.id} style={{
    display: active === tab.props.id ? "" : "none"
  }}>
          {tab.props.children}
        </div>)}
    </div>;
};

<MethodSwitch>
  <MethodSection id="portal" label="Customer Portal">
    <p>After a Bare Metal server is provisioned, the server detail page provides tabs for every management operation: **Overview**, **Access**, **Power**, **Networking**, **Tags**, **Rebuild**, **User Actions**, and **Delete**.</p>

    <p>To open the detail page: in the [Gcore Customer Portal](https://portal.gcore.com), navigate to **Cloud** → **Bare Metal** and click the server name.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-overview.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=387288f5096ef1969f053fb4ef798772" alt="Bare Metal server detail page with tabs Overview, Access, Power, Networking, Tags, Rebuild, User Actions, Delete" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-overview.png" />
    </Frame>

    ## Console access

    <p>The **Access** tab provides a browser-based VNC console for out-of-band access — useful when the server is unreachable over the network.</p>

    <Steps>
      <Step title="Open the Access tab">
        In the server detail page, select the **Access** tab.
      </Step>

      <Step title="Launch the console">
        Click **Launch console**. A new browser tab opens with the VNC session.
      </Step>
    </Steps>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-access.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=309a2cef6143d227463514ef23dbd85b" alt="Access tab showing the Console access section with a Launch console button" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-access.png" />
    </Frame>

    ## Power management

    <p>The **Power** tab controls the server's power state. Available actions depend on the current state:</p>

    * **Power on** — starts a stopped server. Appears only when the server is powered off.
    * **Power off** — cuts power immediately without a shutdown sequence, equivalent to pulling the power cord.
    * **Soft reboot** — sends a reboot signal to the OS for a graceful restart.
    * **Hard reboot** — cuts and restores power without a shutdown sequence. Use when a soft reboot does not respond.

    <Steps>
      <Step title="Open the Power tab">
        In the server detail page, select the **Power** tab.
      </Step>

      <Step title="Select an action">
        Click the required action button. The available buttons reflect the current power state.
      </Step>

      <Step title="Confirm the action">
        In the confirmation dialog, click **Confirm**.
      </Step>
    </Steps>

    <Warning>
      Power off and hard reboot cut power immediately without a shutdown sequence. All running processes are terminated and unsaved data may be lost.
    </Warning>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-power.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=9ba27c47ae8713d333a888bfbc797201" alt="Power tab showing Power off, Soft reboot, and Hard reboot sections" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-power.png" />
    </Frame>

    ## Network interfaces

    <p>The **Networking** tab shows all interfaces attached to the server. For servers with multi-bond enabled by Gcore support, each trunk appears as a separate bond. Sub-interfaces (tagged VLAN ports) can be added to an existing bond after provisioning. Removing an existing interface is not supported in the Customer Portal — contact [Gcore support](https://gcore.com/contact-us) if interface removal is required.</p>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-networking.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=acb2c268f12d4d97bddbfcc20de947b3" alt="Networking tab showing Trunk Interface 1 with one sub-interface and an Add Sub-Interface button" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-networking.png" />
    </Frame>

    <Warning>
      Bare Metal servers use LACP bonding — interfaces are named `bond0` rather than `eth0`. Private network interfaces added after provisioning are not configured automatically inside the OS. After adding a sub-interface, configure the VLAN tag and IP address inside the OS manually.
    </Warning>

    **Add a sub-interface**

    <Steps>
      <Step title="Open the Networking tab">
        In the server detail page, select the **Networking** tab, then open the **Sub Interface** sub-tab.
      </Step>

      <Step title="Configure the sub-interface">
        Fill in the form:

        1. Select the **Network** from the dropdown. Only networks with Bare Metal support enabled are listed.
        2. Select the **Subnet**.
        3. Select the IP address allocation method: **Auto** (DHCP assigns an IP) or **Manual** (enter a specific IP).
        4. Optionally select a **Port Group** to place the interface on a specific bond trunk.
      </Step>

      <Step title="Add the interface">
        Click **Add Interface**.
      </Step>
    </Steps>

    ## Tags

    <p>The **Tags** tab has two sections: **System tags** (read-only metadata generated by the platform) and **Custom tags** (key-value pairs you define for filtering and organization).</p>

    <Steps>
      <Step title="Open the Tags tab">
        In the server detail page, select the **Tags** tab.
      </Step>

      <Step title="Enable custom tags">
        Enable the **Add custom tags** toggle. Key and Value fields appear.
      </Step>

      <Step title="Enter key-value pairs">
        Fill in the **Key** and **Value** fields. Click **+ Add tag** to add more pairs.
      </Step>

      <Step title="Save">
        Click **Save changes**.
      </Step>
    </Steps>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-tags-form.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=00017149b60b4e1aeab760ea997631ca" alt="Tags tab with Add custom tags toggle enabled, showing Key and Value input fields" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-tags-form.png" />
    </Frame>

    ## Rebuild

    <p>Rebuild reinstalls the operating system on the server while preserving its network configuration, IP addresses, and tags. All data on local NVMe drives is wiped during the process. Rebuild takes approximately 4–5 minutes.</p>

    <Steps>
      <Step title="Open the Rebuild tab">
        In the server detail page, select the **Rebuild** tab.
      </Step>

      <Step title="Select an image">
        Choose an OS image from the list. Both distribution templates (Ubuntu, Debian, CentOS, Windows, Rocky Linux) and custom ISO images are available, subject to flavor compatibility.
      </Step>

      <Step title="Configure access credentials">
        Enter an **SSH key** (for Linux) or **Password** (for Windows), or provide both.
      </Step>

      <Step title="Start rebuild">
        Click **Rebuild**. Confirm the action in the dialog — the server enters **REBUILD** status and returns to **ACTIVE** when complete.
      </Step>
    </Steps>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-rebuild.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=26f47b8ff9056eb6e38dedcf376eca9e" alt="Rebuild tab showing OS image selection with Ubuntu, CentOS, Debian, and Rocky Linux options" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-rebuild.png" />
    </Frame>

    <Warning>
      All data on local NVMe drives is permanently wiped during rebuild. Back up any data before proceeding.
    </Warning>

    ## Rename a server

    <Steps>
      <Step title="Open the server list">
        Navigate to **Cloud** → **Bare Metal** to see the server list.
      </Step>

      <Step title="Edit the name">
        Click the edit icon next to the server name. Enter the new name and press **Enter** to confirm.
      </Step>
    </Steps>

    ## Delete a server

    <p>Deletion is asynchronous and takes 3–5 minutes. Local NVMe storage is wiped during deprovisioning, and the hardware is released to the pool.</p>

    <Steps>
      <Step title="Open the Delete tab">
        In the server detail page, select the **Delete** tab.
      </Step>

      <Step title="Start deletion">
        Click **Delete**. A confirmation dialog appears.
      </Step>

      <Step title="Confirm deletion">
        Type **Delete** in the confirmation field, then click **Delete Bare Metal**.
      </Step>
    </Steps>

    <Frame>
      <img src="https://mintcdn.com/gcore/-EDHVZANozzHKw_m/images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-delete.png?fit=max&auto=format&n=-EDHVZANozzHKw_m&q=85&s=e185febdae167b86aefd8d353cdb6449" alt="Delete tab showing the irreversible deletion warning and a Delete button" width="1440" height="900" data-path="images/docs/cloud/bare-metal-servers/manage-a-bare-metal-server/manage-a-bare-metal-server-delete.png" />
    </Frame>

    <Warning>
      Deletion is irreversible. The server and all local storage are permanently removed.
    </Warning>
  </MethodSection>

  <MethodSection id="api" label="REST API">
    <p>Manage existing Bare Metal servers programmatically — retrieve details, rename, update tags, control power state, access the console, rebuild with a new image, and delete.</p>

    <Info>
      An [API token](/account-settings/api-tokens) is required, along with a
      [project ID](/api-reference/cloud/projects/list-projects)
      and a [region ID](/api-reference/cloud/regions/list-regions).
    </Info>

    <p>Set the following environment variables before running the examples:</p>

    ```bash theme={null}
    export GCORE_API_KEY="{YOUR_API_KEY}"
    export GCORE_CLOUD_PROJECT_ID="{YOUR_PROJECT_ID}"
    export GCORE_CLOUD_REGION_ID="{YOUR_REGION_ID}"
    export SERVER_ID="{YOUR_SERVER_ID}"
    ```

    ## Get server details

    <p>Retrieve the current state, IP addresses, flavor, and hardware description of a server.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        server = client.cloud.baremetal.servers.get(server_id=os.environ["SERVER_ID"])
        print(f"Status: {server.status}")
        for network, ifaces in server.addresses.items():
            for iface in ifaces:
                print(f"{network}: {iface.addr}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            server, err := client.Cloud.Baremetal.Servers.Get(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerGetParams{})
            if err != nil {
                log.Fatalf("get server: %v", err)
            }
            fmt.Printf("Status: %s\n", server.Status)
            for network, ifaces := range server.Addresses {
                fmt.Printf("%s: %s\n", network, ifaces[0].AsFixedIPAddress().Addr)
            }
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl "https://api.gcore.com/cloud/v1/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY"
        ```

        The API returns:

        ```json theme={null}
        {
          "id": "90ba53c5-def5-4825-83fb-9adc78bd3266",
          "name": "my-bm-server",
          "status": "ACTIVE",
          "flavor": {
            "flavor_id": "bm1a-hf-1x7950x-128-2x960gb-2x10nic",
            "hardware_description": {
              "cpu": "1x AMD Ryzen 7950X 16C/32T 4.5 GHz",
              "disk": "2x 960GB NVMe"
            }
          },
          "addresses": {
            "pub_net": [{"addr": "85.234.84.18", "type": "fixed"}]
          }
        }
        ```
      </Tab>
    </Tabs>

    ## Rename a server

    <p>Update the server name using a `PATCH` request. The name can be changed at any time without restarting the server.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        server = client.cloud.baremetal.servers.update(
            server_id=os.environ["SERVER_ID"],
            name="new-server-name",
        )
        print(f"Renamed to: {server.name}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            server, err := client.Cloud.Baremetal.Servers.Update(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerUpdateParams{
                Name: gcore.String("new-server-name"),
            })
            if err != nil {
                log.Fatalf("rename server: %v", err)
            }
            fmt.Printf("Renamed to: %s\n", server.Name)
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X PATCH \
          "https://api.gcore.com/cloud/v1/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{"name": "new-server-name"}'
        ```

        The API returns the updated server object with the new `name` field.
      </Tab>
    </Tabs>

    ## Update tags

    <p>Attach key-value tags to a server for filtering and cost allocation. Tags are included in `PATCH` requests as a list of objects with `key` and `value` fields — the call replaces the full tag set, so include all existing tags alongside any new ones.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        server = client.cloud.baremetal.servers.update(
            server_id=os.environ["SERVER_ID"],
            tags=[
                {"key": "env", "value": "production"},
                {"key": "team", "value": "platform"},
            ],
        )
        print(f"Tags: {server.tags}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            server, err := client.Cloud.Baremetal.Servers.Update(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerUpdateParams{
                Tags: []cloud.TagKeyValue{
                    {Key: "env", Value: gcore.String("production")},
                    {Key: "team", Value: gcore.String("platform")},
                },
            })
            if err != nil {
                log.Fatalf("update tags: %v", err)
            }
            fmt.Printf("Tags: %v\n", server.Tags)
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X PATCH \
          "https://api.gcore.com/cloud/v1/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{
            "tags": [
              {"key": "env", "value": "production"},
              {"key": "team", "value": "platform"}
            ]
          }'
        ```

        The API returns the updated server object including the `tags` array.
      </Tab>
    </Tabs>

    ## Power management

    <p>Send power actions to a server using the `action` endpoint. Available actions: `start`, `stop`, `reboot`, `reboot_hard`.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        # stop, reboot, or reboot_hard — change the action string as needed
        result = client.cloud.baremetal.servers.action(
            server_id=os.environ["SERVER_ID"],
            action="reboot",
        )
        client.cloud.tasks.poll(result.tasks[0])
        print("Action completed")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            // stop, reboot, or reboot_hard — change the Action string as needed
            taskList, err := client.Cloud.Baremetal.Servers.Action(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerActionParams{
                OfBasicBareMetalActionInstanceSerializer: &cloud.BaremetalServerActionParamsBodyBasicBareMetalActionInstanceSerializer{
                    Action: "reboot",
                },
            })
            if err != nil {
                log.Fatalf("action: %v", err)
            }
            if _, err := client.Cloud.Tasks.Poll(ctx, taskList.Tasks[0]); err != nil {
                log.Fatalf("poll: %v", err)
            }
            fmt.Println("Action completed")
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X POST \
          "https://api.gcore.com/cloud/v2/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID/action" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{"action": "reboot"}'
        ```

        The API returns:

        ```json theme={null}
        {"tasks": ["c284dcba-9804-43b9-815a-5c7eb466439e"]}
        ```

        Poll `GET /cloud/v1/tasks/{task_id}` every 10 seconds until `state` is `FINISHED`. A hard reboot on physical hardware can take several minutes — longer than the equivalent Virtual Machine operation.
      </Tab>
    </Tabs>

    <p>Starting a stopped server accepts an additional `activate_profile` flag to re-activate the server's [Advanced DDoS protection](/ddos-protection) profile:</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        result = client.cloud.baremetal.servers.action(
            server_id=os.environ["SERVER_ID"],
            action="start",
            activate_profile=True,
        )
        client.cloud.tasks.poll(result.tasks[0])
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        taskList, err := client.Cloud.Baremetal.Servers.Action(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerActionParams{
            OfStartActionInstanceSerializer: &cloud.BaremetalServerActionParamsBodyStartActionInstanceSerializer{
                ActivateProfile: gcore.Bool(true),
            },
        })
        if err != nil {
            log.Fatalf("start: %v", err)
        }
        client.Cloud.Tasks.Poll(ctx, taskList.Tasks[0])
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X POST \
          "https://api.gcore.com/cloud/v2/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID/action" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d '{"action": "start", "activate_profile": true}'
        ```
      </Tab>
    </Tabs>

    <p>`activate_profile` defaults to `true` — set it to `false` to start the server without touching the DDoS profile.</p>

    ## Get console URL

    <p>Retrieve a URL for a browser-based VNC console session. The URL is time-limited and should be opened immediately after retrieval.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        console = client.cloud.baremetal.servers.get_console(server_id=os.environ["SERVER_ID"])
        print(f"Console URL: {console.url}")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            console, err := client.Cloud.Baremetal.Servers.GetConsole(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerGetConsoleParams{})
            if err != nil {
                log.Fatalf("get console: %v", err)
            }
            fmt.Printf("Console URL: %s\n", console.URL)
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl "https://api.gcore.com/cloud/v1/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID/get_console" \
          -H "Authorization: APIKey $GCORE_API_KEY"
        ```

        The API returns:

        ```json theme={null}
        {"url": "https://console.gcore.com/vnc?token=..."}
        ```
      </Tab>
    </Tabs>

    ## Rebuild

    <p>Reinstall the OS on a server using a new image while preserving network configuration, IP addresses, and tags. All data on local NVMe drives is wiped. Rebuild takes approximately 4–5 minutes.</p>

    | Parameter      | Required | Description                                                                                                                                 |
    | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
    | `image_id`     | Yes      | ID of the OS image. Find region-specific IDs via the [Bare Metal images API](/api-reference/cloud/bare-metal-servers/list-baremetal-images) |
    | `ssh_key_name` | No       | SSH key to authorize on the rebuilt server. If omitted, no SSH key is injected — access depends on `user_data` or `password`                |
    | `user_data`    | No       | Base64-encoded cloud-init script for post-boot configuration                                                                                |
    | `username`     | No       | Create a new OS user with this name                                                                                                         |
    | `password`     | No       | Set password for the default user (Linux) or Admin user (Windows)                                                                           |

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        # List available images to find the image_id
        images = client.cloud.baremetal.images.list()
        image_id = next(img.id for img in images.results if "ubuntu-24.04-x64-ironic" in img.name)

        result = client.cloud.baremetal.servers.rebuild(
            server_id=os.environ["SERVER_ID"],
            image_id=image_id,
        )
        client.cloud.tasks.poll(result.tasks[0])
        print("Rebuild complete")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"
            "strings"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            images, err := client.Cloud.Baremetal.Images.List(ctx, cloud.BaremetalImageListParams{})
            if err != nil {
                log.Fatalf("list images: %v", err)
            }

            var imageID string
            for _, img := range images.Results {
                if strings.Contains(img.Name, "ubuntu-24.04-x64-ironic") {
                    imageID = img.ID
                    break
                }
            }
            if imageID == "" {
                log.Fatal("image not found")
            }

            taskList, err := client.Cloud.Baremetal.Servers.Rebuild(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerRebuildParams{
                ImageID: imageID,
            })
            if err != nil {
                log.Fatalf("rebuild: %v", err)
            }
            if _, err := client.Cloud.Tasks.Poll(ctx, taskList.Tasks[0]); err != nil {
                log.Fatalf("poll: %v", err)
            }
            fmt.Println("Rebuild complete")
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        # Set IMAGE_ID to the target OS image (region-specific)
        export IMAGE_ID="{YOUR_IMAGE_ID}"

        curl -X POST \
          "https://api.gcore.com/cloud/v1/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID/rebuild" \
          -H "Authorization: APIKey $GCORE_API_KEY" \
          -H "Content-Type: application/json" \
          -d "{\"image_id\": \"$IMAGE_ID\", \"ssh_key_name\": \"my-key\"}"
        ```

        The API returns:

        ```json theme={null}
        {"tasks": ["b7e12a43-0123-4567-89ab-cdef01234567"]}
        ```

        Poll `GET /cloud/v1/tasks/{task_id}` every 30 seconds until `state` is `FINISHED`.
      </Tab>
    </Tabs>

    ## Delete a server

    <p>Deletion is asynchronous and takes 3–5 minutes. Local NVMe storage is wiped during deprovisioning and the hardware is released to the pool.</p>

    <Tabs>
      <Tab title="Python SDK">
        ```python theme={null}
        import os
        from gcore import Gcore

        client = Gcore()

        result = client.cloud.baremetal.servers.delete(server_id=os.environ["SERVER_ID"])
        client.cloud.tasks.poll(result.tasks[0])
        print("Server deleted")
        ```
      </Tab>

      <Tab title="Go SDK">
        ```go theme={null}
        package main

        import (
            "context"
            "fmt"
            "log"
            "os"

            gcore "github.com/G-Core/gcore-go"
            "github.com/G-Core/gcore-go/cloud"
        )

        func main() {
            client := gcore.NewClient()
            ctx := context.Background()

            taskList, err := client.Cloud.Baremetal.Servers.Delete(ctx, os.Getenv("SERVER_ID"), cloud.BaremetalServerDeleteParams{})
            if err != nil {
                log.Fatalf("delete: %v", err)
            }
            if _, err := client.Cloud.Tasks.Poll(ctx, taskList.Tasks[0]); err != nil {
                log.Fatalf("poll: %v", err)
            }
            fmt.Println("Server deleted")
        }
        ```
      </Tab>

      <Tab title="curl">
        ```bash theme={null}
        curl -X DELETE \
          "https://api.gcore.com/cloud/v1/bminstances/$GCORE_CLOUD_PROJECT_ID/$GCORE_CLOUD_REGION_ID/$SERVER_ID" \
          -H "Authorization: APIKey $GCORE_API_KEY"
        ```

        The API returns:

        ```json theme={null}
        {"tasks": ["ee54040a-1671-414a-a3f2-c2c0d62a2325"]}
        ```

        Poll `GET /cloud/v1/tasks/{task_id}` every 30 seconds until `state` is `FINISHED`.
      </Tab>
    </Tabs>
  </MethodSection>

  <MethodSection id="terraform" label="Terraform">
    <p>Manage existing [`gcore_cloud_baremetal_server`](https://registry.terraform.io/providers/G-Core/gcore/latest/docs/resources/cloud_baremetal_server) resources declared in Terraform state — update name and tags, delete, or import servers provisioned outside Terraform.</p>

    ## Update name and tags

    <p>Modify the `name` or `tags` attribute in the resource block and run `terraform apply`. No server restart is required — Terraform sends a `PATCH` request and updates the state.</p>

    ```hcl theme={null}
    resource "gcore_cloud_baremetal_server" "example" {
      project_id = var.project_id
      region_id  = var.region_id
      flavor     = var.flavor_id
      name       = "updated-server-name"
      image_id   = var.image_id

      tags = {
        env  = "production"
        team = "platform"
      }

      interfaces = [{
        type      = "external"
        ip_family = "ipv4"
      }]
    }
    ```

    ```bash theme={null}
    terraform apply
    ```

    ## Power management

    <p>The Terraform provider does not support power state operations (`start`, `stop`, `reboot`, `reboot_hard`) for Bare Metal servers. Use the Customer Portal or the REST API tab to perform these actions.</p>

    ## Delete a server

    <p>Remove the resource block from the configuration and run `terraform apply`. Deprovisioning takes 3–5 minutes and permanently wipes local NVMe storage.</p>

    ```hcl theme={null}
    # Remove or comment out this block:
    # resource "gcore_cloud_baremetal_server" "example" { ... }
    ```

    ```bash theme={null}
    terraform apply
    ```

    ## Import a server

    <p>Use when a server was created outside Terraform and needs to be managed as code. Declare the resource block without write-only creation attributes, then run the import command.</p>

    ```hcl theme={null}
    resource "gcore_cloud_baremetal_server" "example" {
      project_id = var.project_id
      region_id  = var.region_id
      name       = "my-bare-metal"
      image_id   = var.image_id

      interfaces = [{
        type      = "external"
        ip_family = "ipv4"
      }]
    }
    ```

    ```bash theme={null}
    terraform import gcore_cloud_baremetal_server.example '<project_id>/<region_id>/<server_id>'
    ```

    <Warning>
      If `password_wo_version` is set in the resource block, Terraform will propose replacing the server after import. Omit `password_wo_version` from the configuration when importing an existing server.
    </Warning>
  </MethodSection>
</MethodSwitch>
