Cant access api dosearch

I have created an api i can process every request except the do search where it return me this error User is not logged in [Privileges required: Get Encounters] . I am logged in with admin.

Can you point us the exact implementation of your api, ans the error stack trace?

https://pastebin.com/3kWyh7bd

Can you check that the user has the Get Encounters privilege?