Memos unofficial
PATCH/api/v1/users/{user}

Update a user

Updates a user's fields using a partial update. Supply the user resource name and an updateMask to select the fields being updated; the request body schema requires role, username, and state.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

3 parameters · 11 body fields
userstringrequired
The user resource name, in the format `users/{user}`.
updateMaskstringoptional
A field mask specifying which user fields to update.
allowMissingbooleanoptional
Set to true to allow updates to sensitive fields.

User fields for the update. The schema requires role, username, and state.

namestringoptional
The resource name of the user. Format: users/{user}
rolestringrequired
The role of the user.
Allowed:ROLE_UNSPECIFIEDADMINUSER
usernamestringrequired
Required. The unique username for login.
emailstringoptional
Optional. The email address of the user. Stored trimmed and lowercased; empty means no address. An address belongs to at most one user on the instance, so writes that would reuse one fail with ALREADY_EXISTS.
displayNamestringoptional
Optional. The display name of the user.
avatarUrlstringoptional
Optional. The avatar URL of the user.
descriptionstringoptional
Optional. The description of the user.
passwordstringoptional
Input only. The password for the user.
statestringrequired
The state of the user.
Allowed:STATE_UNSPECIFIEDNORMALARCHIVED
createTimestringoptional
Output only. The creation timestamp.
updateTimestringoptional
Output only. The last update timestamp.

2 status codes
200Returns the updated user object, including its role, username, state, and other user fields.
namestringoptional
The resource name of the user. Format: users/{user}
rolestringrequired
The role of the user.
Allowed:ROLE_UNSPECIFIEDADMINUSER
usernamestringrequired
Required. The unique username for login.
emailstringoptional
Optional. The email address of the user. Stored trimmed and lowercased; empty means no address. An address belongs to at most one user on the instance, so writes that would reuse one fail with ALREADY_EXISTS.
displayNamestringoptional
Optional. The display name of the user.
avatarUrlstringoptional
Optional. The avatar URL of the user.
descriptionstringoptional
Optional. The description of the user.
passwordstringoptional
Input only. The password for the user.
statestringrequired
The state of the user.
Allowed:STATE_UNSPECIFIEDNORMALARCHIVED
createTimestringoptional
Output only. The creation timestamp.
updateTimestringoptional
Output only. The last update timestamp.
defaultDefault error response
codeintegeroptional
The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
messagestringoptional
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
detailsarray<object>optional
A list of messages that carry the error details. There is a common set of message types for APIs to use.

Error handling

The request body requires role, username, and state; role must be ROLE_UNSPECIFIED, ADMIN, or USER, and state must be STATE_UNSPECIFIED, NORMAL, or ARCHIVED. The user path parameter uses the users/{user} resource format, and updateMask selects the fields to update; allowMissing controls whether sensitive fields can be updated.