Trouble with API Authentication in Nagios xi

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
Claying1957
Posts: 1
Joined: Fri Mar 07, 2025 3:05 am

Trouble with API Authentication in Nagios xi

Post by Claying1957 »

I’m having trouble with Nagios xi API authentication. I’ve set up the API key and user with permissions, but I’m getting a 401 Unauthorized error when trying to use a curl command.

Here’s the command I’m using:

Code: Select all

curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
I’ve double-checked the API key and user permissions, but no luck. Any suggestions?
sgardil
Posts: 326
Joined: Wed Aug 09, 2023 9:58 am

Re: Trouble with API Authentication in Nagios xi

Post by sgardil »

Claying1957 wrote: Fri Mar 07, 2025 3:08 am I’m having trouble with Nagios xi API authentication. I’ve set up the API key and user with permissions, but I’m getting a 401 Unauthorized error when trying to use a curl command.

Here’s the command I’m using:

Code: Select all

curl -X GET 'https://<your_nagios_xi_server>/nagiosxi/api/v1/objects/hosts?apikey=<your_api_key>'
I’ve double-checked the API key and user permissions, but no luck. Any suggestions?
I think the issue is your searching for hosts and not host. That should fix it for you unless you want to pull for hoststatus. I would link to a pdf doc for further information but inside of xi in the help section, there are some pretty good docs for API endpoints and the structure. Have them grab the host section or modify the script to just be host and see if that works.