brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: unraid-api apikey --create makes a key with only the role a script needs

Unraid
~/tips/tip-unraid-api-apikey-create

unraid-api apikey --create

Create a separate Unraid API key per app with the smallest role that works.

Sooner or later a dashboard or a home automation wants to read the state of your Unraid server. Giving it the root password is the lazy option. The Unraid API has proper keys for this.

You can make one in the WebGUI under Settings > Management Access > API Keys, or from the terminal:

unraid-api apikey --create

Run it like that and it prompts you for a name, a description, roles and permissions. You can also pass them as options: --name, -d for the description, -r for a comma separated list of roles and -p for permissions. For example:

unraid-api apikey --create --name homepage -d "read-only dashboard" -r guest

The docs list three roles: admin for full access, connect for the remote access features, and guest for limited read access. For a dashboard that only shows array status and running containers, I’d start with guest and only move up when a query really fails.

The client then sends the key as a header with every GraphQL request:

"x-api-key": "YOUR_API_KEY"

One key per app is my rule. If one of them leaks, you revoke that key in the API Keys page and the rest keeps working.

The caveat is that the docs say it plainly: API keys provide system access. Keep them out of a compose file you push to a public Git repo, and rotate them now and then, as the docs also suggest.

Further reading: Unraid docs: CLI commands, Unraid docs: Using the Unraid API

More Unraid tips Change the RAID profile of a Unraid BTRFS pool with Balance Replace a disk in a redundant Unraid pool from the Main tab Test every Unraid drive with the DiskSpeed container See the XML behind a VM with the inline XML view in Unraid 7 Choose where a new VM's disk image is created with Unraid's storage override All Unraid tips (77) All topics

Link