How to call default API endpoint in custom plugin?

I tried using request and get same result.
I get 401 response and get logged-out from the admin ui.