Skip to content

docs: add section on how to retrieve user list #17798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cli+api steps
  • Loading branch information
EdwardAngert committed May 13, 2025
commit ad8edd09e6a408d65b273c0a88a94823387e09a2
34 changes: 22 additions & 12 deletions docs/admin/users/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,31 +207,41 @@ The following filters are supported:
RFC3339Nano format.
- `login_type` - Represents the login type of the user. Refer to the [LoginType documentation](https://pkg.go.dev/github.com/coder/coder/v2/codersdk#LoginType) for a list of supported values

## Use the Coder API to retrieve a list of users
## Retrieve your list of Coder users

Use the [Coder API](../../reference/api/users.md#get-users) to retrieve a full list of users on your Coder deployment:
<div class="tabs">

You can use the Coder CLI or API to retrieve your list of users.

### CLI

Use `users list` to export the list of users to a CSV file:

```shell
curl -X GET http://coder-server:8080/api/v2/users \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
coder users list > users.csv
```

You can also filter your results based on the `organization_id` with:
Visit the [users list](../../reference/cli/users_list.md) documentation for more options.

```shell
curl -X GET 'http://coder-server:8080/api/v2/users?organization_id=Example-Org' \
### API

Use [get users](../../reference/api/users.md#get-users):

```bash
curl -X GET http://coder-server:8080/api/v2/users \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```

### Export a list of users to a CSV file

You can use [jq](https://jqlang.org/) to process the JSON response and export the results to a CSV file:
To export the results to a CSV file, you can use [jq](https://jqlang.org/) to process the JSON response:

```shell
```bash
curl -X GET http://coder-server:8080/api/v2/users \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY' | \
jq -r '.users | (map(keys) | add | unique) as $cols | $cols, (.[] | [.[$cols[]]] | @csv)' > users.csv
```

Visit the [get users](../../reference/api/users.md#get-users) documentation for more options.

</div>