REST API: user associated with provided key

Is there a way to find out what user is associated with the provided API key?

Both user keys (obviously) and app keys have an associated user. Specifically I would like to find out if the associated user has admin privileges, but it would also be interesting to access the associated user settings data (as provided by /api/users).

Having said that, I just realised that I can just query /api/users, which will only work if the associated user has admin privileges, and "catch" any "Not Allowed" response as a sign that the key does not have admin privileges. That would be very Pythonic ( Easier to ask for forgiveness than permission), but there may be a cleaner solution.

You could perform a passive login with the API key, that should give you the current user details.

1 Like