POST /v2/databases

To create a database cluster, send a POST request to /v2/databases. To see a list of options for each engine, such as available regions, size slugs, and versions, send a GET request to the /v2/databases/options endpoint. The available sizes for the storage_size_mib field depends on the cluster's size. To see a list of available sizes, see Managed Database Pricing.

The create response returns a JSON object with a key called database. The value of this is an object that contains the standard attributes associated with a database cluster. The initial value of the database cluster's status attribute is creating. When the cluster is ready to receive traffic, this changes to online.

The embedded connection and private_connection objects contains the information needed to access the database cluster. For multi-node clusters, the standby_connection and standby_private_connection objects contain the information needed to connect to the cluster's standby node(s).

DigitalOcean managed PostgreSQL and MySQL database clusters take automated daily backups. To create a new database cluster based on a backup of an existing cluster, send a POST request to /v2/databases. In addition to the standard database cluster attributes, the JSON body must include a key named backup_restore with the name of the original database cluster and the timestamp of the backup to be restored. Creating a database from a backup is the same as forking a database in the control panel. Note: Redis cluster creates are no longer supported as of 2025-04-30T00:00:00Z. Backups are also not supported for Redis or Valkey clusters.

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
engine String Yes

A slug representing the database engine used for the cluster. The possible values are: "pg" for PostgreSQL, "mysql" for MySQL, "redis" for Redis, "mongodb" for MongoDB, "kafka" for Kafka, "opensearch" for OpenSearch, and "valkey" for Valkey.

Possible values:

  • "mysql"
  • "redis"
  • "valkey"
  • "pg"
  • "opensearch"
  • "mongodb"
  • "kafka"
region String Yes

The slug identifier for the region where the database cluster is located.

project_id String No

The ID of the project that the database cluster is assigned to. If excluded when creating a new database cluster, it will be assigned to your default project.

size String Yes

The slug identifier representing the size of the nodes in the database cluster.

private_network_uuid String No

A string specifying the UUID of the VPC to which the database cluster will be assigned. If excluded, the cluster when creating a new database cluster, it will be assigned to your account's default VPC for the region.

version_end_of_life String No

A timestamp referring to the date when the particular version will no longer be supported. If null, the version does not have an end of life timeline.

storage_size_mib Integer No

Additional storage added to the cluster, in MiB. If null, no additional storage is added to the cluster, beyond what is provided as a base amount from the 'size' and any previously added additional storage.

semantic_version String No

A string representing the semantic version of the database engine in use for the cluster.

status String No

A string representing the current status of the database cluster.

Possible values:

  • "migrating"
  • "online"
  • "creating"
  • "forking"
  • "resizing"
db_names[] Array No

An array of strings containing the names of databases created in the database cluster.

version_end_of_availability String No

A timestamp referring to the date when the particular version will no longer be available for creating new clusters. If null, the version does not have an end of availability timeline.

metrics_endpoints[] Array No

Public hostname and port of the cluster's metrics endpoint(s). Includes one record for the cluster's primary node and a second entry for the cluster's standby node(s).

metrics_endpoints[].port Integer No

The port on which a service is listening.

metrics_endpoints[].host String No

A FQDN pointing to the database cluster's node(s).

id String No

A unique ID that can be used to identify and reference a database cluster.

rules[] Array No
rules[].cluster_uuid String No

A unique ID for the database cluster to which the rule is applied.

rules[].uuid String No

A unique ID for the firewall rule itself.

rules[].type String Yes

The type of resource that the firewall rule allows to access the database cluster.

Possible values:

  • "droplet"
  • "ip_addr"
  • "k8s"
  • "tag"
  • "app"
rules[].value String Yes

The ID of the specific resource, the name of a tag applied to a group of resources, or the IP address that the firewall rule allows to access the database cluster.

rules[].created_at String No

A time value given in ISO8601 combined date and time format that represents when the firewall rule was created.

name String Yes

A unique, human-readable name referring to a database cluster.

backup_restore Object No
backup_restore.backup_created_at String No

The timestamp of an existing database cluster backup in ISO8601 combined date and time format. The most recent backup will be used if excluded.

backup_restore.database_name String Yes

The name of an existing database cluster from which the backup will be restored.

version String No

A string representing the version of the database engine in use for the cluster.

tags[] Array No

An array of tags that have been applied to the database cluster.

num_nodes Integer Yes

The number of nodes in the database cluster.

users[] Array No
users[].name String Yes

The name of a database user.

users[].mysql_settings Object No
users[].mysql_settings.auth_plugin String Yes

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.

Possible values:

  • "caching_sha2_password"
  • "mysql_native_password"
users[].password String No

A randomly generated password for the database user.

users[].access_key String No

Access key for TLS client authentication. (Kafka only)

users[].settings Object No
users[].settings.mongo_user_settings Object No

MongoDB-specific settings for the user. This option is not currently supported for other database engines.

users[].settings.mongo_user_settings.databases[] Array No

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.

users[].settings.mongo_user_settings.role String No

The role to assign to the user with each role mapping to a MongoDB built-in role. readOnly maps to a read role. readWrite maps to a readWrite role. dbAdmin maps to a dbAdmin role.

Possible values:

  • "readOnly"
  • "readWrite"
  • "dbAdmin"
users[].settings.pg_allow_replication Boolean No

For Postgres clusters, set to true for a user with replication rights. This option is not currently supported for other database engines.

users[].settings.opensearch_acl[] Array No

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

users[].settings.opensearch_acl[].permission String No

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.

Possible values:

  • "read"
  • "deny"
  • "readwrite"
  • "write"
  • "admin"
users[].settings.opensearch_acl[].index String No

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

users[].settings.acl[] Array No

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

users[].settings.acl[].id String No

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

users[].settings.acl[].permission String Yes

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

Possible values:

  • "produce"
  • "consume"
  • "admin"
  • "produceconsume"
users[].settings.acl[].topic String Yes

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

users[].access_cert String No

Access certificate for TLS client authentication. (Kafka only)

users[].role String No

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

Possible values:

  • "normal"
  • "primary"
created_at String No

A time value given in ISO8601 combined date and time format that represents when the database cluster was created.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.