API References
Main Interface
- class Client(token: str, api_endpoint: str = 'https://api.hetzner.cloud/v1', application_name: str | None = None, application_version: str | None = None, poll_interval: int | float | BackoffFunction = 1.0, poll_max_retries: int = 120, timeout: float | tuple[float, float] | None = None, *, api_endpoint_hetzner: str = 'https://api.hetzner.com/v1')[source]
Client for the Hetzner Cloud API.
The Hetzner Cloud API reference is available at https://docs.hetzner.cloud.
Make sure to follow our API changelog available at https://docs.hetzner.cloud/changelog (or the RRS feed available at https://docs.hetzner.cloud/changelog/feed.rss) to be notified about additions, deprecations and removals.
Retry mechanism
The
Client.requestmethod will retry failed requests that match certain criteria. The default retry interval is defined by an exponential backoff algorithm truncated to 60s with jitter. The default maximal number of retries is 5.The following rules define when a request can be retried:
When the client returned a network timeout error.
When the API returned an HTTP error, with the status code:
502Bad Gateway504Gateway Timeout
When the API returned an application error, with the code:
conflictrate_limit_exceededtimeout
Changes to the retry policy might occur between releases, and will not be considered breaking changes.
- actions
ActionsClient Instance
- Type:
- certificates
CertificatesClient Instance
- Type:
- datacenters
DatacentersClient Instance
- Type:
- firewalls
FirewallsClient Instance
- Type:
- floating_ips
FloatingIPsClient Instance
- Type:
- images
ImagesClient Instance
- Type:
- isos
ImagesClient Instance
- Type:
- load_balancer_types
LoadBalancerTypesClient Instance
- Type:
- load_balancers
LoadBalancersClient Instance
- Type:
- locations
LocationsClient Instance
- Type:
- networks
NetworksClient Instance
- Type:
- placement_groups
PlacementGroupsClient Instance
- Type:
- primary_ips
PrimaryIPsClient Instance
- Type:
- request(method: str, url: str, **kwargs) dict[str, Any][source]
Perform a request to the Hetzner Cloud API.
- Parameters:
method – Method to perform the request.
url – URL to perform the request.
timeout – Requests timeout in seconds.
- server_types
ServerTypesClient Instance
- Type:
- servers
ServersClient Instance
- Type:
- ssh_keys
SSHKeysClient Instance
- Type:
- storage_box_types
StorageBoxTypesClient Instance
- Type:
- storage_boxes
StorageBoxesClient Instance
- Type:
- volumes
VolumesClient Instance
- Type:
- zones
ZonesClient Instance
- Type:
API Clients
- ActionsClient
- CertificateClient
CertificatesClientCertificatesClient.actionsCertificatesClient.create()CertificatesClient.create_managed()CertificatesClient.delete()CertificatesClient.get_actions()CertificatesClient.get_actions_list()CertificatesClient.get_all()CertificatesClient.get_by_id()CertificatesClient.get_by_name()CertificatesClient.get_list()CertificatesClient.retry_issuance()CertificatesClient.update()
BoundCertificateCertificate
- DatacentersClient
- FirewallsClient
FirewallsClientFirewallsClient.actionsFirewallsClient.apply_to_resources()FirewallsClient.create()FirewallsClient.delete()FirewallsClient.get_actions()FirewallsClient.get_actions_list()FirewallsClient.get_all()FirewallsClient.get_by_id()FirewallsClient.get_by_name()FirewallsClient.get_list()FirewallsClient.remove_from_resources()FirewallsClient.set_rules()FirewallsClient.update()
BoundFirewallFirewallFirewallRuleFirewallResourceCreateFirewallResponse
- Floating IPsClient
FloatingIPsClientFloatingIPsClient.actionsFloatingIPsClient.assign()FloatingIPsClient.change_dns_ptr()FloatingIPsClient.change_protection()FloatingIPsClient.create()FloatingIPsClient.delete()FloatingIPsClient.get_actions()FloatingIPsClient.get_actions_list()FloatingIPsClient.get_all()FloatingIPsClient.get_by_id()FloatingIPsClient.get_by_name()FloatingIPsClient.get_list()FloatingIPsClient.unassign()FloatingIPsClient.update()
BoundFloatingIPFloatingIPCreateFloatingIPResponse
- ImagesClient
- ISOsClient
- LoadBalancerTypesClient
- LoadBalancerClient
LoadBalancersClientLoadBalancersClient.actionsLoadBalancersClient.add_service()LoadBalancersClient.add_target()LoadBalancersClient.attach_to_network()LoadBalancersClient.change_algorithm()LoadBalancersClient.change_dns_ptr()LoadBalancersClient.change_protection()LoadBalancersClient.change_type()LoadBalancersClient.create()LoadBalancersClient.delete()LoadBalancersClient.delete_service()LoadBalancersClient.detach_from_network()LoadBalancersClient.disable_public_interface()LoadBalancersClient.enable_public_interface()LoadBalancersClient.get_actions()LoadBalancersClient.get_actions_list()LoadBalancersClient.get_all()LoadBalancersClient.get_by_id()LoadBalancersClient.get_by_name()LoadBalancersClient.get_list()LoadBalancersClient.get_metrics()LoadBalancersClient.remove_target()LoadBalancersClient.update()LoadBalancersClient.update_service()
BoundLoadBalancerBoundLoadBalancer.add_service()BoundLoadBalancer.add_target()BoundLoadBalancer.attach_to_network()BoundLoadBalancer.change_algorithm()BoundLoadBalancer.change_dns_ptr()BoundLoadBalancer.change_protection()BoundLoadBalancer.change_type()BoundLoadBalancer.delete()BoundLoadBalancer.delete_service()BoundLoadBalancer.detach_from_network()BoundLoadBalancer.disable_public_interface()BoundLoadBalancer.enable_public_interface()BoundLoadBalancer.get_actions()BoundLoadBalancer.get_actions_list()BoundLoadBalancer.get_metrics()BoundLoadBalancer.modelBoundLoadBalancer.remove_target()BoundLoadBalancer.update()BoundLoadBalancer.update_service()
LoadBalancerLoadBalancerServiceLoadBalancerServiceHttpLoadBalancerHealthCheckLoadBalancerHealthCheckHttpLoadBalancerTargetLoadBalancerTargetHealthStatusLoadBalancerTargetLabelSelectorLoadBalancerTargetIPLoadBalancerAlgorithm
- LocationsClient
- NetworksClient
NetworksClientNetworksClient.actionsNetworksClient.add_route()NetworksClient.add_subnet()NetworksClient.change_ip_range()NetworksClient.change_protection()NetworksClient.create()NetworksClient.delete()NetworksClient.delete_route()NetworksClient.delete_subnet()NetworksClient.get_actions()NetworksClient.get_actions_list()NetworksClient.get_all()NetworksClient.get_by_id()NetworksClient.get_by_name()NetworksClient.get_list()NetworksClient.update()
BoundNetworkNetworkNetworkSubnetNetworkRouteCreateNetworkResponse
- PlacementGroupsClient
- PrimaryIPsClient
PrimaryIPsClientPrimaryIPsClient.actionsPrimaryIPsClient.assign()PrimaryIPsClient.change_dns_ptr()PrimaryIPsClient.change_protection()PrimaryIPsClient.create()PrimaryIPsClient.delete()PrimaryIPsClient.get_actions()PrimaryIPsClient.get_actions_list()PrimaryIPsClient.get_all()PrimaryIPsClient.get_by_id()PrimaryIPsClient.get_by_name()PrimaryIPsClient.get_list()PrimaryIPsClient.unassign()PrimaryIPsClient.update()
BoundPrimaryIPPrimaryIP
- ServerTypesClient
- ServersClient
ServersClientServersClient.actionsServersClient.add_to_placement_group()ServersClient.attach_iso()ServersClient.attach_to_network()ServersClient.change_alias_ips()ServersClient.change_dns_ptr()ServersClient.change_protection()ServersClient.change_type()ServersClient.create()ServersClient.create_image()ServersClient.delete()ServersClient.detach_from_network()ServersClient.detach_iso()ServersClient.disable_backup()ServersClient.disable_rescue()ServersClient.enable_backup()ServersClient.enable_rescue()ServersClient.get_actions()ServersClient.get_actions_list()ServersClient.get_all()ServersClient.get_by_id()ServersClient.get_by_name()ServersClient.get_list()ServersClient.get_metrics()ServersClient.power_off()ServersClient.power_on()ServersClient.reboot()ServersClient.rebuild()ServersClient.remove_from_placement_group()ServersClient.request_console()ServersClient.reset()ServersClient.reset_password()ServersClient.shutdown()ServersClient.update()
BoundServerBoundServer.add_to_placement_group()BoundServer.attach_iso()BoundServer.attach_to_network()BoundServer.change_alias_ips()BoundServer.change_dns_ptr()BoundServer.change_protection()BoundServer.change_type()BoundServer.create_image()BoundServer.delete()BoundServer.detach_from_network()BoundServer.detach_iso()BoundServer.disable_backup()BoundServer.disable_rescue()BoundServer.enable_backup()BoundServer.enable_rescue()BoundServer.get_actions()BoundServer.get_actions_list()BoundServer.get_metrics()BoundServer.modelBoundServer.power_off()BoundServer.power_on()BoundServer.reboot()BoundServer.rebuild()BoundServer.remove_from_placement_group()BoundServer.request_console()BoundServer.reset()BoundServer.reset_password()BoundServer.shutdown()BoundServer.update()
ServerPublicNetworkIPv4AddressIPv6NetworkCreateServerResponseServerCreatePublicNetworkResetPasswordResponseEnableRescueResponseRequestConsoleResponse
- SSHKeysClient
- StorageBoxTypesClient
- StorageBoxesClient
StorageBoxesClientStorageBoxesClient.actionsStorageBoxesClient.change_protection()StorageBoxesClient.change_subaccount_home_directory()StorageBoxesClient.change_type()StorageBoxesClient.create()StorageBoxesClient.create_snapshot()StorageBoxesClient.create_subaccount()StorageBoxesClient.delete()StorageBoxesClient.delete_snapshot()StorageBoxesClient.delete_subaccount()StorageBoxesClient.disable_snapshot_plan()StorageBoxesClient.enable_snapshot_plan()StorageBoxesClient.get_actions()StorageBoxesClient.get_actions_list()StorageBoxesClient.get_all()StorageBoxesClient.get_by_id()StorageBoxesClient.get_by_name()StorageBoxesClient.get_folders()StorageBoxesClient.get_list()StorageBoxesClient.get_snapshot_all()StorageBoxesClient.get_snapshot_by_id()StorageBoxesClient.get_snapshot_by_name()StorageBoxesClient.get_snapshot_list()StorageBoxesClient.get_subaccount_all()StorageBoxesClient.get_subaccount_by_id()StorageBoxesClient.get_subaccount_by_name()StorageBoxesClient.get_subaccount_by_username()StorageBoxesClient.get_subaccount_list()StorageBoxesClient.reset_password()StorageBoxesClient.reset_subaccount_password()StorageBoxesClient.rollback_snapshot()StorageBoxesClient.update()StorageBoxesClient.update_access_settings()StorageBoxesClient.update_snapshot()StorageBoxesClient.update_subaccount()StorageBoxesClient.update_subaccount_access_settings()
StorageBoxesPageResultStorageBoxSnapshotsPageResultStorageBoxSubaccountsPageResultBoundStorageBoxBoundStorageBox.change_protection()BoundStorageBox.change_type()BoundStorageBox.create_snapshot()BoundStorageBox.create_subaccount()BoundStorageBox.delete()BoundStorageBox.disable_snapshot_plan()BoundStorageBox.enable_snapshot_plan()BoundStorageBox.get_actions()BoundStorageBox.get_actions_list()BoundStorageBox.get_folders()BoundStorageBox.get_snapshot_all()BoundStorageBox.get_snapshot_by_id()BoundStorageBox.get_snapshot_by_name()BoundStorageBox.get_snapshot_list()BoundStorageBox.get_subaccount_all()BoundStorageBox.get_subaccount_by_id()BoundStorageBox.get_subaccount_by_name()BoundStorageBox.get_subaccount_by_username()BoundStorageBox.get_subaccount_list()BoundStorageBox.modelBoundStorageBox.reset_password()BoundStorageBox.rollback_snapshot()BoundStorageBox.update()BoundStorageBox.update_access_settings()
BoundStorageBoxSnapshotBoundStorageBoxSubaccountStorageBoxStorageBoxAccessSettingsStorageBoxSnapshotPlanStorageBoxStatsStorageBoxStatusStorageBoxSnapshotStorageBoxSnapshotStatsStorageBoxSubaccountStorageBoxSubaccountAccessSettingsCreateStorageBoxResponseCreateStorageBoxSnapshotResponseCreateStorageBoxSubaccountResponseStorageBoxFoldersResponseDeleteStorageBoxResponseDeleteStorageBoxSnapshotResponseDeleteStorageBoxSubaccountResponse
- VolumesClient
VolumesClientVolumesClient.actionsVolumesClient.attach()VolumesClient.change_protection()VolumesClient.create()VolumesClient.delete()VolumesClient.detach()VolumesClient.get_actions()VolumesClient.get_actions_list()VolumesClient.get_all()VolumesClient.get_by_id()VolumesClient.get_by_name()VolumesClient.get_list()VolumesClient.resize()VolumesClient.update()
BoundVolumeVolumeCreateVolumeResponse
- ZonesClient
ZonesClientZonesClient.actionsZonesClient.add_rrset_records()ZonesClient.change_primary_nameservers()ZonesClient.change_protection()ZonesClient.change_rrset_protection()ZonesClient.change_rrset_ttl()ZonesClient.change_ttl()ZonesClient.create()ZonesClient.create_rrset()ZonesClient.delete()ZonesClient.delete_rrset()ZonesClient.export_zonefile()ZonesClient.get()ZonesClient.get_actions()ZonesClient.get_actions_list()ZonesClient.get_all()ZonesClient.get_list()ZonesClient.get_rrset()ZonesClient.get_rrset_all()ZonesClient.get_rrset_list()ZonesClient.import_zonefile()ZonesClient.remove_rrset_records()ZonesClient.set_rrset_records()ZonesClient.update()ZonesClient.update_rrset()ZonesClient.update_rrset_records()
BoundZoneBoundZone.add_rrset_records()BoundZone.change_primary_nameservers()BoundZone.change_protection()BoundZone.change_rrset_protection()BoundZone.change_rrset_ttl()BoundZone.change_ttl()BoundZone.create_rrset()BoundZone.delete()BoundZone.delete_rrset()BoundZone.export_zonefile()BoundZone.get_actions()BoundZone.get_actions_list()BoundZone.get_rrset()BoundZone.get_rrset_all()BoundZone.get_rrset_list()BoundZone.import_zonefile()BoundZone.modelBoundZone.remove_rrset_records()BoundZone.set_rrset_records()BoundZone.update()BoundZone.update_rrset()BoundZone.update_rrset_records()
BoundZoneRRSetBoundZoneRRSet.add_rrset_records()BoundZoneRRSet.change_rrset_protection()BoundZoneRRSet.change_rrset_ttl()BoundZoneRRSet.delete_rrset()BoundZoneRRSet.modelBoundZoneRRSet.remove_rrset_records()BoundZoneRRSet.set_rrset_records()BoundZoneRRSet.update_rrset()BoundZoneRRSet.update_rrset_records()
ZoneZoneAuthoritativeNameserversZonePrimaryNameserverZoneRecordZoneRRSetCreateZoneResponse
Exceptions
- class HCloudException[source]
There was an error while using the hcloud library.
All exceptions in the hcloud library inherit from this exception. It may be used as catch-all exception.
- class APIException(code: int | str, message: str, details: Any, *, correlation_id: str | None = None)[source]
There was an error while performing an API Request.
- class ActionException(action: Action | BoundAction)[source]
A generic action exception
- class ActionFailedException(action: Action | BoundAction)[source]
The pending action failed
- class ActionTimeoutException(action: Action | BoundAction)[source]
The pending action timed out