How to shutdown orderly on SCALE via Websocket with JSON?

I’ve migrated from FreeNAS to TrueNAS Scale Community Edition 25.10.1. I’ve successfully modified my Alfred Workflow (Alfred is a shortcut app on macOS) to perform an orderly shutdown using the old RESTful API: curl -u user:‘pass’ -X POST http://IP_address_here/api/v2.0/system/shutdown/ -H ‘Content-Type: application/json’ -d ‘{“reason”:“manual shutdown”}’

Works flawlessly again… I’ve read however that the REST method is going to be deprecated beginngin with TrueNAS 26.04.

I’ve tried to replicate an orderly shutdown using Websocket, JSON and an API-Key for the user root, but somehow fail miserably.

Just one of many attempts I’ve made, which had ZERO effect:
printf ‘%s\n%s\n’
‘{“jsonrpc”:“2.0”,“id”:“login”,“method”:“auth.login_with_api_key”,“params”:[“lengthy-API-key-goes-here”]}’
‘{“jsonrpc”:“2.0”,“id”:“shutdown”,“method”:“system.shutdown”,“params”:[]}’
| websocat --insecure -H=“Origin:https://IP-address-of-NAS-here” wss://IP-address-of-NAS-here/websocket

I assume the problem lies in the authentication. Could someone explain me how to get this done properly and provide a working code snippet example?