SCIM 2.0: Update user account
PATCH
Authorizationheader
Authorization<token>id*stringUser ID
Format
uuidUpdate user request
application/json- body
active?booleanActive is a ptr to prevent the empty value from being interpreted as false.
emails?array<>groups?array<unknown>id?stringmeta?name?schemas?array<string>userName?stringOK
application/scim+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 PATCH \ "$CODER_URL/scim/v2/Users/{id}" \ -H "Authorization: {Authorization}" \ -H "Content-Type: application/json" \ -d '{ "active": true, "emails": [ { "display": "string", "primary": true, "type": "string", "value": "[email protected]" } ], "groups": [ null ]}'const { CODER_URL } = process.env;const url = `${CODER_URL}/scim/v2/Users/{id}`;const response = await fetch(url, { method: "PATCH", headers: { Authorization: "{Authorization}", "Content-Type": "application/json", }, body: JSON.stringify({ active: true, emails: [ { display: "string", primary: true, type: "string", value: "[email protected]", }, ], groups: [null], }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/scim/v2/Users/{id}"response = requests.patch( url, headers={ "Authorization": "{Authorization}", }, json={ "active": True, "emails": [ { "display": "string", "primary": True, "type": "string", "value": "[email protected]", }, ], "groups": [ None, ], },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "active": true, "emails": [ { "display": "string", "primary": true, "type": "string", "value": "[email protected]" } ], "groups": [ null ]}`) url := os.Getenv("CODER_URL") + "/scim/v2/Users/{id}" req, err := http.NewRequest(http.MethodPatch, url, body) if err != nil { panic(err) } req.Header.Set("Authorization", "{Authorization}") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out))}Example Response200
{ "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"}