Use when writing Go code to interact with Hetzner Cloud API - automation, infrastructure provisioning, bots, integrations, or programmatic cloud operations
View on GitHubgaarutyunov/dev-skills
hetzner
hetzner/skills/hcloud-go-sdk/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/gaarutyunov/dev-skills/blob/main/hetzner/skills/hcloud-go-sdk/SKILL.md -a claude-code --skill hcloud-go-sdkInstallation paths:
.claude/skills/hcloud-go-sdk/# 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