Crate hcloud[][src]

Expand description

Unofficial Rust crate for accessing the Hetzner Cloud API


The hcloud crate can be used for managing the endpoints provided by the Hetzner Cloud API in your Rust project.

The API client code of this crate has been auto-generated from the Unofficial OpenAPI Description for the Hetzner Cloud API using OpenAPI Generator.

Current state of development

  • supported API endpoints (complete as of November 2021): actions, certificates, datacenters, firewalls, floating_ips, images, isos, load_balancer_types, load_balancers, locations, networks, pricing, placement_groups, server_types, servers, ssh_keys, volumes
  • asynchronous API functions
  • pagination support
  • documentation and tests are still WIP

Selecting TLS implementation

The underlying TLS implementation for reqwest can be selected using Cargo features:

  • default-tls (enabled by default): Provides TLS support to connect over HTTPS.
  • native-tls: Enables TLS functionality provided by native-tls.
  • native-tls-vendored: Enables the vendored feature of native-tls.
  • rustls-tls: Enables TLS functionality provided by rustls.

(Refer to Optional Features in the reqwest documentation.)

Example for using the TLS functionality provided by rustls:

hcloud = { version = "*", default-features = false, features = ["rustls-tls"] }


A very basic example for listing all existing servers:

use hcloud::apis::configuration::Configuration;
use hcloud::apis::servers_api;

// set up basic configuration using API token
let mut configuration = Configuration::new();
configuration.bearer_access_token =

// get list of all existing servers from servers API
let servers = servers_api::list_servers(&configuration, Default::default())

// handle server data
for server in servers {
    println!("{:?}", server);