How can i get the current user

The HTTP API in the document seems useless,and it always return "User not found " no matter which api key I used

One option can be the grafana_user cookie (of course if you need it in the browser).

But I want to get the current user in my server or make it a variable in grafana,it does not work

It’s not clear what’s your use case and what do you want to achieve and where? Be more specific and pls provide steps to reproduce your problem.