2026-08-11 11:22:55 -04:00
---
# Code generated by make gen. DO NOT EDIT.
title : Users
---
<!-- DO NOT EDIT | GENERATED CONTENT -->
2023-01-11 14:08:04 +01:00
## Get users
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|------------|-------|--------------|----------|--------------|
2023-01-11 14:08:04 +01:00
| `q` | query | string | false | Search query |
| `after_id` | query | string(uuid) | false | After ID |
| `limit` | query | integer | false | Page limit |
| `offset` | query | integer | false | Page offset |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"count" : 0 ,
"users" : [
{
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
}
]
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.GetUsersResponse ](schemas.md#codersdkgetusersresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Create new user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`POST /api/v2/users`
2023-01-11 14:08:04 +01:00
> Body parameter
```json
{
2025-01-03 18:12:59 +05:00
"email" : "user@example.com" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"password" : "string" ,
2026-04-29 10:57:10 -04:00
"roles" : [
"string"
],
2026-03-11 10:19:08 -07:00
"service_account" : true ,
2025-01-03 18:12:59 +05:00
"user_status" : "active" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Parameters
2024-08-23 16:23:51 -05:00
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|------------------------------------------------------------------------------------|----------|---------------------|
2024-08-23 16:23:51 -05:00
| `body` | body | [codersdk.CreateUserRequestWithOrgs ](schemas.md#codersdkcreateuserrequestwithorgs ) | true | Create user request |
2023-01-11 14:08:04 +01:00
### Example responses
> 201 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|--------------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 201 | [Created ](https://tools.ietf.org/html/rfc7231#section-6.3.2 ) | Created | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Get authentication methods
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/authmethods \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/authmethods`
2023-01-11 14:08:04 +01:00
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"github" : {
2025-02-25 16:31:33 +01:00
"default_provider_configured" : true ,
2025-01-03 18:12:59 +05:00
"enabled" : true
},
"oidc" : {
"enabled" : true ,
"iconUrl" : "string" ,
"signInText" : "string"
},
"password" : {
"enabled" : true
},
"terms_of_service_url" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|--------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.AuthMethods ](schemas.md#codersdkauthmethods ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Check initial user created
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/first \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/first`
2023-01-11 14:08:04 +01:00
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"detail" : "string" ,
"message" : "string" ,
"validations" : [
{
"detail" : "string" ,
"field" : "string"
}
]
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|--------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.Response ](schemas.md#codersdkresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Create initial user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/first \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`POST /api/v2/users/first`
2023-01-11 14:08:04 +01:00
> Body parameter
```json
{
2025-01-03 18:12:59 +05:00
"email" : "string" ,
"name" : "string" ,
2026-04-03 09:52:52 -04:00
"onboarding_info" : {
"newsletter_marketing" : true ,
2026-04-03 11:35:37 -04:00
"newsletter_releases" : true
2026-04-03 09:52:52 -04:00
},
2025-01-03 18:12:59 +05:00
"password" : "string" ,
"trial" : true ,
"trial_info" : {
"company_name" : "string" ,
"country" : "string" ,
"developers" : "string" ,
"first_name" : "string" ,
"job_title" : "string" ,
"last_name" : "string" ,
"phone_number" : "string"
},
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|------------------------------------------------------------------------------|----------|--------------------|
2023-01-11 14:08:04 +01:00
| `body` | body | [codersdk.CreateFirstUserRequest ](schemas.md#codersdkcreatefirstuserrequest ) | true | First user request |
### Example responses
> 201 Response
```json
{
2025-01-03 18:12:59 +05:00
"organization_id" : "7c60d51f-b44e-4682-87d6-449835ea4de6" ,
"user_id" : "a169451c-8525-4352-b8ca-070dd449a1a5"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|--------------------------------------------------------------|-------------|--------------------------------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 201 | [Created ](https://tools.ietf.org/html/rfc7231#section-6.3.2 ) | Created | [codersdk.CreateFirstUserResponse ](schemas.md#codersdkcreatefirstuserresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Log out user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/logout \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`POST /api/v2/users/logout`
2023-01-11 14:08:04 +01:00
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"detail" : "string" ,
"message" : "string" ,
"validations" : [
{
"detail" : "string" ,
"field" : "string"
}
]
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|--------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.Response ](schemas.md#codersdkresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## OAuth 2.0 GitHub Callback
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/oauth2/github/callback \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/oauth2/github/callback`
2023-01-11 14:08:04 +01:00
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|-------------------------------------------------------------------------|--------------------|--------|
2023-01-11 14:08:04 +01:00
| 307 | [Temporary Redirect ](https://tools.ietf.org/html/rfc7231#section-6.4.7 ) | Temporary Redirect | |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2025-02-21 18:42:16 +01:00
## Get Github device auth
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2025-02-21 18:42:16 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/oauth2/github/device \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/oauth2/github/device`
2025-02-21 18:42:16 +01:00
### Example responses
> 200 Response
```json
{
"device_code" : "string" ,
"expires_in" : 0 ,
"interval" : 0 ,
"user_code" : "string" ,
"verification_uri" : "string"
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------|
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.ExternalAuthDevice ](schemas.md#codersdkexternalauthdevice ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2026-03-18 22:10:04 +00:00
## Get OIDC claims for the authenticated user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2026-03-18 22:10:04 +00:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/oidc-claims \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/oidc-claims`
2026-03-18 22:10:04 +00:00
### Example responses
> 200 Response
```json
{
"claims" : {}
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------|
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.OIDCClaimsResponse ](schemas.md#codersdkoidcclaimsresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-01-11 14:08:04 +01:00
## OpenID Connect Callback
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/oidc/callback \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/oidc/callback`
2023-01-11 14:08:04 +01:00
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|-------------------------------------------------------------------------|--------------------|--------|
2023-01-11 14:08:04 +01:00
| 307 | [Temporary Redirect ](https://tools.ietf.org/html/rfc7231#section-6.4.7 ) | Temporary Redirect | |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Get user by name
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}`
2023-01-11 14:08:04 +01:00
### Parameters
2023-10-09 11:47:57 -05:00
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|--------------------------|
2023-10-09 11:47:57 -05:00
| `user` | path | string | true | User ID, username, or me |
2023-01-11 14:08:04 +01:00
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Delete user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X DELETE http://coder-server:8080/api/v2/users/{ user} \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`DELETE /api/v2/users/{user}`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
2023-12-14 10:38:44 -07:00
### Responses
2024-08-05 13:10:56 -05:00
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|--------|
2024-08-05 13:10:56 -05:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | |
2023-12-14 10:38:44 -07:00
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2025-03-05 10:46:03 -07:00
## Get user appearance settings
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2025-03-05 10:46:03 -07:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /appearance \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/appearance`
2025-03-05 10:46:03 -07:00
### Parameters
| Name | In | Type | Required | Description |
|--------|------|--------|----------|----------------------|
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-04-07 14:30:10 +02:00
"terminal_font" : "" ,
2026-05-14 11:44:05 +07:00
"theme_dark" : "string" ,
"theme_light" : "string" ,
"theme_mode" : "" ,
2025-03-05 10:46:03 -07:00
"theme_preference" : "string"
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------|
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.UserAppearanceSettings ](schemas.md#codersdkuserappearancesettings ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-12-14 10:38:44 -07:00
## Update user appearance settings
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-12-14 10:38:44 -07:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /appearance \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/appearance`
2023-12-14 10:38:44 -07:00
> Body parameter
```json
{
2025-04-07 14:30:10 +02:00
"terminal_font" : "" ,
2026-05-14 11:44:05 +07:00
"theme_dark" : "light" ,
"theme_light" : "light" ,
"theme_mode" : "sync" ,
2025-01-03 18:12:59 +05:00
"theme_preference" : "string"
2023-12-14 10:38:44 -07:00
}
```
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------------------------------------------------------------------------------------------------------|----------|-------------------------|
2023-12-14 10:38:44 -07:00
| `user` | path | string | true | User ID, name, or me |
| `body` | body | [codersdk.UpdateUserAppearanceSettingsRequest ](schemas.md#codersdkupdateuserappearancesettingsrequest ) | true | New appearance settings |
### Example responses
> 200 Response
```json
{
2025-04-07 14:30:10 +02:00
"terminal_font" : "" ,
2026-05-14 11:44:05 +07:00
"theme_dark" : "string" ,
"theme_light" : "string" ,
"theme_mode" : "" ,
2025-03-05 10:46:03 -07:00
"theme_preference" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
2025-03-05 10:46:03 -07:00
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------|
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.UserAppearanceSettings ](schemas.md#codersdkuserappearancesettings ) |
2023-01-11 14:08:04 +01:00
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2024-01-30 16:02:21 -06:00
## Get autofill build parameters for user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2024-01-30 16:02:21 -06:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /autofill-parameters?template_id= string \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/autofill-parameters`
2024-01-30 16:02:21 -06:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|---------------|-------|--------|----------|--------------------------|
2024-01-30 16:02:21 -06:00
| `user` | path | string | true | User ID, username, or me |
| `template_id` | query | string | true | Template ID |
### Example responses
> 200 Response
```json
[
2025-01-03 18:12:59 +05:00
{
"name" : "string" ,
"value" : "string"
}
2024-01-30 16:02:21 -06:00
]
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|---------------------------------------------------------------------|
2024-01-30 16:02:21 -06:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | array of [codersdk.UserParameter ](schemas.md#codersdkuserparameter ) |
<h3 id="get-autofill-build-parameters-for-user-responseschema">Response Schema</h3>
Status Code **200**
| Name | Type | Required | Restrictions | Description |
2025-01-03 18:12:59 +05:00
|----------------|--------|----------|--------------|-------------|
2024-01-30 16:02:21 -06:00
| `[array item]` | array | false | | |
| `» name` | string | false | | |
| `» value` | string | false | | |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-01-11 14:08:04 +01:00
## Get user Git SSH key
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /gitsshkey \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/gitsshkey`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"created_at" : "2019-08-24T14:15:22Z" ,
"public_key" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"user_id" : "a169451c-8525-4352-b8ca-070dd449a1a5"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|----------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.GitSSHKey ](schemas.md#codersdkgitsshkey ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Regenerate user SSH key
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /gitsshkey \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/gitsshkey`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"created_at" : "2019-08-24T14:15:22Z" ,
"public_key" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"user_id" : "a169451c-8525-4352-b8ca-070dd449a1a5"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|----------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.GitSSHKey ](schemas.md#codersdkgitsshkey ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Create new session key
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/{ user} /keys \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`POST /api/v2/users/{user}/keys`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 201 Response
```json
{
2025-01-03 18:12:59 +05:00
"key" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|--------------------------------------------------------------|-------------|------------------------------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 201 | [Created ](https://tools.ietf.org/html/rfc7231#section-6.3.2 ) | Created | [codersdk.GenerateAPIKeyResponse ](schemas.md#codersdkgenerateapikeyresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Get user tokens
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /keys/tokens \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/keys/tokens`
2023-01-11 14:08:04 +01:00
### Parameters
2026-02-24 16:27:03 +01:00
| Name | In | Type | Required | Description |
|-------------------|-------|---------|----------|------------------------------------|
| `user` | path | string | true | User ID, name, or me |
| `include_expired` | query | boolean | false | Include expired tokens in the list |
2023-01-11 14:08:04 +01:00
### Example responses
> 200 Response
```json
[
2025-01-03 18:12:59 +05:00
{
2025-10-24 12:33:56 +01:00
"allow_list" : [
{
"id" : "string" ,
"type" : "*"
}
],
2025-01-03 18:12:59 +05:00
"created_at" : "2019-08-24T14:15:22Z" ,
"expires_at" : "2019-08-24T14:15:22Z" ,
"id" : "string" ,
"last_used" : "2019-08-24T14:15:22Z" ,
"lifetime_seconds" : 0 ,
"login_type" : "password" ,
"scope" : "all" ,
2025-09-26 11:56:34 +02:00
"scopes" : [
"all"
],
2025-01-03 18:12:59 +05:00
"token_name" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"user_id" : "a169451c-8525-4352-b8ca-070dd449a1a5"
}
2023-01-11 14:08:04 +01:00
]
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | array of [codersdk.APIKey ](schemas.md#codersdkapikey ) |
<h3 id="get-user-tokens-responseschema">Response Schema</h3>
Status Code **200**
2025-10-24 12:33:56 +01:00
| Name | Type | Required | Restrictions | Description |
|----------------------|----------------------------------------------------------|----------|--------------|---------------------------------|
| `[array item]` | array | false | | |
| `» allow_list` | array | false | | |
| `»» id` | string | false | | |
| `»» type` | [codersdk.RBACResource ](schemas.md#codersdkrbacresource ) | false | | |
| `» created_at` | string(date-time) | true | | |
| `» expires_at` | string(date-time) | true | | |
| `» id` | string | true | | |
| `» last_used` | string(date-time) | true | | |
| `» lifetime_seconds` | integer | true | | |
| `» login_type` | [codersdk.LoginType ](schemas.md#codersdklogintype ) | true | | |
| `» scope` | [codersdk.APIKeyScope ](schemas.md#codersdkapikeyscope ) | false | | Deprecated: use Scopes instead. |
| `» scopes` | array | false | | |
| `» token_name` | string | true | | |
| `» updated_at` | string(date-time) | true | | |
| `» user_id` | string(uuid) | true | | |
2023-01-11 14:08:04 +01:00
#### Enumerated Values
2026-08-24 10:43:45 +01:00
| Property | Value(s) |
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type` | `*` , `ai_gateway_key` , `ai_model_price` , `ai_provider` , `ai_seat` , `aibridge_interception` , `api_key` , `assign_org_role` , `assign_role` , `audit_log` , `boundary_log` , `boundary_usage` , `chat` , `chat_model_config` , `connection_log` , `crypto_key` , `debug_info` , `deployment_config` , `deployment_stats` , `file` , `group` , `group_member` , `idpsync_settings` , `inbox_notification` , `license` , `mcp_server_config` , `notification_message` , `notification_preference` , `notification_template` , `oauth2_app` , `oauth2_app_code_token` , `oauth2_app_secret` , `organization` , `organization_member` , `prebuilt_workspace` , `provisioner_daemon` , `provisioner_jobs` , `replicas` , `system` , `tailnet_coordinator` , `task` , `template` , `usage_event` , `user` , `user_secret` , `user_skill` , `webpush_subscription` , `workspace` , `workspace_agent_devcontainers` , `workspace_agent_resource_monitor` , `workspace_build_orchestration` , `workspace_dormant` , `workspace_proxy` |
| `login_type` | `github` , `oidc` , `password` , `token` |
| `scope` | `all` , `application_connect` |
2023-01-11 14:08:04 +01:00
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Create token API key
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/{ user} /keys/tokens \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`POST /api/v2/users/{user}/keys/tokens`
2023-01-11 14:08:04 +01:00
> Body parameter
```json
{
2025-10-09 14:53:08 +02:00
"allow_list" : [
{
"id" : "string" ,
"type" : "*"
}
],
2025-01-03 18:12:59 +05:00
"lifetime" : 0 ,
"scope" : "all" ,
2025-09-26 11:56:34 +02:00
"scopes" : [
"all"
],
2025-01-03 18:12:59 +05:00
"token_name" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|----------------------------------------------------------------------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
| `body` | body | [codersdk.CreateTokenRequest ](schemas.md#codersdkcreatetokenrequest ) | true | Create token request |
### Example responses
> 201 Response
```json
{
2025-01-03 18:12:59 +05:00
"key" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|--------------------------------------------------------------|-------------|------------------------------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 201 | [Created ](https://tools.ietf.org/html/rfc7231#section-6.3.2 ) | Created | [codersdk.GenerateAPIKeyResponse ](schemas.md#codersdkgenerateapikeyresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-03-02 09:39:38 -08:00
## Get API key by token name
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-03-02 09:39:38 -08:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /keys/tokens/{ keyname} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/keys/tokens/{keyname}`
2023-03-02 09:39:38 -08:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|-----------|------|----------------|----------|----------------------|
2023-03-02 09:39:38 -08:00
| `user` | path | string | true | User ID, name, or me |
| `keyname` | path | string(string) | true | Key Name |
### Example responses
> 200 Response
```json
{
2025-10-24 12:33:56 +01:00
"allow_list" : [
{
"id" : "string" ,
"type" : "*"
}
],
2025-01-03 18:12:59 +05:00
"created_at" : "2019-08-24T14:15:22Z" ,
"expires_at" : "2019-08-24T14:15:22Z" ,
"id" : "string" ,
"last_used" : "2019-08-24T14:15:22Z" ,
"lifetime_seconds" : 0 ,
"login_type" : "password" ,
"scope" : "all" ,
2025-09-26 11:56:34 +02:00
"scopes" : [
"all"
],
2025-01-03 18:12:59 +05:00
"token_name" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"user_id" : "a169451c-8525-4352-b8ca-070dd449a1a5"
2023-03-02 09:39:38 -08:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|----------------------------------------------|
2023-03-02 09:39:38 -08:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.APIKey ](schemas.md#codersdkapikey ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Get API key by ID
2023-01-11 14:08:04 +01:00
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /keys/{ keyid} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/keys/{keyid}`
2023-01-11 14:08:04 +01:00
### Parameters
2025-08-18 12:37:51 +10:00
| Name | In | Type | Required | Description |
|---------|------|----------------|----------|----------------------|
| `user` | path | string | true | User ID, name, or me |
| `keyid` | path | string(string) | true | Key ID |
2023-01-11 14:08:04 +01:00
### Example responses
> 200 Response
```json
{
2025-10-24 12:33:56 +01:00
"allow_list" : [
{
"id" : "string" ,
"type" : "*"
}
],
2025-01-03 18:12:59 +05:00
"created_at" : "2019-08-24T14:15:22Z" ,
"expires_at" : "2019-08-24T14:15:22Z" ,
"id" : "string" ,
"last_used" : "2019-08-24T14:15:22Z" ,
"lifetime_seconds" : 0 ,
"login_type" : "password" ,
"scope" : "all" ,
2025-09-26 11:56:34 +02:00
"scopes" : [
"all"
],
2025-01-03 18:12:59 +05:00
"token_name" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"user_id" : "a169451c-8525-4352-b8ca-070dd449a1a5"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|----------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.APIKey ](schemas.md#codersdkapikey ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Delete API key
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X DELETE http://coder-server:8080/api/v2/users/{ user} /keys/{ keyid} \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`DELETE /api/v2/users/{user}/keys/{keyid}`
2023-01-11 14:08:04 +01:00
### Parameters
2025-08-18 12:37:51 +10:00
| Name | In | Type | Required | Description |
|---------|------|----------------|----------|----------------------|
| `user` | path | string | true | User ID, name, or me |
| `keyid` | path | string(string) | true | Key ID |
2023-01-11 14:08:04 +01:00
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|-----------------------------------------------------------------|-------------|--------|
2023-01-11 14:08:04 +01:00
| 204 | [No Content ](https://tools.ietf.org/html/rfc7231#section-6.3.5 ) | No Content | |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2026-02-17 13:16:46 +00:00
## Expire API key
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2026-02-17 13:16:46 +00:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /keys/{ keyid} /expire \
-H 'Accept: */*' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/keys/{keyid}/expire`
2026-02-17 13:16:46 +00:00
### Parameters
| Name | In | Type | Required | Description |
|---------|------|----------------|----------|----------------------|
| `user` | path | string | true | User ID, name, or me |
| `keyid` | path | string(string) | true | Key ID |
### Example responses
> 404 Response
### Responses
| Status | Meaning | Description | Schema |
|--------|----------------------------------------------------------------------------|-----------------------|--------------------------------------------------|
| 204 | [No Content ](https://tools.ietf.org/html/rfc7231#section-6.3.5 ) | No Content | |
| 404 | [Not Found ](https://tools.ietf.org/html/rfc7231#section-6.5.4 ) | Not Found | [codersdk.Response ](schemas.md#codersdkresponse ) |
| 500 | [Internal Server Error ](https://tools.ietf.org/html/rfc7231#section-6.6.1 ) | Internal Server Error | [codersdk.Response ](schemas.md#codersdkresponse ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-06-30 08:38:48 -04:00
## Get user login type
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-06-30 08:38:48 -04:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /login-type \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/login-type`
2023-06-30 08:38:48 -04:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-06-30 08:38:48 -04:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"login_type" : ""
2023-06-30 08:38:48 -04:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------|
2023-06-30 08:38:48 -04:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.UserLoginType ](schemas.md#codersdkuserlogintype ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-01-11 14:08:04 +01:00
## Get organizations by user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /organizations \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/organizations`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
[
2025-01-03 18:12:59 +05:00
{
"created_at" : "2019-08-24T14:15:22Z" ,
2026-06-05 14:33:13 -05:00
"default_org_member_roles" : [
"string"
],
2025-01-03 18:12:59 +05:00
"description" : "string" ,
"display_name" : "string" ,
"icon" : "string" ,
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
"is_default" : true ,
"name" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z"
}
2023-01-11 14:08:04 +01:00
]
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|-------------------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | array of [codersdk.Organization ](schemas.md#codersdkorganization ) |
<h3 id="get-organizations-by-user-responseschema">Response Schema</h3>
Status Code **200**
2026-06-05 14:33:13 -05:00
| Name | Type | Required | Restrictions | Description |
|------------------------------|-------------------|----------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| `[array item]` | array | false | | |
| `» created_at` | string(date-time) | true | | |
| `» default_org_member_roles` | array | false | | Default org member roles are unioned into every member's effective roles at request time. Changes propagate to all members on the next request. |
| `» description` | string | false | | |
| `» display_name` | string | false | | |
| `» icon` | string | false | | |
| `» id` | string(uuid) | true | | |
| `» is_default` | boolean | true | | |
| `» name` | string | false | | |
| `» updated_at` | string(date-time) | true | | |
2023-01-11 14:08:04 +01:00
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Get organization by user and organization name
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /organizations/{ organizationname} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/organizations/{organizationname}`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------------------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
| `organizationname` | path | string | true | Organization name |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"created_at" : "2019-08-24T14:15:22Z" ,
2026-06-05 14:33:13 -05:00
"default_org_member_roles" : [
"string"
],
2025-01-03 18:12:59 +05:00
"description" : "string" ,
"display_name" : "string" ,
"icon" : "string" ,
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
"is_default" : true ,
"name" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.Organization ](schemas.md#codersdkorganization ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Update user password
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /password \
-H 'Content-Type: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/password`
2023-01-11 14:08:04 +01:00
> Body parameter
```json
{
2025-01-03 18:12:59 +05:00
"old_password" : "string" ,
"password" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|------------------------------------------------------------------------------------|----------|-------------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
| `body` | body | [codersdk.UpdateUserPasswordRequest ](schemas.md#codersdkupdateuserpasswordrequest ) | true | Update password request |
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|-----------------------------------------------------------------|-------------|--------|
2023-01-11 14:08:04 +01:00
| 204 | [No Content ](https://tools.ietf.org/html/rfc7231#section-6.3.5 ) | No Content | |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2025-11-28 16:50:59 +00:00
## Get user preference settings
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2025-11-28 16:50:59 +00:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /preferences \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/preferences`
2025-11-28 16:50:59 +00:00
### Parameters
| Name | In | Type | Required | Description |
|--------|------|--------|----------|----------------------|
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2026-05-12 10:09:34 +02:00
"agent_chat_send_shortcut" : "enter" ,
2026-05-07 20:15:28 +01:00
"code_diff_display_mode" : "auto" ,
2026-05-14 14:25:07 +01:00
"shell_tool_display_mode" : "auto" ,
2026-04-24 12:29:08 +01:00
"thinking_display_mode" : "auto"
2025-11-28 16:50:59 +00:00
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------|
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.UserPreferenceSettings ](schemas.md#codersdkuserpreferencesettings ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Update user preference settings
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2025-11-28 16:50:59 +00:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /preferences \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/preferences`
2025-11-28 16:50:59 +00:00
> Body parameter
```json
{
2026-05-12 10:09:34 +02:00
"agent_chat_send_shortcut" : "enter" ,
2026-05-07 20:15:28 +01:00
"code_diff_display_mode" : "auto" ,
2026-05-14 14:25:07 +01:00
"shell_tool_display_mode" : "auto" ,
2026-04-24 12:29:08 +01:00
"thinking_display_mode" : "auto"
2025-11-28 16:50:59 +00:00
}
```
### Parameters
| Name | In | Type | Required | Description |
|--------|------|--------------------------------------------------------------------------------------------------------|----------|-------------------------|
| `user` | path | string | true | User ID, name, or me |
| `body` | body | [codersdk.UpdateUserPreferenceSettingsRequest ](schemas.md#codersdkupdateuserpreferencesettingsrequest ) | true | New preference settings |
### Example responses
> 200 Response
```json
{
2026-05-12 10:09:34 +02:00
"agent_chat_send_shortcut" : "enter" ,
2026-05-07 20:15:28 +01:00
"code_diff_display_mode" : "auto" ,
2026-05-14 14:25:07 +01:00
"shell_tool_display_mode" : "auto" ,
2026-04-24 12:29:08 +01:00
"thinking_display_mode" : "auto"
2025-11-28 16:50:59 +00:00
}
```
### Responses
| Status | Meaning | Description | Schema |
|--------|---------------------------------------------------------|-------------|------------------------------------------------------------------------------|
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.UserPreferenceSettings ](schemas.md#codersdkuserpreferencesettings ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
2023-01-11 14:08:04 +01:00
## Update user profile
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /profile \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/profile`
2023-01-11 14:08:04 +01:00
> Body parameter
```json
{
2026-06-26 16:35:03 -06:00
"avatar_url" : "http://example.com" ,
2025-01-03 18:12:59 +05:00
"name" : "string" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|----------------------------------------------------------------------------------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
| `body` | body | [codersdk.UpdateUserProfileRequest ](schemas.md#codersdkupdateuserprofilerequest ) | true | Updated profile |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Get user roles
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{ user} /roles \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`GET /api/v2/users/{user}/roles`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Assign role to user
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /roles \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/roles`
2023-01-11 14:08:04 +01:00
> Body parameter
```json
{
2025-01-03 18:12:59 +05:00
"roles" : [
"string"
]
2023-01-11 14:08:04 +01:00
}
```
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------------------------------------------------------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
| `body` | body | [codersdk.UpdateRoles ](schemas.md#codersdkupdateroles ) | true | Update roles request |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Activate user account
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /status/activate \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/status/activate`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).
## Suspend user account
### Code samples
2026-07-15 14:07:09 -04:00
```sh
2023-01-11 14:08:04 +01:00
# Example request using curl
curl -X PUT http://coder-server:8080/api/v2/users/{ user} /status/suspend \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
2026-05-05 02:54:03 +05:00
`PUT /api/v2/users/{user}/status/suspend`
2023-01-11 14:08:04 +01:00
### Parameters
| Name | In | Type | Required | Description |
2025-01-03 18:12:59 +05:00
|--------|------|--------|----------|----------------------|
2023-01-11 14:08:04 +01:00
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
2025-01-03 18:12:59 +05:00
"avatar_url" : "http://example.com" ,
"created_at" : "2019-08-24T14:15:22Z" ,
"email" : "user@example.com" ,
2026-03-26 17:36:40 +07:00
"has_ai_seat" : true ,
2025-01-03 18:12:59 +05:00
"id" : "497f6eca-6276-4993-bfeb-53cbbbba6f08" ,
2026-03-17 15:36:20 -06:00
"is_service_account" : true ,
2025-01-03 18:12:59 +05:00
"last_seen_at" : "2019-08-24T14:15:22Z" ,
"login_type" : "" ,
"name" : "string" ,
"organization_ids" : [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"roles" : [
{
"display_name" : "string" ,
"name" : "string" ,
"organization_id" : "string"
}
],
"status" : "active" ,
"theme_preference" : "string" ,
"updated_at" : "2019-08-24T14:15:22Z" ,
"username" : "string"
2023-01-11 14:08:04 +01:00
}
```
### Responses
| Status | Meaning | Description | Schema |
2025-01-03 18:12:59 +05:00
|--------|---------------------------------------------------------|-------------|------------------------------------------|
2023-01-11 14:08:04 +01:00
| 200 | [OK ](https://tools.ietf.org/html/rfc7231#section-6.3.1 ) | OK | [codersdk.User ](schemas.md#codersdkuser ) |
To perform this operation, you must be authenticated. [Learn more ](authentication.md ).