---
id: auth-api-listusers
title: 'listUsers()'
slug: /auth-api-listusers
custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml
---

import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'

Get a list of users.

This function should only be called on a server. Never expose your `service_role` key in the browser.

```js
const { data: user, error } = await supabase.auth.api.listUsers()
```

## Notes

- Requires a `service_role` key.
- This function should be called on a server. Never expose your `service_role` key in the browser.

## Examples

### Get a full list of users.

```js
const { data: user, error } = await supabase.auth.api.listUsers()
```
