How to make access an api with non-admin user

There are two APIs that I’m able to access in my local confluence server 7.13.7 setup. One is to get the list of all the spaces inside the confluence instance and the other one is a custom API endpoint that I made through a custom plugin.

The API that I’m using to get all the spaces inside a confluence instance is:

I can easily access this API and it is returning the expected results even when the API request is being made with a non-admin user.

But, the custom endpoint that I have made is only accessible through an admin access request. If I’m making a request through the non-admin account, it’s giving out a 401 error.

Is there any way to remove the restriction in the confluence instance so that I can access the API through normal accounts also or any other work around to make it work?