Back to Skills

hcloud-go-sdk

verified

Use when writing Go code to interact with Hetzner Cloud API - automation, infrastructure provisioning, bots, integrations, or programmatic cloud operations

View on GitHub

Marketplace

dev-skills

gaarutyunov/dev-skills

Plugin

hetzner

Repository

gaarutyunov/dev-skills

hetzner/skills/hcloud-go-sdk/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/gaarutyunov/dev-skills/blob/main/hetzner/skills/hcloud-go-sdk/SKILL.md -a claude-code --skill hcloud-go-sdk

Installation paths:

Claude
.claude/skills/hcloud-go-sdk/
Powered by add-skill CLI

Instructions

# Hetzner Cloud Go SDK

## Overview

The official Go SDK for Hetzner Cloud provides type-safe access to 23+ resource types with automatic retries, action polling, and comprehensive error handling. Use it for bots, automation, integrations, and complex workflows. For quick CLI operations, use `hetzner:hcloud-cli` instead.

## Quick Setup

```go
import "github.com/hetznercloud/hcloud-go/v2/hcloud"

// Create client
client := hcloud.NewClient(hcloud.WithToken("your-api-token"))
```

```bash
go get github.com/hetznercloud/hcloud-go/v2/hcloud
```

## Quick Reference

| Task | Method |
|------|--------|
| **Servers** | |
| List servers | `client.Server.All(ctx)` |
| Get server | `client.Server.GetByID(ctx, 123)` or `GetByName(ctx, "web")` |
| Create server | `client.Server.Create(ctx, hcloud.ServerCreateOpts{})` |
| Delete server | `client.Server.Delete(ctx, server)` |
| Reboot/Reset | `client.Server.Reboot(ctx, server)` / `Reset(ctx, server)` |
| **Networks** | |
| Create network | `client.Network.Create(ctx, hcloud.NetworkCreateOpts{})` |
| Attach server | `client.Server.AttachToNetwork(ctx, server, opts)` |
| **Volumes** | |
| Create volume | `client.Volume.Create(ctx, hcloud.VolumeCreateOpts{})` |
| Attach volume | `client.Volume.Attach(ctx, volume, server)` |
| **Actions** | |
| Wait for action | `client.Action.WaitFor(ctx, action)` |
| Poll with callback | `client.Action.WaitForFunc(ctx, callback, action)` |

## API Categories

See `references/api-reference.md` for complete method list:
- Servers (create, lifecycle, networking)
- Networks, subnets, routes
- Volumes
- Firewalls and rules
- Load balancers, targets, services
- Floating IPs, Primary IPs
- SSH keys, images, certificates
- DNS zones (GA in v2.30.0)
- Storage boxes (experimental)

## Client Configuration

```go
client := hcloud.NewClient(
    hcloud.WithToken("token"),                    // Required
    hcloud.WithEndpoint("https://api.hetzner.cloud/v1"), // Custom endpoint
    hcloud.WithApplication("myap

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
3999 chars