# Jupyterhub API Token: How to get an authenticated token on a running single user server programmatically

**URL:** <https://discourse.jupyter.org/t/jupyterhub-api-token-how-to-get-an-authenticated-token-on-a-running-single-user-server-programmatically/14498>\
**Category:** JupyterHub\
**Tags:** jupyterhub, how-to\
**Created:** [June 7, 2022, 4:24am UTC](https://discourse.jupyter.org/t/jupyterhub-api-token-how-to-get-an-authenticated-token-on-a-running-single-user-server-programmatically/14498 "2022-06-07T04:24:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![naomi](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@naomi](https://discourse.jupyter.org/u/naomi)\
**Post date:** [June 7, 2022, 4:24am UTC](https://discourse.jupyter.org/t/jupyterhub-api-token-how-to-get-an-authenticated-token-on-a-running-single-user-server-programmatically/14498/1 "2022-06-07T04:24:20Z")

</div>

Hi,

What I want is to check user’s groups and read group members programmatically, with scopes I have set in roles.  
I don’t know if there is a proper way to do that, and I try to use API to request from the hub. And the problem is where I can get an authenticated API token with full access to the JupyterHub API for this.  
I have tried `$JUPYTERHUB_API_TOKEN` but it doesn’t work.  
One way is to get from the web page. But since We want do the checks programmatically and maybe in postStart lifehooks, how can I do it properly?

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![naomi](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@naomi](https://discourse.jupyter.org/u/naomi)\
**Post date:** [June 7, 2022, 4:52am UTC](https://discourse.jupyter.org/t/jupyterhub-api-token-how-to-get-an-authenticated-token-on-a-running-single-user-server-programmatically/14498/2 "2022-06-07T04:52:42Z")

</div>

I may found the solution, and [Understanding token scope difference](https://discourse.jupyter.org/t/understanding-token-scope-difference/10467) helps a lot.

```auto
c.JupyterHub.load_roles = [
 {
   'name': 'server',
   'scopes': ['all'],
 }
]

```
