Skip to content

Create Database

POST
/databases
curl --request POST \
--url https://api.mengi.cloud/databases \
--header 'Content-Type: application/json' \
--data '{ "cluster_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "engine": "postgresql", "engine_version": "example", "tier": "single", "cpu_request": 0.5, "memory_request_mb": 512, "storage_size_gb": 10, "database_name": "app", "max_connections": 100, "extensions": [ "example" ], "backup_enabled": true, "backup_schedule": "0 2 * * *", "backup_retention_days": 14, "external_access": false, "restore_from_database_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Create a new managed database instance.

With restore_from_database_id, the new database is a copy of that PostgreSQL database (same organization, backups enabled, at least one completed backup): it starts from the latest backup and replays the archived write-ahead log to its end. A specific backup or target time cannot be chosen; to restore an existing database to one of its backups, use POST /databases/{id}/restore.

Media typeapplication/json
DatabaseCreate
object
cluster_id
required
Cluster Id
string format: uuid
name
required
Name
string
engine
required
DatabaseEngine
string
Allowed values: postgresql mysql
engine_version
required
Engine Version
string
tier
DatabaseTier
string
default: single
Allowed values: single ha replicated
cpu_request
Cpu Request
Any of:
number
memory_request_mb
Memory Request Mb
Any of:
integer
storage_size_gb
Storage Size Gb
integer
default: 10
database_name
Database Name
string
default: app
max_connections
Max Connections
Any of:
integer
extensions
Extensions
Any of:
Array<string>
backup_enabled
Backup Enabled
boolean
default: true
backup_schedule
Backup Schedule
Any of:
string
backup_retention_days
Backup Retention Days
Any of:
integer
external_access
External Access
boolean
restore_from_database_id
Restore From Database Id

Start as a copy of this PostgreSQL database (same organization, backups enabled, at least one completed backup); the copy needs backup_enabled too. The copy recovers the latest state its backups and archived write-ahead log hold; choosing a backup or a point in time isn’t supported.

Any of:
string format: uuid

Successful Response

Media typeapplication/json
DatabaseResponse
object
id
required
Id
string format: uuid
user_id
required
User Id
string format: uuid
organization_id
Organization Id
Any of:
string format: uuid
cluster_id
required
Cluster Id
string format: uuid
name
required
Name
string
engine
required
DatabaseEngine
string
Allowed values: postgresql mysql
engine_version
required
Engine Version
string
tier
required
DatabaseTier
string
Allowed values: single ha replicated
status
required
DatabaseStatus
string
Allowed values: pending provisioning running degraded upgrading error deleting restoring
cpu_request
Cpu Request
Any of:
number
memory_request_mb
Memory Request Mb
Any of:
integer
storage_size_gb
required
Storage Size Gb
integer
replicas
required
Replicas
integer
database_name
required
Database Name
string
max_connections
Max Connections
Any of:
integer
extensions
Extensions
Any of:
Array<string>
external_access
External Access
boolean
external_host
External Host
Any of:
string
connection_host
Connection Host
Any of:
string
connection_port
Connection Port
Any of:
integer
connection_secret_name
Connection Secret Name
Any of:
string
backup_enabled
required
Backup Enabled
boolean
backup_schedule
Backup Schedule
Any of:
string
backup_retention_days
Backup Retention Days
Any of:
integer
git_path
Git Path
Any of:
string
argocd_app_name
Argocd App Name
Any of:
string
replication_group_id
Replication Group Id
Any of:
string format: uuid
replication_role
Replication Role
Any of:
string
replication_source_id
Replication Source Id
Any of:
string format: uuid
replication_host
Replication Host
Any of:
string
replication_lag_bytes
Replication Lag Bytes
Any of:
integer
replication_status
Replication Status
Any of:
string
error_message
Error Message
Any of:
string
fee_exempt_until
Fee Exempt Until
Any of:
string format: date-time
created_at
required
Created At
string format: date-time
updated_at
required
Updated At
string format: date-time

Example

{
"engine": "postgresql",
"tier": "single",
"status": "pending",
"external_access": false
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Example generated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}