---
title: pydo.databases.update_user()
description: Update a Database User
product: Reference
url: https://docs.digitalocean.com/reference/pydo/reference/databases/update_user/
last_updated: "2026-11-06"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# pydo.databases.update_user()

Generated on 6 Nov 2026 from `pydo` version [`v0.45.0`](https://github.com/digitalocean/pydo/releases/tag/v0.45.0)

## Usage

```python
client.databases.update_user(
    database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
    username="app-01",
    body={
        "settings": {...},
    },
)
```

Returns `JSON` Raises `HttpResponseError`

## Description

To update an existing database user, send a PUT request to [`/v2/databases/{database_cluster_uuid}/users/{username}`](https://docs.digitalocean.com/reference/api/reference/databases/index.html.md#databases_update_user) with the desired settings.

**Note**: only `settings` can be updated via this type of request. If you wish to change the name of a user, you must recreate a new user.

For PostgreSQL clusters, you can update `settings.pg_allow_replication` to enable or disable replication privileges for the user. When omitted, the value defaults to `false`.

For Kafka and OpenSearch clusters, additional options can be configured in the `settings` object (for example, topic or index ACLs).

Updating users is supported for PostgreSQL, Kafka, and OpenSearch clusters. For other engines, the request returns a 422. MongoDB roles and database access are set with `settings.mongo_user_settings` when creating a user and cannot be changed afterward; recreate the user to apply different roles or databases.

The response will be a JSON object with a key called `user`. The value of this will be an object that contains the name of the updated database user, along with the `settings` object that has been updated.

## Parameters

`database_cluster_uuid` string required

A unique identifier for a database cluster.

`username` string required

The name of the database user.

`settings` object required

User settings that can be updated via the Update a Database User endpoint.
Supported for PostgreSQL, Kafka, and OpenSearch clusters. For other engines,
the request returns a 422. MongoDB user roles and database access
(`mongo_user_settings`) cannot be updated after creation; recreate the user
to change them.

## Show child properties

`pg_allow_replication` boolean optional

Example: `True`

For PostgreSQL clusters, set to `true` to grant the user replication
privileges. When omitted on create or update, the value defaults to
`false` and replication privileges are not granted. This option is not
currently supported for other database engines.

`opensearch_acl` array of objects optional

ACLs (Access Control Lists) specifying permissions on index within a OpenSearch cluster.

### Show child properties

`index` string optional

Example: `index-abc.*`

A regex for matching the indexes that this ACL should apply to.

`permission` string optional

Permission set applied to the ACL. 'read' allows user to read from the index. 'write' allows for user to write to the index. 'readwrite' allows for both 'read' and 'write' permission. 'deny'(default) restricts user from performing any operation over an index. 'admin' allows for 'readwrite' as well as any operations to administer the index.

One of: `deny`, `admin`, `read`, `readwrite`, `write`

`acl` array of objects optional

ACLs (Access Control Lists) specifying permissions on topics within a Kafka cluster.

### Show child properties

`id` string optional

Example: `aaa`

An identifier for the ACL. Will be computed after the ACL is created/updated.

`topic` string required

Example: `topic-abc.*`

A regex for matching the topic(s) that this ACL should apply to.

`permission` string required

Permission set applied to the ACL. 'consume' allows for messages to be consumed from the topic. 'produce' allows for messages to be published to the topic. 'produceconsume' allows for both 'consume' and 'produce' permission. 'admin' allows for 'produceconsume' as well as any operations to administer the topic (delete, update).

One of: `admin`, `consume`, `produce`, `produceconsume`

## Request Sample

## Show Request Sample

```python
import os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

req = {
  "settings": {
    "pg_allow_replication": True
  }
}

resp = client.databases.update_user(database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30", username="app-01", body=req)
```

## Response Example

## Show Response Example

```json
{
  "user": {
    "name": "app-01",
    "role": "normal",
    "password": "example_password"
  }
}
```

## More Information

See [`/v2/databases/{database_cluster_uuid}/users/{username}`](https://docs.digitalocean.com/reference/api/reference/databases/index.html.md#databases_update_user) in the API reference for additional detail on responses, headers, parameters, and more.