Cannot Validate API Key

I am trying to use the proxmox truenas plugin and I keep failing the API key validation. I have reset the API key for my user as well as recreated a new user and it still fails the authentication process. I am trying to ensure my API Key is valid outside of the plugin but I can’t seem to find the appropriate documentation on how to test this out. Any guidance on how I can verify my API Key?

quick way to see if the key itself is fine:

curl -k -H “Authorization: Bearer YOURKEY” https://TRUENAS_IP/api/v2.0/system/info

json back = key works. 401 = recreate it under Credentials > Users for that user and check the account isnt disabled. plugin side still fails after a good curl usually means tls/hostname mismatch (self signed) so point it at the same host the cert uses or flip skip-verify if the plugin has that.

OK I tried a similar command:
curl -v -k "https://<IP ADDRESS>/api/v2.0/system/info" -H "Authorization: Bearer <APIKEY>"

And I get a 404 error. Does that mean my server has an issue?

  • Connection #0 to host <IP ADDRESS> left intact
    404: Not Found

What happens if you visit https://<TRUENAS IP>/api/v2.0/system/info in a browser window?
You should get 401: Unauthorized back.

Also, can you please say what version of TrueNAS you’re running?

I was running 25.10.5 but I thought I might be missing something so I updated and now I’m at 26.0.0-BETA.3.

When I go to url you specify it gives me a 404 not found error

REST API is deprecated in 26. Use the websocket API.

And how do I validate a websocket api key? My issue is the proxmox TrueNAS plugin is failing authentication against the api key but I can’t tell why. I need to validate it but I can’t seem to figure out how to confirm if my server is responding to API calls correctly

Make sure you’re using the recent first-party integration. Also make sure you’re connecting over WSS (insecure connections will invalidate the key).

yeah on 26 that /api/v2.0 path is gone so the 404 is expected. from a shell on the box u can poke the key over websocket:

midclt --uri wss://127.0.0.1/api/current --insecure -K YOURKEY call system.info

json back = key is fine. then the proxmox side needs the recent first party plugin on wss (old rest curl path wont talk to 26).

Ok I think my system has something borked. I am getting an error stating:

Failed to run middleware call. Daemon not running?

I restarted the middlewared service and it still producing that message and I am not seeing any errors in the middleware.log file. Looks like another rabbit hole to figure out why this isn’t working properly. I also tried using Home Assistant to connect using the API and it failed to connect as well. Arrgh!!! always something throwing me for a loop.

Hmm… have you been modifying base install from shell or granted an AI agent shell access? You can stop middlewared process and then start it in interactive mode typing middlewared in shell. If its in a crash loop sometimes you’ll get info out of stdout on screen that you wouldn’t see in log necessarily. If you’ve been modifying base install, your only course may be to back up your config file (assuming its healthy) and reinstall (you can run truenas_verify command to generate a list of discrepancies between your current install and what is there by default).

No modification to the base install. Although I have been upgrading this system since it was FreeNAS. So something must have messed up and never been detected until I tried to use the API. middlewared isn’t showing any errors in the logs as far as I can tell and truenas_verify found 0 descrepencies. I think I may just go about and do a clean install and import my pools.

I did spin up a truenas VM and ran tests against that system and it worked perfectly. My issue seems to be a messed up install and I can’t see any logs indicating a problem. d

Thanks everyone for the help. At least I know why I was hitting a wall everytime.