Different API response to logged in and other users

I am using the nextjs-auth0 SDK and it works well. Thanks for the neatly packaged API.

I wrap my APIs with withApiAuthRequired and use getSession within them to identify the user who is making the API request. This is working well.
There is an API which is intended to be invoked by both logged-in users as well as visitors. Hence I do not use the withApiAuthRequired for this. However, the API is expected to return different data depending on whether there is a user logged in or not. It looks like I cannot use getSession within an API that’s not wrapped with withApiAuthRequired. Is there any other way I can find out whether the API is being invoked by a visitor or a loggedin user?