{"id":25483706,"url":"https://github.com/rahatool/hetzner-cloud","last_synced_at":"2025-07-23T15:04:58.003Z","repository":{"id":150455432,"uuid":"210291275","full_name":"rahatool/hetzner-cloud","owner":"rahatool","description":"A native JavaScript integration for the Hetzner cloud to easily manage your resources.","archived":false,"fork":false,"pushed_at":"2024-06-06T19:36:45.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-05-18T13:11:47.068Z","etag":null,"topics":["api","client","cloud","hetzner"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahatool.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-23T07:27:58.000Z","updated_at":"2024-06-06T19:40:28.000Z","dependencies_parsed_at":"2024-06-06T21:08:20.107Z","dependency_job_id":null,"html_url":"https://github.com/rahatool/hetzner-cloud","commit_stats":null,"previous_names":["rahatool/hetzner-cloud"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rahatool/hetzner-cloud","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahatool%2Fhetzner-cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahatool%2Fhetzner-cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahatool%2Fhetzner-cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahatool%2Fhetzner-cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahatool","download_url":"https://codeload.github.com/rahatool/hetzner-cloud/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahatool%2Fhetzner-cloud/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266699565,"owners_count":23970514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","cloud","hetzner"],"created_at":"2025-02-18T17:47:40.942Z","updated_at":"2025-07-23T15:04:57.970Z","avatar_url":"https://github.com/rahatool.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hetzner Cloud API - JavaScript Client\r\nA native JavaScript integration for the Hetzner cloud to easily manage your resources.\r\n\r\n# Outline of APIs\r\n- [Server](#server-api)\r\n- [FloatingIP](#floatingip-api)\r\n- [SSHKey](#sshkey-api)\r\n- [Image](#image-api)\r\n- [Volume](#volume-api)\r\n- [Network](#network-api)\r\n- [ISO](#iso-api)\r\n- [Pricing](#pricing-api)\r\n- [ServerType](#servertype-api)\r\n- [Location](#location-api)\r\n- [Datacenter](#datacenter-api)\r\n- [Action](#action-api)\r\n\r\n# Installation\r\n## CDN\r\nImport library from the ESM.SH CDN for fast and easy setup:\r\n### In web browser\r\nSimply include `hetzner-cloud` in your html `\u003cheader\u003e` tag.\r\n```html\r\n\u003cscript type=\"module\"\u003e\r\nimport * as hetznerAPI from \"//esm.sh/gh/rahatool/hetzner-cloud\";\r\n\u003c/script\u003e\r\n```\r\n### In web worker\r\nIn order to be able to use hetzner-cloud in web workers, you need to import the source file as an ES6 module using:\r\n```javascript\r\nimport * as hetznerAPI from \"//esm.sh/gh/rahatool/hetzner-cloud\";\r\n```\r\n## NPM registry\r\nUse the package manager npm to install hetzner-cloud.\r\n```shell\r\n$ npm install github:rahatool/hetzner-cloud\r\n$ npm install npm:node-fetch\r\n```\r\nIf you want to run examples in Node.js runtime environment, you need to add below lines of code at the top of them.\r\n```javascript\r\nimport fetch from 'node-fetch';\r\nglobal.fetch = fetch;\r\n```\r\n## Direct Download\r\nGrab the [latest release](//github.com/rahatool/hetzner-cloud/archive/refs/heads/master.zip) file.\r\n\r\n# Implemented APIs\r\nFirst of all you have to register your api token. To obtain an api token go to your project on [Hetzner Cloud Console](//console.hetzner.cloud/projects) and navigate to access.\r\n```typescript\r\nimport {setAccessToken, Server, FloatingIP, SSHKey, Image, Volume, Network, ISO, Pricing, ServerType, Location, Datacenter, Action} from \"@raha.group/hetzner-cloud\";\r\n\r\nsetAccessToken('your api token');\r\n```\r\n## Server API\r\n### Skeleton of Server\r\n```typescript\r\nclass Server {\r\n\tstatic getAll(options?: {status?: enum {initializing, starting, running, stopping, off, deleting, rebuilding, migrating, unknown}, sort?: enum {id, name, created}, name?: String, label_selector?: Array}}): AsyncGeneratorFunction\u003cServer\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cServer\u003e;\r\n\r\n\t/*includes root_password\r\n\t@throws Error if placement_error*/\r\n\tsave(): Promise\u003cServer\u003e;\r\n\tdestroy(): Promise\u003cAction\u003e;\r\n\r\n\tmetrics(options: {type: enum {cpu, disk, network}, start: String, end: String, step?: Number}): Promise\u003cObject\u003e;\r\n\r\n\tpowerOn(): Promise\u003cAction\u003e;\r\n\t/*soft-reboot*/\r\n\treboot(): Promise\u003cAction\u003e;\r\n\t/*Cuts power to a server and starts it again. This forcefully stops it without giving the server operating system time to gracefully stop. This may lead to data loss, it’s equivalent to pulling the power cord and plugging it in again. Reset should only be used when reboot does not work.*/\r\n\treset(): Promise\u003cAction\u003e;\r\n\tshutdown(): Promise\u003cAction\u003e;\t\r\n\t/*Cuts power to the server. This forcefully stops it without giving the server operating system time to gracefully stop. May lead to data loss, equivalent to pulling the power cord. Power off should only be used when shutdown does not work.*/\r\n\tpowerOff(): Promise\u003cAction\u003e;\r\n\t\r\n\tresetPassword(): Promise\u003c{root_password: String, action: Action}\u003e;\r\n\t\r\n\t/*@throws Error if rescue_already_enabled.*/\r\n\tenableRescue(options?: {type?: enum {linux64, linux32, freebsd64}, ssh_keys?: Array}): Promise\u003c{root_password: String, action: Action}\u003e;\r\n\t/*@throws Error if rescue_already_disabled*/\r\n\tdisableRescue(): Promise\u003cAction\u003e;\r\n\t\r\n\tcreateImage(options?: {description?: String, type?: enum {snapshot, backup}, labels?: Object}): Promise\u003c{image: Image, action: Action}\u003e;\r\n\tenableBackup(): Promise\u003cAction\u003e;\r\n\tdisableBackup(): Promise\u003cAction\u003e;\r\n\t\r\n\trebuild(options: {image: String}): Promise\u003c{root_password: String, action: Action}\u003e;\r\n\t/*@throws Error if server_not_stopped or invalid_server_type.*/\r\n\tchangeType(options: {upgrade_disk: Boolean, server_type: String}): Promise\u003cAction\u003e;\r\n\t\r\n\tattachISO(options: {iso: String}): Promise\u003cAction\u003e;\r\n\tdetachISO(): Promise\u003cAction\u003e;\r\n\t\r\n\tchangeReverseDNS(options: {ip: String, dns_ptr: String}): Promise\u003cAction\u003e;\r\n\t\r\n\tchangeProtection(options: {delete?: Boolean, rebuild?: Boolean}): Promise\u003cAction\u003e;\r\n\t\r\n\trequestConsole(): Promise\u003c{wss_url: String, password: String, action: Action}\u003e;\r\n\t\r\n\tattachToNetwork(options: {network: Number, ip?: String, alias_ips?: Array}): Promise\u003cAction\u003e;\r\n\tdetachFromNetwork(options: {network: Number}): Promise\u003cAction\u003e;\r\n\t\r\n\tchangeAliasIPs(options: {network, Number, alias_ips: Array}): Promise\u003cAction\u003e;\r\n\r\n\tactions(options?: {status: enum {running, success, error}, sort: enum {id, command, status, progress, started, finished}}): AsyncGeneratorFunction\u003cAction\u003e;\r\n}\r\n```\r\n\r\n### Usage of Server\r\n```typescript\r\n// Create a Server\r\nlet resource = new Server;\r\nresource.populate({\r\n\tname: String, \r\n\tserver_type: String, \r\n\tstart_after_create?: Boolean,\r\n\timage: String, \r\n\tssh_keys?: Array,\r\n\tvolumes?: Array,\r\n\tnetworks?: Array,\r\n\tuser_data?: String,\r\n\tlabels?: Object,\r\n\tautomount?: Boolean,\r\n\tlocation?: String,\r\n\tdatacenter?: String,\r\n});\r\nawait resource.save();\r\n\r\n// Update a Server\r\nlet resource = new Server;\r\nresource.populate({\r\n\tid: Number,\r\n\tname?: String,\r\n\tlabels?: Object,\r\n}).save();\r\n\r\n// Delete a Server\r\nlet resource = await Server.get(id);\r\nawait resource.destroy();\r\n\r\n// Get a Server\r\nlet resource = await Server.get(id);\r\n// await resource.action(parameters);\r\n\r\n// Get all Servers\r\nfor await (let resource of Server.getAll({name: 'test', label_selector: ['k', '!k', 'k in (v1,v2,v3)', 'k notin (v1,v2,v3)']})) {\r\n\tconsole.log(resource);\r\n\tfor await (let action of resource.actions({status: 'error', sort: 'started:desc'})) {\r\n\t\tconsole.log(action);\r\n\t}\r\n}\r\n```\r\n\r\n## FloatingIP API\r\n### Skeleton of FloatingIP\r\n```typescript\r\nclass FloatingIP {\r\n\tstatic getAll(options?: {sort?: enum {id, created}, label_selector?: String}): AsyncGeneratorFunction\u003cFloatingIP\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cFloatingIP\u003e;\r\n\r\n\tsave(): Promise\u003cFloatingIP\u003e;\r\n\tdestroy(): Promise\u003cAction\u003e;\r\n\t\r\n\tassign(options?: {server: Number}): Promise\u003cAction\u003e;\r\n\tunassign(): Promise\u003cAction\u003e;\r\n\tchangeReverseDNS(options?: {ip: String, dns_ptr: String}): Promise\u003cAction\u003e\r\n\t\r\n\tchangeProtection(options: {delete?: Boolean}): Promise\u003cAction\u003e;\r\n\tactions(options?: {status: enum {running, success, error}, sort: enum {id, command, status, progress, started, finished}}): AsyncGeneratorFunction\u003cAction\u003e;\r\n}\r\n```\r\n\r\n### Usage of FloatingIP\r\n```typescript\r\n// Create a FloatingIP\r\nlet resource = new FloatingIP;\r\nresource.populate({\r\n\ttype: enum {ipv4, ipv6},\r\n\tserver?: Number,\r\n\thome_location?: String,\r\n\tdescription?: String,\r\n\tlabels?: Object,\r\n});\r\nawait resource.save();\r\n\r\n// Update a FloatingIP\r\nlet resource = new FloatingIP;\r\nresource.populate({\r\n\tid: Number,\r\n\tdescription?: String,\r\n\tlabels?: Object\r\n}).save();\r\n\r\n// Delete a FloatingIP\r\nlet resource = await FloatingIP.get(id);\r\nawait resource.destroy();\r\n\r\n// Get a FloatingIP\r\nlet resource = await FloatingIP.get(id);\r\n// await resource.action(parameters);\r\n```\r\n\r\n## SSHKey API\r\n### Skeleton of SSHKey\r\n```typescript\r\nclass SSHKey {\r\n\tstatic getAll(options?: {sort?: enum {id, name}, name?: String, fingerprint?: String, label_selector?: String}): AsyncGeneratorFunction\u003cSSHKey\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cSSHKey\u003e;\r\n\t\r\n\tsave(): Promise\u003cSSHKey\u003e;\r\n\tdestroy(): Promise\u003cVoid\u003e;\r\n}\r\n```\r\n### Usage of SSHKey\r\n```typescript\r\n// Create a SSHKey\r\nlet resource = new SSHKey;\r\nresource.populate({\r\n\tname: String,\r\n\tpublic_key: String\r\n});\r\nawait resource.save();\r\n\r\n// Update a SSHKey\r\nlet resource = new SSHKey;\r\nresource.populate({\r\n\tid: Number,\r\n\tname?: String,\r\n\tlabels?: Object\r\n}).save();\r\n\r\n// Delete a SSHKey\r\nlet resource = await SSHKey.get(id);\r\nawait resource.destroy();\r\n\r\n// Get a SSHKey\r\nlet resource = await SSHKey.get(id);\r\n// await resource.action(parameters);\r\n```\r\n\r\n## Image API\r\n### Skeleton of Image\r\n```typescript\r\nclass Image {\r\n\tstatic getAll(options?: {sort?: enum {id, name, created}, type?: {system, snapshot, backup}, status?: {available, creating}, bound_to?: String, name?: String, label_selector?: String}): AsyncGeneratorFunction\u003cImage\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cImage\u003e;\r\n\r\n\t/*@throws Error if request create image*/\r\n\tsave(): Promise\u003cImage\u003e;\r\n\tdestroy(): Promise\u003cAction\u003e;\r\n\r\n\tchangeProtection(options: {delete?: Boolean}): Promise\u003cAction\u003e;\r\n\r\n\tactions(options?: {status: enum {running, success, error}, sort: enum {id, command, status, progress, started, finished}}): AsyncGeneratorFunction\u003cAction\u003e;\r\n}\r\n```\r\n\r\n### Usage of Image\r\n```typescript\r\n// Note: The operation \"Create an Image\" is not available\r\n\r\n// Update an Image\r\nlet resource = new Image;\r\nresource.populate({\r\n\tid: Number,\r\n\tdescription?: String,\r\n\ttype?, enum {snapshot},\r\n\tlabels?: Object,\r\n}).save();\r\n\r\n// Delete an Image\r\nlet resource = await Image.get(id);\r\nawait resource.destroy();\r\n\r\n// Get an Image\r\nlet resource = await Image.get(id);\r\n// await resource.action(parameters);\r\n```\r\n\r\n## Volume API\r\n### Skeleton of Volume\r\n```typescript\r\nclass Volume {\r\n\tstatic getAll(options?: {status?: enum {available, creating}, sort: enum {id, name, created}, name?: String, label_selector?: String}): AsyncGeneratorFunction\u003cVolume\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cVolume\u003e;\r\n\t\r\n\tsave(): Promise\u003cVolume\u003e;\r\n\tdestroy(): Promise\u003cAction\u003e;\r\n\t\r\n\tattach(options: {server: Number, automount?: Boolean}): Promise\u003cAction\u003e;\r\n\tdetach(): Promise\u003cAction\u003e;\r\n\tresize(options: {size: Number}): Promise\u003cAction\u003e;\r\n\r\n\tchangeProtection(options: {delete?: Boolean}): Promise\u003cAction\u003e;\r\n\r\n\tactions(options?: {status: enum {running, success, error}, sort: enum {id, command, status, progress, started, finished}}): AsyncGeneratorFunction\u003cAction\u003e;\r\n}\r\n```\r\n### Usage of Volume\r\n```typescript\r\n// Create a Volume\r\nlet resource = new Volume;\r\nresource.populate({\r\n\tsize: Number,\r\n\tname: String,\r\n\tlabels?: Object,\r\n\tautomount?: Boolean,\r\n\tformat?: String,\r\n\tlocation?: String,\r\n\tserver?: Number\r\n});\r\nawait resource.save();\r\n\r\n// Update a Volume\r\nlet resource = new Volume;\r\nresource.populate({\r\n\tid: Number,\r\n\tname: String,\r\n\tlabels?: Object\r\n}).save();\r\n\r\n// Delete a Volume\r\nlet resource = await Volume.get(id);\r\nawait resource.destroy();\r\n\r\n// Get a Volume\r\nlet resource = await Volume.get(id);\r\n// await resource.action(parameters);\r\n```\r\n\r\n## Network API\r\n### Skeleton of Network\r\n```typescript\r\nclass Network {\r\n\tstatic getAll(options?: {name?: String, label_selector?: String}): AsyncGeneratorFunction\u003cNetwork\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cNetwork\u003e;\r\n\t\r\n\tsave(): Promise\u003cNetwork\u003e;\r\n\tdestroy(): Promise\u003cAction\u003e;\r\n\t\r\n\taddSubnet(options: {type: String, ip_range?: String, network_zone?: String}): Promise\u003cAction\u003e;\r\n\tdeleteSubnet(options: {ip_range: String}): Promise\u003cAction\u003e;\r\n\taddRoute(options: {destination: String, gateway, String}): Promise\u003cAction\u003e;\r\n\tdeleteRoute(options: {destination: String, gateway: String}): Promise\u003cAction\u003e;\r\n\tchangeIPRange(options: {ip_range: String}): Promise\u003cAction\u003e;\r\n\r\n\tchangeProtection(options: {delete?: Boolean}): Promise\u003cAction\u003e;\r\n\r\n\tactions(options?: {status: enum {running, success, error}, sort: enum {id, command, status, progress, started, finished}}): AsyncGeneratorFunction\u003cAction\u003e;\r\n}\r\n```\r\n### Usage of Network\r\n```typescript\r\n// Create a Network\r\nlet resource = new Network;\r\nresource.populate({\r\n\tname: String,\r\n\tip_range: String,\r\n\tlabels?: Object,\r\n\tsubnets?: Array,\r\n\troutes?: Array,\r\n});\r\nawait resource.save();\r\n\r\n// Update a Network\r\nlet resource = new Network;\r\nresource.populate({\r\n\tid: Number,\r\n\tname?: String,\r\n\tlabels?: Object,\r\n}).save();\r\n\r\n// Delete a Network\r\nlet resource = await Network.get(id);\r\nawait resource.destroy();\r\n\r\n// Get a Network\r\nlet resource = await Network.get(id);\r\n// await resource.action(parameters);\r\n```\r\n\r\n## ISO API\r\nISOs are Read-Only images of DVDs\r\n### Skeleton of ISO\r\n```typescript\r\nclass ISO {\r\n\tstatic getAll(options?: {name?: String}): AsyncGeneratorFunction\u003cISO\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cISO\u003e;\r\n}\r\n```\r\n\r\n## Pricing API\r\n### Skeleton of Pricing\r\n```typescript\r\nclass Pricing {\r\n\tstatic getAll(options?: {name?: String}): AsyncGeneratorFunction\u003cPricing\u003e;\r\n}\r\n```\r\n\r\n## ServerType API\r\n### Skeleton of ServerType\r\n```typescript\r\nclass ServerType {\r\n\tstatic getAll(options?: {name?: String}): AsyncGeneratorFunction\u003cServerType\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cServerType\u003e;\r\n}\r\n```\r\n\r\n## Location API\r\n### Skeleton of Location\r\n```typescript\r\nclass Location {\r\n\tstatic getAll(options?: {name?: String}): AsyncGeneratorFunction\u003cLocation\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cLocation\u003e;\r\n}\r\n```\r\n\r\n## Datacenter API\r\n### Skeleton of Datacenter\r\n```typescript\r\nclass Datacenter {\r\n\tstatic getAll(options?: {name?: String}): AsyncGeneratorFunction\u003cDatacenter\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cDatacenter\u003e;\r\n}\r\n```\r\n\r\n## Action API\r\n### Skeleton of Action\r\n```typescript\r\nclass Action {\r\n\tstatic getAll(options?: {status?: enum {running, success, error}, sort?: enum {id, command, status, progress, started, finished}}): AsyncGeneratorFunction\u003cAction\u003e;\r\n\tstatic get(identifier: Number): Promise\u003cAction\u003e;\r\n}\r\n```\r\n\r\n# Supported Engines\r\nThis project has been tested and works on the following engines:\r\n- Chrome (desktop \u0026 Android)\r\n- Firefox\r\n- Opera\r\n- Safari 12+ (desktop \u0026 iOS)\r\n- Node.js 10+\r\n\r\n# License\r\nThis project by [Raha Group](//raha.group) is licensed under the [CC-BY-SA-4.0 License](//creativecommons.org/licenses/by-sa/4.0/).\r\n\r\n# Resources\r\n[Official Hetzner Cloud API documentation](//docs.hetzner.cloud/)\r\n\r\n# Stay connected\r\nStay in touch with Raha’s community and keep track of development and community news by subscribing to the Raha’s [Blog](//raha.group) and [YouTube channel](//youtube.com/channel/UC0bWOBL-vMPCwT6nI9Cz1yw).\r\n\r\n## Documentation\r\nThe official docs are a great place to discover new things.\r\n\r\n## Issue Tracker\r\nAre you experiencing problems with Raha? [report issues](//groups.google.com/d/forum/rahagroup) and find solutions to your problems here. \r\n\r\n## Feature Request\r\nYou are always welcome to ask for more features to be added to Raha.\r\n\r\n## Events\r\nStay up to date with meetups, conferences and more.\r\n\r\n## Support\r\nLooking for help? please first check out the official (mentioned above) and unofficial (e.g. [Stack Overflow](//stackoverflow.com/questions/tagged/raha)) resources. If you are still experiencing problems, feel free to create a new issue.\r\n\r\n# Donation\r\nIf you'd like Raha to grow even stronger, please become a sponsor today by donating via Paypal [![Donate][paypal-image]][paypal-url] *(Farnood)* to support Raha's ongoing maintenance and development of new functionality.\r\n\r\n[paypal-image]: https://img.shields.io/badge/paypal-donate-brightgreen.svg\r\n[paypal-url]: //paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=RZC8HCR5SPGQY\u0026item_name=Contribute+to+Raha%27s+ongoing+maintenance+and+development\u0026currency_code=USD\u0026source=url","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahatool%2Fhetzner-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahatool%2Fhetzner-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahatool%2Fhetzner-cloud/lists"}