- [HTTP request](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#body.request_body)
- [Response body](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#body.aspect)
- [Examples](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#examples)
- [Try it!](https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users/update#try-it)

Updates an existing user in a Cloud SQL instance.

### HTTP request

`PUT https://sqladmin.googleapis.com/v1/projects/{project}/instances/{instance}/users`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `project` | `string` Project ID of the project that contains the instance. |
| `instance` | `string` Database instance ID. This does not include the project ID. |

### Query parameters

| Parameters ||
|---|---|
| `host` | `string` Optional. Host of the user in the instance. |
| `name` | `string` Name of the user in the instance. |
| `databaseRoles[]` | `string` Optional. users.list of database roles to grant to the user. body.database_roles will be ignored for update request. |
| `revokeExistingRoles` | `boolean` Optional. Specifies whether to revoke existing roles that are not present in the `databaseRoles` field. If `false` or unset, the database roles specified in `databaseRoles` are added to the user's existing roles. |

### Request body

The request body contains an instance of `https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/users#User`.

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/sql/docs/postgres/admin-api/rest/v1/operations#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloudsql`
- `
  https://www.googleapis.com/auth/cloud-platform`
- `
  https://www.googleapis.com/auth/sqlservice.admin`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).