Create new user
POST
CoderSessionTokenheader
Coder-Session-Token<token>Create user request
application/json- body
email?stringFormat
emaillogin_type?stringUserLoginType defaults to LoginTypePassword.
Value in
"""password""github""oidc""token""none"name?stringorganization_ids?array<>OrganizationIDs is a list of organization IDs that the user should be a member of.
password?stringroles?array<string>Roles is an optional list of site-level roles to assign at creation.
service_account?booleanService accounts are admin-managed accounts that cannot login.
user_status?stringUserStatus defaults to UserStatusDormant. Service accounts default to UserStatusActive and can't be dormant.
Value in
"active""dormant""suspended"username*stringCreated
application/json- response
avatar_url?stringFormat
uricreated_at*stringFormat
date-timeemail*stringFormat
emailhas_ai_seat?booleanHasAISeat intentionally omits omitempty so the API always includes the field, even when false.
id*stringFormat
uuidis_service_account?booleanlast_seen_at?stringFormat
date-timelogin_type?codersdk.LoginTypeValue in
"""password""github""oidc""token""none"name?stringorganization_ids?array<>roles?array<>status?stringValue in
"active""suspended"theme_preference?stringDeprecated: this value should be retrieved from
codersdk.UserPreferenceSettings instead.
updated_at?stringFormat
date-timeusername*stringThe samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/api/v2/users" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "username": "string"}'Example Response201
{ "avatar_url": "http://example.com", "created_at": "2019-08-24T14:15:22Z", "email": "[email protected]", "has_ai_seat": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "is_service_account": true, "last_seen_at": "2019-08-24T14:15:22Z", "login_type": "", "name": "string", "organization_ids": [ "7d4232d7-54a0-4c93-9c1e-a8fd2dfcdabe" ], "roles": [ { "display_name": "string", "name": "string", "organization_id": "string" } ], "status": "active", "theme_preference": "string", "updated_at": "2019-08-24T14:15:22Z", "username": "string"}