Does the user you made the API key for, have access to ‘Monitoring’ of this environment and API rights? See Environments > Permissions > Select environment in dropdown > Monitoring checkbox.
*UPDATE*
I see the problem now. You are sending the credentials as parameters, but you need to send them as headers.
Hi Vijaykumar,
If your requirement is to make the logs visible in the application for administrators, you can use Logging module from Mendix marketplace. https://marketplace.mendix.com/link/component/113006