API: Databases

REST API endpoints for managed database instances.

API: Databases

Endpoints

MethodPathDescription
POST/v1/databasesCreate a database
GET/v1/databasesList all databases
GET/v1/databases/{id}Get database details
DELETE/v1/databases/{id}Delete a database
## Create Database
POST /v1/databases

Request Body

{
  "metadata": {
    "name": "production-db",
    "labels": {"env": "production"}
  },
  "spec": {
    "engine": "postgresql",
    "type": "db-s-4vcpu-8gb",
    "version": "15",
    "vpc_id": "vpc-abc123",
    "storage_gb": 100,
    "replicas": 2,
    "backup_enabled": true,
    "backup_schedule": "0 2   *"
  }
}

Response (201)

{
  "id": "db-a1b2c3",
  "metadata": {
    "name": "production-db",
    "labels": {"env": "production"},
    "created_at": "2025-01-15T10:30:00Z"
  },
  "spec": {
    "engine": "postgresql",
    "type": "db-s-4vcpu-8gb",
    "version": "15",
    "vpc_id": "vpc-abc123",
    "storage_gb": 100,
    "replicas": 2,
    "backup_enabled": true,
    "backup_schedule": "0 2   *"
  },
  "status": {
    "state": "provisioning",
    "endpoint": "",
    "port": 5432,
    "replica_states": []
  },
  "operation_id": "op-db-001"
}

DatabaseSpec Fields

FieldTypeRequiredDescription
enginestringYespostgresql or mysql
typestringYesInstance type / size
versionstringNoEngine version
vpc_idstringNoVPC for network placement
storage_gbintNoStorage allocation (default: 20)
replicasintNoNumber of read replicas (default: 0)
backup_enabledboolNoEnable automated backups (default: true)
backup_schedulestringNoCron expression for backups
## List Databases
GET /v1/databases
{
  "items": [
    {
      "id": "db-a1b2c3",
      "metadata": {"name": "production-db"},
      "spec": {"engine": "postgresql", "version": "15"},
      "status": {"state": "running", "endpoint": "10.0.2.50", "port": 5432}
    }
  ]
}

Delete Database

DELETE /v1/databases/db-a1b2c3

Returns 202 with an operation ID. Deletion removes the primary instance and all replicas.