Skip to main content
Question

Get user role (admin, co-admin, user) from Python SDK

  • May 22, 2025
  • 2 replies
  • 26 views

Forum|alt.badge.img

I am trying to get the user role via the Python SDK. My use case is that I need to identify the admin user, and any co-admins. Using the standard user().get() approach, I get all of the users information, but role is not included in that. I have read in a couple of places that the type field should indicate the users role, but for verified admin and co-admin accounts, it simply says 'user'.

 

Is there a way to see what role the retrieved user has (admin, co-admin, user)? 

2 replies

Forum|alt.badge.img

 The `role` field is not returned from the API by default; if you want to request it, you can do so using the `fields` parameter of `get()` like this:

 

client.user().get(fields=['id', 'name', 'login', 'role'])

Note that when you specify fields, you will need to specify every field you need.  If you just specify `role`, you won't get any of the normal user fields back from the API.


Forum|alt.badge.img

Yup, that looks to be what I'm looking for, thanks!