What does your API user config look like? Don’t forget to redact the password
Specifically, I want to see the API perms.
Usually located in /etc/icinga2/conf.d/api-users.conf
I would also verify that it’s not something silly like putting the creds in twice and mis-typing the creds to one of your calls.
PS, you can format your code with triple back-ticks. See this post for some formatting tips