@julian maybe I wasn't clear. I'm cool with the logged in user to see this new custom page, as long as is logged in. The thing is that, I also need the API endpoint to be avialable for users logged in, or anyone that is not on a browser and querying this through API.
Similar as how the nodebb read / write API does, you have the endpoints, you can see the jsons in the browser if you are logged in, or you can query this endpoints with POSTMAN for example, but you need to provide a token to authenticate the API call.
My custom page API endpoint is public, and I need it not to be public. And I need to find a way that only loggedin users in the browser, or external call to the API authenticate throught tokens can see the json output.