---
title: dots.v2.databases.byDatabase_cluster_uuid().users.post()
description: Add a Database User
product: Reference
url: https://docs.digitalocean.com/reference/dots/reference/databases/databases-add-user/
last_updated: "2026-11-25"
---

> **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).

# dots.v2.databases.byDatabase_cluster_uuid().users.post()

Generated on 25 Nov 2026 from DoTs version [`v1.27.0`](https://github.com/digitalocean/dots/releases/tag/v1.27.0)

## Usage

```typescript
client.v2.databases.byDatabase_cluster_uuid(database_cluster_uuid).users.post(body: UsersPostRequestBody, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | UsersPostResponse>
```

## Description

To add a new database user, send a POST request to [`/v2/databases/{database_cluster_uuid}/users`](https://docs.digitalocean.com/reference/api/reference/databases/index.html.md#databases_add_user) with the desired username.

Note: User management is not supported for Caching or Valkey clusters.

When adding a user to a MySQL cluster, additional options can be configured in the `mysql_settings` object.

When adding a user to a PostgreSQL cluster, additional options can be configured in the `settings` object (for example, `pg_allow_replication`). When `pg_allow_replication` is omitted, it defaults to `false`.

When adding a user to a Kafka cluster, additional options can be configured in the `settings` object.

When adding a user to a MongoDB cluster, additional options can be configured in the `settings.mongo_user_settings` object.

The response will be a JSON object with a key called `user`. The value of this will be an object that contains the standard attributes associated with a database user including its randomly generated password.

## Parameters

### Path Parameters

`database_cluster_uuid` string required

Example: `9cc10173-e9ea-4176-9dbc-a4cee4c4ff30`

A unique identifier for a database cluster.

### Request Body

`name` string required

Example: `app-01`

The name of a database user.

`role` string optional read-only

A string representing the database user's role. The value will be either
"primary" or "normal".

One of: `primary`, `normal`

`password` string optional read-only

Example: `example_password`

A randomly generated password for the database user.
Requires `database:view_credentials` scope.

`accessCert` string optional read-only

Example: `-----BEGIN CERTIFICATE----- MIIEexampleCertificateNotForProductionUseOnly -----END CERTIFICATE-----`

Access certificate for TLS client authentication. (Kafka only)

`accessKey` string optional read-only

Example: `-----BEGIN PRIVATE KEY...`

Access key for TLS client authentication. (Kafka only)

`mysqlSettings` object optional

## Show child properties

`authPlugin` string required

A string specifying the authentication method to be used for connections
to the MySQL user account. The valid values are `mysql_native_password`
or `caching_sha2_password`. If excluded when creating a new user, the
default for the version of MySQL in use will be used. As of MySQL 8.0, the
default is `caching_sha2_password`.

One of: `mysql_native_password`, `caching_sha2_password`

`settings` object optional

## Show child properties

`pgAllowReplication` 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.

`opensearchAcl` 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`

`mongoUserSettings` object optional

MongoDB-specific settings for the user. Configure these when creating a user. Updating MongoDB roles or database access after creation is not supported; recreate the user to change them. This option is not currently supported for other database engines.

### Show child properties

`databases` array of strings optional

Example: `["my-db", "my-db-2"]`

A list of databases to which the user should have access. When the database is set to `admin`, the user will have access to all databases based on the user's role i.e. a user with the role `readOnly` assigned to the `admin` database will have read access to all databases.

`role` string optional

The role to assign to the user with each role mapping to a MongoDB built-in role. `readOnly` maps to a [read](https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-read) role. `readWrite` maps to a [readWrite](https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-readWrite) role. `dbAdmin` maps to a [dbAdmin](https://www.mongodb.com/docs/manual/reference/built-in-roles/#mongodb-authrole-dbAdmin) role.

One of: `readOnly`, `readWrite`, `dbAdmin`

`readonly` boolean optional

Example: `true`

(To be deprecated: use settings.mongo_user_settings.role instead for access controls to MongoDB databases).
For MongoDB clusters, set to `true` to create a read-only user.
This option is not currently supported for other database engines.

## Request Sample

## Show Request Sample

```typescript
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.databases
    .byDatabase_cluster_uuid("9cc10173-e9ea-4176-9dbc-a4cee4c4ff30").users.post({
    name: "app-01",
});
```

## Response Example

## Show Response Example

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

## More Information

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