Hetzner API calls (CLI)
Using the Hetzner Robot API from the Linux Command Line
Hetzner’s Robot API lets you access server information programmatically, such as your server list, IPs, and status. While it’s easy to view this data in the web interface, calling the same API from the command line requires a small but important setup.
This article shows how to authenticate correctly and get clean JSON output using curl and jq.
1. Robot API authentication (important!)
The Hetzner Robot API does not use your normal web login password.
Instead, you must create separate API credentials:
-
Log in to the Hetzner Robot interface
-
Go to Settings → Webservice / API
-
Create a Webservice user
-
Save the generated username and password (shown only once)
These credentials are used for all API calls.
2. Calling the API with curl
Once you have API credentials, you can query the server list:
This returns a JSON array containing your servers and their metadata.
3. Removing curl’s progress output
If you pipe the output to jq, you may see extra lines like transfer statistics.
This is curl’s progress meter, not HTTP headers.
To suppress it, use silent mode:
Recommended for scripts (silent, but still shows errors):
4. Extracting specific fields with jq
For example, to show only the server name and IP address:
This produces clean, minimal JSON suitable for automation or monitoring.
Conclusion
-
Use Robot API credentials, not your Hetzner web login
-
Add
-sor-sSto remove curl’s progress output -
Pipe responses into
jqfor clean parsing -
Perfect for scripts, cron jobs, and infrastructure tooling
That’s all you need to start working with the Hetzner Robot API from the command line
More documentation:
https://robot.hetzner.com/doc/webservice/en.html#server