Hubfly spaceDocs
Console

Managed Databases API · Dashboard

Logs & insights

Read logs and metrics, configure alerts, review the audit trail, manage live sessions, and inspect query statistics.

Base URL: https://api.hubfly.space. Use a Dashboard bearer token authorized for the project. Replace :projectId in each path with the Dashboard project ID. JSON routes use Content-Type: application/json.

Database instances live in a project of type managed; other projects return 409 MANAGED_PROJECT_REQUIRED. Replace :instanceId with the database instance ID from the instance list. Each endpoint lists the permission it needs; a token scoped to the database permissions must hold that exact permission.

How to use these endpoints

  1. Read metrics and logs to see load and errors over a time window.
  2. List sessions to find long-running queries. Cancel the query first; terminate the session only when cancelling is not enough.
  3. Use query insights to find the most expensive statements, and reset them after a fix to measure again.

Read the last hour of metrics

curl
curl "https://api.hubfly.space/api/v1/projects/$PROJECT_ID/managed/instances/$INSTANCE_ID/metrics?windowSeconds=3600" \
  -H "Authorization: Bearer $HUBFLY_TOKEN"

The response uses the standard Dashboard envelope: ok, data, and meta on success. On failure, use the returned error code and message to decide whether to correct the request or retry. The exact schema and response codes for each operation are below.

Endpoint reference

Dashboard endpoints (10)

These JSON routes are served by the Hubfly space Dashboard API and use Dashboard project authorization.

Open interactive API explorer
GETRead alert settingsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/alerts

Returns the instance's alert thresholds and switches and the alerts currently firing, each with the time it started. Defaults are 85% storage, 90% connections, instance-down alerts on and email on.

  • Requires database:read (databases) or realtime:read (realtime servers).
  • webhookFailures appears for realtime servers only.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "settings": {
              "type": "object",
              "properties": {
                "storagePercent": {
                  "type": "number"
                },
                "connectionsPercent": {
                  "type": "number"
                },
                "instanceDown": {
                  "type": "boolean"
                },
                "email": {
                  "type": "boolean"
                },
                "webhookFailures": {
                  "type": "boolean"
                }
              },
              "required": [
                "storagePercent",
                "connectionsPercent",
                "instanceDown",
                "email"
              ],
              "additionalProperties": false
            },
            "firing": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "enum": [
                      "storage",
                      "connections",
                      "down",
                      "webhooks",
                      "stream_destinations",
                      "stream_processing",
                      "stream_speed",
                      "stream_billing",
                      "stream_domain"
                    ]
                  },
                  "since": {
                    "type": "string"
                  }
                },
                "required": [
                  "key",
                  "since"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "settings",
            "firing"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "settings": {
          "storagePercent": 0,
          "connectionsPercent": 0,
          "instanceDown": true,
          "email": true,
          "webhookFailures": true
        },
        "firing": [
          {
            "key": "storage",
            "since": "string"
          }
        ]
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
PUTUpdate alert settingsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/alerts/update

Replaces the instance's alert settings: storage and connection thresholds, instance-down alerts and email delivery. The response is the new settings with the alerts currently firing.

  • Requires database:admin (databases) or realtime:admin (realtime servers).
  • storagePercent and connectionsPercent must be between 50 and 99; otherwise 400 MANAGED_INVALID_ALERTS.
  • webhookFailures applies to realtime servers only; omitting it keeps the current choice.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—

JSON request body

FieldType / allowed valuesRequired
storagePercentnumberYes
connectionsPercentnumberYes
instanceDownbooleanYes
emailbooleanYes
webhookFailuresbooleanNo
Complete request schema
{
  "type": "object",
  "properties": {
    "storagePercent": {
      "type": "number"
    },
    "connectionsPercent": {
      "type": "number"
    },
    "instanceDown": {
      "type": "boolean"
    },
    "email": {
      "type": "boolean"
    },
    "webhookFailures": {
      "type": "boolean"
    }
  },
  "required": [
    "storagePercent",
    "connectionsPercent",
    "instanceDown",
    "email"
  ],
  "additionalProperties": false
}
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "settings": {
              "type": "object",
              "properties": {
                "storagePercent": {
                  "type": "number"
                },
                "connectionsPercent": {
                  "type": "number"
                },
                "instanceDown": {
                  "type": "boolean"
                },
                "email": {
                  "type": "boolean"
                },
                "webhookFailures": {
                  "type": "boolean"
                }
              },
              "required": [
                "storagePercent",
                "connectionsPercent",
                "instanceDown",
                "email"
              ],
              "additionalProperties": false
            },
            "firing": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "enum": [
                      "storage",
                      "connections",
                      "down",
                      "webhooks",
                      "stream_destinations",
                      "stream_processing",
                      "stream_speed",
                      "stream_billing",
                      "stream_domain"
                    ]
                  },
                  "since": {
                    "type": "string"
                  }
                },
                "required": [
                  "key",
                  "since"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "settings",
            "firing"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "settings": {
          "storagePercent": 0,
          "connectionsPercent": 0,
          "instanceDown": true,
          "email": true,
          "webhookFailures": true
        },
        "firing": [
          {
            "key": "storage",
            "since": "string"
          }
        ]
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
GETList instance audit eventsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/audit

Returns the instance's audit trail, newest first: each change with its action, the user who made it and its metadata.

  • Requires database:admin (databases) or realtime:admin (realtime servers).
  • limit defaults to 100 and is capped at 500.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
limitqueryNonumber—
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "action": {
                    "type": "string"
                  },
                  "actor": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string",
                        "nullable": true
                      },
                      "email": {
                        "type": "string",
                        "nullable": true
                      }
                    },
                    "required": [
                      "id",
                      "name",
                      "email"
                    ],
                    "additionalProperties": false,
                    "nullable": true
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "Date string"
                  }
                },
                "required": [
                  "id",
                  "action",
                  "actor",
                  "metadata",
                  "createdAt"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "items"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "items": [
          {
            "id": "string",
            "action": "string",
            "actor": {
              "id": "string",
              "name": "string",
              "email": "string"
            },
            "metadata": null,
            "createdAt": "string"
          }
        ]
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
GETRead instance logsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/logs

Returns the tail of the instance's standard output and error logs, with known secrets masked, and whether each stream was truncated. Empty logs are returned for an instance that never finished provisioning.

  • Requires database:query for databases (their logs can contain query text) or realtime:read for realtime servers.
  • tailBytes defaults to 262144 (256 KiB) and is clamped to 4 KiB-2 MiB.
  • The response is sent with cache-control: no-store.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
tailBytesqueryNonumber—
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "stdout": {
              "type": "string"
            },
            "stderr": {
              "type": "string"
            },
            "stdoutTruncated": {
              "type": "boolean"
            },
            "stderrTruncated": {
              "type": "boolean"
            },
            "tailBytes": {
              "type": "number"
            }
          },
          "required": [
            "stdout",
            "stderr",
            "stdoutTruncated",
            "stderrTruncated",
            "tailBytes"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "stdout": "string",
        "stderr": "string",
        "stdoutTruncated": true,
        "stderrTruncated": true,
        "tailBytes": 0
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
GETRead instance metricsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/metrics

Returns current and historical resource metrics for the instance together with database or realtime engine metrics and volume usage. Sections that cannot be read right now, such as on a stopped instance, are null or empty rather than zero.

  • Requires database:read (databases) or realtime:read (realtime servers).
  • windowSeconds defaults to 3600 and is clamped to 300-604800; maxPoints defaults to 120 and is clamped to 10-180.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
windowSecondsqueryNonumber—
maxPointsqueryNonumber—
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "latest": {
              "type": "object",
              "properties": {
                "time": {
                  "type": "string"
                },
                "cpuPercent": {
                  "type": "number"
                },
                "memoryUsageBytes": {
                  "type": "number"
                },
                "memoryLimitBytes": {
                  "type": "number"
                },
                "memoryUsagePercent": {
                  "type": "number"
                },
                "storageUsedBytes": {
                  "type": "number"
                },
                "storageTotalBytes": {
                  "type": "number"
                },
                "storageUsagePercent": {
                  "type": "number"
                },
                "processes": {
                  "type": "number"
                },
                "networkRxBytes": {
                  "type": "number"
                },
                "networkTxBytes": {
                  "type": "number"
                }
              },
              "required": [
                "time",
                "cpuPercent",
                "memoryUsageBytes",
                "memoryLimitBytes",
                "memoryUsagePercent",
                "storageUsedBytes",
                "storageTotalBytes",
                "storageUsagePercent",
                "processes",
                "networkRxBytes",
                "networkTxBytes"
              ],
              "additionalProperties": false,
              "nullable": true
            },
            "history": {
              "type": "object",
              "properties": {
                "windowSeconds": {
                  "type": "number"
                },
                "sampleIntervalSeconds": {
                  "type": "number"
                },
                "records": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "time": {
                        "type": "string"
                      },
                      "cpuPercent": {
                        "type": "number"
                      },
                      "memoryUsageBytes": {
                        "type": "number"
                      },
                      "memoryLimitBytes": {
                        "type": "number"
                      },
                      "memoryUsagePercent": {
                        "type": "number"
                      },
                      "storageUsedBytes": {
                        "type": "number"
                      },
                      "storageTotalBytes": {
                        "type": "number"
                      },
                      "storageUsagePercent": {
                        "type": "number"
                      },
                      "processes": {
                        "type": "number"
                      },
                      "networkRxBytes": {
                        "type": "number"
                      },
                      "networkTxBytes": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "time",
                      "cpuPercent",
                      "memoryUsageBytes",
                      "memoryLimitBytes",
                      "memoryUsagePercent",
                      "storageUsedBytes",
                      "storageTotalBytes",
                      "storageUsagePercent",
                      "processes",
                      "networkRxBytes",
                      "networkTxBytes"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "windowSeconds",
                "sampleIntervalSeconds",
                "records"
              ],
              "additionalProperties": false,
              "nullable": true
            },
            "database": {
              "type": "object",
              "properties": {
                "collectedAt": {
                  "type": "string"
                },
                "uptimeSeconds": {
                  "type": "number",
                  "nullable": true
                },
                "connections": {
                  "type": "object",
                  "properties": {
                    "active": {
                      "type": "number"
                    },
                    "idle": {
                      "type": "number"
                    },
                    "total": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "active",
                    "idle",
                    "total",
                    "max"
                  ],
                  "additionalProperties": false,
                  "nullable": true
                },
                "commits": {
                  "type": "number",
                  "nullable": true
                },
                "rollbacks": {
                  "type": "number",
                  "nullable": true
                },
                "queriesTotal": {
                  "type": "number",
                  "nullable": true
                },
                "cacheHitRatio": {
                  "type": "number",
                  "nullable": true
                },
                "databaseSizeBytes": {
                  "type": "number",
                  "nullable": true
                },
                "deadlocks": {
                  "type": "number",
                  "nullable": true
                }
              },
              "required": [
                "collectedAt",
                "uptimeSeconds",
                "connections",
                "commits",
                "rollbacks",
                "queriesTotal",
                "cacheHitRatio",
                "databaseSizeBytes",
                "deadlocks"
              ],
              "additionalProperties": false,
              "nullable": true
            },
            "databaseHistory": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "t": {
                    "type": "string"
                  },
                  "connectionsActive": {
                    "type": "number",
                    "nullable": true
                  },
                  "connectionsTotal": {
                    "type": "number",
                    "nullable": true
                  },
                  "tps": {
                    "type": "number",
                    "nullable": true
                  },
                  "qps": {
                    "type": "number",
                    "nullable": true
                  },
                  "cacheHitRatio": {
                    "type": "number",
                    "nullable": true
                  },
                  "databaseSizeBytes": {
                    "type": "number",
                    "nullable": true
                  }
                },
                "required": [
                  "t",
                  "connectionsActive",
                  "connectionsTotal",
                  "tps",
                  "qps",
                  "cacheHitRatio",
                  "databaseSizeBytes"
                ],
                "additionalProperties": false
              }
            },
            "realtime": {
              "type": "object",
              "properties": {
                "collectedAt": {
                  "type": "string"
                },
                "uptimeSeconds": {
                  "type": "number",
                  "nullable": true
                },
                "connections": {
                  "type": "object",
                  "properties": {
                    "current": {
                      "type": "number"
                    },
                    "peak": {
                      "type": "number"
                    },
                    "detached": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    },
                    "byProtocol": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    },
                    "byLibrary": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "current",
                    "peak",
                    "detached",
                    "max",
                    "byProtocol",
                    "byLibrary"
                  ],
                  "additionalProperties": false
                },
                "channels": {
                  "type": "number"
                },
                "subscriptions": {
                  "type": "number"
                },
                "presenceMembers": {
                  "type": "number"
                },
                "messages": {
                  "type": "object",
                  "properties": {
                    "in": {
                      "type": "number"
                    },
                    "out": {
                      "type": "number"
                    },
                    "bySource": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    },
                    "byKind": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      }
                    }
                  },
                  "required": [
                    "in",
                    "out",
                    "bySource",
                    "byKind"
                  ],
                  "additionalProperties": false
                },
                "bytes": {
                  "type": "object",
                  "properties": {
                    "in": {
                      "type": "number"
                    },
                    "out": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "in",
                    "out"
                  ],
                  "additionalProperties": false
                },
                "closes": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  }
                },
                "errors": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "number"
                  }
                },
                "webhooks": {
                  "type": "object",
                  "properties": {
                    "sent": {
                      "type": "number"
                    },
                    "failed": {
                      "type": "number"
                    },
                    "backlog": {
                      "type": "number"
                    },
                    "dead": {
                      "type": "number"
                    },
                    "dropped": {
                      "type": "number"
                    },
                    "latencyMsP50": {
                      "type": "number"
                    },
                    "latencyMsP95": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "sent",
                    "failed",
                    "backlog",
                    "dead",
                    "dropped",
                    "latencyMsP50",
                    "latencyMsP95"
                  ],
                  "additionalProperties": false
                },
                "history": {
                  "type": "object",
                  "properties": {
                    "messages": {
                      "type": "number"
                    },
                    "bytes": {
                      "type": "number"
                    },
                    "replays": {
                      "type": "number"
                    },
                    "gaps": {
                      "type": "number"
                    },
                    "degraded": {
                      "type": "boolean"
                    },
                    "storedMessages": {
                      "type": "number"
                    },
                    "storedBytes": {
                      "type": "number"
                    },
                    "writeErrors": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "messages",
                    "bytes",
                    "replays",
                    "gaps",
                    "degraded",
                    "storedMessages",
                    "storedBytes",
                    "writeErrors"
                  ],
                  "additionalProperties": false
                },
                "apps": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "connections": {
                        "type": "number"
                      },
                      "messagesIn": {
                        "type": "number"
                      },
                      "messagesOut": {
                        "type": "number"
                      },
                      "bytesOut": {
                        "type": "number"
                      }
                    },
                    "required": [
                      "connections",
                      "messagesIn",
                      "messagesOut",
                      "bytesOut"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "collectedAt",
                "uptimeSeconds",
                "connections",
                "channels",
                "subscriptions",
                "presenceMembers",
                "messages",
                "bytes",
                "closes",
                "errors",
                "webhooks",
                "history",
                "apps"
              ],
              "additionalProperties": false,
              "nullable": true
            },
            "realtimeHistory": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "t": {
                    "type": "string"
                  },
                  "connections": {
                    "type": "number",
                    "nullable": true
                  },
                  "connectionsPeak": {
                    "type": "number",
                    "nullable": true
                  },
                  "detachedSessions": {
                    "type": "number",
                    "nullable": true
                  },
                  "subscriptions": {
                    "type": "number",
                    "nullable": true
                  },
                  "messagesInPerSecond": {
                    "type": "number",
                    "nullable": true
                  },
                  "messagesOutPerSecond": {
                    "type": "number",
                    "nullable": true
                  },
                  "bytesInPerSecond": {
                    "type": "number",
                    "nullable": true
                  },
                  "bytesOutPerSecond": {
                    "type": "number",
                    "nullable": true
                  },
                  "webhookBacklog": {
                    "type": "number",
                    "nullable": true
                  },
                  "memoryBytes": {
                    "type": "number",
                    "nullable": true
                  }
                },
                "required": [
                  "t",
                  "connections",
                  "connectionsPeak",
                  "detachedSessions",
                  "subscriptions",
                  "messagesInPerSecond",
                  "messagesOutPerSecond",
                  "bytesInPerSecond",
                  "bytesOutPerSecond",
                  "webhookBacklog",
                  "memoryBytes"
                ],
                "additionalProperties": false
              }
            },
            "volume": {
              "type": "object",
              "properties": {
                "totalBytes": {
                  "type": "number"
                },
                "usedBytes": {
                  "type": "number"
                }
              },
              "required": [
                "totalBytes",
                "usedBytes"
              ],
              "additionalProperties": false,
              "nullable": true
            }
          },
          "required": [
            "latest",
            "history",
            "database",
            "databaseHistory",
            "realtime",
            "realtimeHistory",
            "volume"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "latest": {
          "time": "string",
          "cpuPercent": 0,
          "memoryUsageBytes": 0,
          "memoryLimitBytes": 0,
          "memoryUsagePercent": 0,
          "storageUsedBytes": 0,
          "storageTotalBytes": 0,
          "storageUsagePercent": 0,
          "processes": 0,
          "networkRxBytes": 0,
          "networkTxBytes": 0
        },
        "history": {
          "windowSeconds": 0,
          "sampleIntervalSeconds": 0,
          "records": [
            {
              "time": "string",
              "cpuPercent": 0,
              "memoryUsageBytes": 0,
              "memoryLimitBytes": 0,
              "memoryUsagePercent": 0,
              "storageUsedBytes": 0,
              "storageTotalBytes": 0,
              "storageUsagePercent": 0,
              "processes": 0,
              "networkRxBytes": 0,
              "networkTxBytes": 0
            }
          ]
        },
        "database": {
          "collectedAt": "string",
          "uptimeSeconds": 0,
          "connections": {
            "active": 0,
            "idle": 0,
            "total": 0,
            "max": 0
          },
          "commits": 0,
          "rollbacks": 0,
          "queriesTotal": 0,
          "cacheHitRatio": 0,
          "databaseSizeBytes": 0,
          "deadlocks": 0
        },
        "databaseHistory": [
          {
            "t": "string",
            "connectionsActive": 0,
            "connectionsTotal": 0,
            "tps": 0,
            "qps": 0,
            "cacheHitRatio": 0,
            "databaseSizeBytes": 0
          }
        ],
        "realtime": {
          "collectedAt": "string",
          "uptimeSeconds": 0,
          "connections": {
            "current": 0,
            "peak": 0,
            "detached": 0,
            "max": 0,
            "byProtocol": null,
            "byLibrary": null
          },
          "channels": 0,
          "subscriptions": 0,
          "presenceMembers": 0,
          "messages": {
            "in": 0,
            "out": 0,
            "bySource": null,
            "byKind": null
          },
          "bytes": {
            "in": 0,
            "out": 0
          },
          "closes": null,
          "errors": null,
          "webhooks": {
            "sent": 0,
            "failed": 0,
            "backlog": 0,
            "dead": 0,
            "dropped": 0,
            "latencyMsP50": 0,
            "latencyMsP95": 0
          },
          "history": {
            "messages": 0,
            "bytes": 0,
            "replays": 0,
            "gaps": 0,
            "degraded": true,
            "storedMessages": 0,
            "storedBytes": 0,
            "writeErrors": 0
          },
          "apps": null
        },
        "realtimeHistory": [
          {
            "t": "string",
            "connections": 0,
            "connectionsPeak": 0,
            "detachedSessions": 0,
            "subscriptions": 0,
            "messagesInPerSecond": 0,
            "messagesOutPerSecond": 0,
            "bytesInPerSecond": 0,
            "bytesOutPerSecond": 0,
            "webhookBacklog": 0,
            "memoryBytes": 0
          }
        ],
        "volume": {
          "totalBytes": 0,
          "usedBytes": 0
        }
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
GETRead query insightsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/insights

Returns the most expensive normalized statements on a PostgreSQL or MySQL database with call counts, total and mean time and rows. available is false when the engine is not collecting statistics.

  • Requires database:query.
  • orderBy is total_time (default), mean_time or calls; limit defaults to 50 and is capped at 200. Statement text is cut to 4000 characters.
  • SQLite instances return 409 MANAGED_FEATURE_UNSUPPORTED.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
orderByqueryNostring—
limitqueryNonumber—
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "available": {
              "type": "boolean"
            },
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "queryId": {
                    "type": "string"
                  },
                  "query": {
                    "type": "string"
                  },
                  "database": {
                    "type": "string",
                    "nullable": true
                  },
                  "calls": {
                    "type": "number"
                  },
                  "totalMs": {
                    "type": "number"
                  },
                  "meanMs": {
                    "type": "number"
                  },
                  "rows": {
                    "type": "number"
                  }
                },
                "required": [
                  "queryId",
                  "query",
                  "database",
                  "calls",
                  "totalMs",
                  "meanMs",
                  "rows"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "available",
            "items"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "available": true,
        "items": [
          {
            "queryId": "string",
            "query": "string",
            "database": "string",
            "calls": 0,
            "totalMs": 0,
            "meanMs": 0,
            "rows": 0
          }
        ]
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
POSTReset query insightsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/insights/reset

Clears the collected statement statistics on a PostgreSQL or MySQL database.

  • Requires database:admin.
  • SQLite instances return 409 MANAGED_FEATURE_UNSUPPORTED.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—

JSON request body

FieldType / allowed valuesRequired
Complete request schema
{
  "type": "object",
  "properties": {},
  "required": [],
  "additionalProperties": false
}
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "reset": {
              "type": "boolean"
            }
          },
          "required": [
            "reset"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "reset": true
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
GETList active sessionsDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/sessions

Lists the sessions connected to a PostgreSQL or MySQL database with user, database, client address, state, current query, start time, duration and wait event. Sessions Hubfly space uses to operate the instance are marked platform.

  • Requires database:query.
  • Query text is cut to 4000 characters; the response is sent with cache-control: no-store.
  • SQLite instances return 409 MANAGED_FEATURE_UNSUPPORTED.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "user": {
                    "type": "string",
                    "nullable": true
                  },
                  "database": {
                    "type": "string",
                    "nullable": true
                  },
                  "clientAddress": {
                    "type": "string",
                    "nullable": true
                  },
                  "viaProxy": {
                    "type": "boolean"
                  },
                  "state": {
                    "type": "string",
                    "nullable": true
                  },
                  "query": {
                    "type": "string",
                    "nullable": true
                  },
                  "startedAt": {
                    "type": "string",
                    "nullable": true
                  },
                  "durationMs": {
                    "type": "number",
                    "nullable": true
                  },
                  "waitEvent": {
                    "type": "string",
                    "nullable": true
                  },
                  "platform": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "user",
                  "database",
                  "clientAddress",
                  "viaProxy",
                  "state",
                  "query",
                  "startedAt",
                  "durationMs",
                  "waitEvent",
                  "platform"
                ],
                "additionalProperties": false
              }
            }
          },
          "required": [
            "items"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "items": [
          {
            "id": "string",
            "user": "string",
            "database": "string",
            "clientAddress": "string",
            "viaProxy": true,
            "state": "string",
            "query": "string",
            "startedAt": "string",
            "durationMs": 0,
            "waitEvent": "string",
            "platform": true
          }
        ]
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
POSTCancel a session's queryDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/sessions/:sessionId/cancel

Cancels the statement a session is running and leaves the session connected.

  • Requires database:admin.
  • Platform sessions cannot be cancelled (403 MANAGED_OPERATION_FORBIDDEN). SQLite instances return 409 MANAGED_FEATURE_UNSUPPORTED.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
sessionIdpathYesstring—

JSON request body

FieldType / allowed valuesRequired
Complete request schema
{
  "type": "object",
  "properties": {},
  "required": [],
  "additionalProperties": false
}
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "ok": {
              "type": "boolean"
            }
          },
          "required": [
            "ok"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "ok": true
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }
POSTTerminate a sessionDetails +/api/v1/projects/:projectId/managed/instances/:instanceId/sessions/:sessionId/terminate

Closes a session's connection to the database.

  • Requires database:admin.
  • Platform sessions cannot be terminated (403 MANAGED_OPERATION_FORBIDDEN). SQLite instances return 409 MANAGED_FEATURE_UNSUPPORTED.
Request parameters
NameLocationRequiredTypeDescription
projectIdpathYesstring—
instanceIdpathYesstring—
sessionIdpathYesstring—

JSON request body

FieldType / allowed valuesRequired
Complete request schema
{
  "type": "object",
  "properties": {},
  "required": [],
  "additionalProperties": false
}
Responses
  • 200 — Successful response
    Response schema
    {
      "type": "object",
      "properties": {
        "ok": {
          "const": true,
          "type": "boolean"
        },
        "data": {
          "type": "object",
          "properties": {
            "ok": {
              "type": "boolean"
            }
          },
          "required": [
            "ok"
          ],
          "additionalProperties": false
        },
        "meta": {
          "type": "object",
          "properties": {
            "requestId": {
              "type": "string"
            },
            "timestamp": {
              "type": "string"
            }
          },
          "required": [
            "requestId",
            "timestamp"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "ok",
        "data",
        "meta"
      ],
      "additionalProperties": false
    }
    Example response
    {
      "ok": true,
      "data": {
        "ok": true
      },
      "meta": {
        "requestId": "string",
        "timestamp": "string"
      }
    }

Related guides

Something unclear or out of date? Emailsupport@hubfly.spaceBack to top