hetzner-client
v3.1.2
Published
A TypeScript SDK for the Hetzner Cloud API, generated from the official OpenAPI specification and designed to make it easy to interact with Hetzner resources in a typed, modern way.
Readme
Hetzner Client
A TypeScript SDK for the Hetzner Cloud API, generated from the official OpenAPI specification and designed to make it easy to interact with Hetzner resources in a typed, modern way.
Current version
Current package version: 3.1.2
What this SDK is
This project provides a client library for Hetzner Cloud services such as:
- Servers
- Load balancers
- Networks
- Firewalls
- Volumes
- Images
- Datacenters and locations
- Certificates
- DNS zones and records
- Primary IPs, Floating IPs, and more
The SDK is built around the official Hetzner API contract, which means the generated methods, request shapes, and response types closely match the platform's documented endpoints.
API sync
This SDK is kept in sync with the Hetzner API by generating it from the official OpenAPI schema in this repository. The project includes a generation flow that refreshes the client from the API spec, so when Hetzner updates the API definition, the SDK can be regenerated to stay aligned with the latest endpoints and payloads.
In short: the SDK is designed to track the upstream Hetzner Cloud API as the spec evolves.
Open source and community contributions
This project is open source and contributions are welcome from anyone.
You can contribute by:
- reporting issues
- improving documentation
- adding examples
- fixing bugs
- proposing schema or client improvements
- helping keep the SDK aligned with the upstream API
If you’d like to contribute, open an issue or submit a pull request with a clear explanation of the change.
SDK overview
This SDK is a generated, typed client library for JavaScript and TypeScript applications.
Key characteristics:
- Strong TypeScript typings for request and response payloads
- API-first generation from OpenAPI schema
- Request helpers and config utilities
- Modern fetch-based client transport
- Easy integration into Node.js and Bun-based projects
The generated code is organized into a few main pieces:
- core utilities for request building and serialization
- generated client primitives
- generated SDK methods for the Hetzner endpoints
- shared types for request and response models
Installation
Using Bun:
bun add hetzner-clientUsing npm or pnpm:
npm install hetzner-client
# or
pnpm add hetzner-clientQuick start
import * as hetzner from 'hetzner-client';
const result = await hetzner.getServers({
headers: {
Authorization: `Bearer ${process.env.HETZNER_API_TOKEN}`,
},
});
console.log(result.data);A more realistic setup usually creates a client or passes the token through a configured client instance.
Example using a configured client
import * as hetzner from 'hetzner-client';
const client = hetzner.createClient({
headers: {
Authorization: `Bearer ${process.env.HETZNER_API_TOKEN}`,
},
});
const response = await hetzner.getServers({
client,
});
console.log(response);Development and generation
This repository includes scripts to fetch and generate the SDK from the Hetzner OpenAPI definition.
bun run fetch-openapi
bun run generate-sdkThis makes it straightforward to refresh the client whenever the upstream API schema changes.
Project status
This SDK is intended to be a practical, maintainable client for the Hetzner Cloud API and a good foundation for both small projects and larger integrations.
It is built for developers who want a typed, API-aligned client without manually hand-writing every endpoint.
Notes
This project uses Bun for development and code generation, but the generated SDK is designed for TypeScript-based application usage.
For the latest project status and generated API coverage, consult the repository files and the OpenAPI definition included in the project.
