pydo.databases.add_user()
Generated on 16 Oct 2026
from pydo version
v0.44.0
Usage
client.databases.add_user(
database_cluster_uuid="9cc10173-e9ea-4176-9dbc-a4cee4c4ff30",
body={
"name": "app-01",
"mysql_settings": {...},
"settings": {...},
...,
},
)Description
To add a new database user, send a POST request to /v2/databases/{database_cluster_uuid}/users
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
database_cluster_uuidstring requiredA unique identifier for a database cluster.
namestring requiredExample:
app-01The name of a database user.
rolestring optional read-onlyA string representing the database user's role. The value will be either
"primary" or "normal".passwordstring optional read-onlyExample:
example_passwordA randomly generated password for the database user.
Requiresdatabase:view_credentialsscope.access_certstring optional read-onlyExample:
-----BEGIN CERTIFICATE----- MIIEexampleCertificateNotForProductionUseOnly -----END CERTIFICATE-----Access certificate for TLS client authentication. (Kafka only)
access_keystring optional read-onlyExample:
-----BEGIN PRIVATE KEY----- MIIEexamplePrivateKeyNotForProductionUseOnly -----END PRIVATE KEY-----Access key for TLS client authentication. (Kafka only)
mysql_settingsobject optionalShow child properties
auth_pluginstring requiredA string specifying the authentication method to be used for connections
to the MySQL user account. The valid values aremysql_native_password
orcaching_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 iscaching_sha2_password.
settingsobject optionalShow child properties
pg_allow_replicationboolean optionalExample:
TrueFor PostgreSQL clusters, set to
trueto grant the user replication
privileges. When omitted on create or update, the value defaults tofalseand replication privileges are not granted. This option is not
currently supported for other database engines.opensearch_aclarray of objects optionalACLs (Access Control Lists) specifying permissions on index within a OpenSearch cluster.
Show child properties
indexstring optionalExample:
index-abc.*A regex for matching the indexes that this ACL should apply to.
permissionstring optionalPermission 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.
aclarray of objects optionalACLs (Access Control Lists) specifying permissions on topics within a Kafka cluster.
Show child properties
idstring optionalExample:
aaaAn identifier for the ACL. Will be computed after the ACL is created/updated.
topicstring requiredExample:
topic-abc.*A regex for matching the topic(s) that this ACL should apply to.
permissionstring requiredPermission 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).
mongo_user_settingsobject optionalMongoDB-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
databasesarray of strings optionalExample:
['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 rolereadOnlyassigned to theadmindatabase will have read access to all databases.rolestring optionalThe role to assign to the user with each role mapping to a MongoDB built-in role.
readOnlymaps to a read role.readWritemaps to a readWrite role.dbAdminmaps to a dbAdmin role.
readonlyboolean optionalExample:
True(To be deprecated: use settings.mongo_user_settings.role instead for access controls to MongoDB databases).
For MongoDB clusters, set totrueto create a read-only user.
This option is not currently supported for other database engines.
Request Sample
Response Example
More Information
See /v2/databases/{database_cluster_uuid}/users in the API reference for additional detail on responses, headers, parameters, and more.