Skip to content

Commit ad8edd0

Browse files
committed
cli+api steps
1 parent 4ffa1f8 commit ad8edd0

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

docs/admin/users/index.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,31 +207,41 @@ The following filters are supported:
207207
RFC3339Nano format.
208208
- `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
209209

210-
## Use the Coder API to retrieve a list of users
210+
## Retrieve your list of Coder users
211211

212-
Use the [Coder API](../../reference/api/users.md#get-users) to retrieve a full list of users on your Coder deployment:
212+
<div class="tabs">
213+
214+
You can use the Coder CLI or API to retrieve your list of users.
215+
216+
### CLI
217+
218+
Use `users list` to export the list of users to a CSV file:
213219

214220
```shell
215-
curl -X GET http://coder-server:8080/api/v2/users \
216-
-H 'Accept: application/json' \
217-
-H 'Coder-Session-Token: API_KEY'
221+
coder users list > users.csv
218222
```
219223

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

222-
```shell
223-
curl -X GET 'http://coder-server:8080/api/v2/users?organization_id=Example-Org' \
226+
### API
227+
228+
Use [get users](../../reference/api/users.md#get-users):
229+
230+
```bash
231+
curl -X GET http://coder-server:8080/api/v2/users \
224232
-H 'Accept: application/json' \
225233
-H 'Coder-Session-Token: API_KEY'
226234
```
227235

228-
### Export a list of users to a CSV file
229-
230-
You can use [jq](https://jqlang.org/) to process the JSON response and export the results to a CSV file:
236+
To export the results to a CSV file, you can use [jq](https://jqlang.org/) to process the JSON response:
231237

232-
```shell
238+
```bash
233239
curl -X GET http://coder-server:8080/api/v2/users \
234240
-H 'Accept: application/json' \
235241
-H 'Coder-Session-Token: API_KEY' | \
236242
jq -r '.users | (map(keys) | add | unique) as $cols | $cols, (.[] | [.[$cols[]]] | @csv)' > users.csv
237243
```
244+
245+
Visit the [get users](../../reference/api/users.md#get-users) documentation for more options.
246+
247+
</div>

0 commit comments

Comments
 (0)