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