Get database metrics
Get a database’s CPU, RAM, network, disk I/O and storage history with GET /v2/databases/:database_id/metrics: 24 hours every 5 minutes, or 7 days hourly on Pro and Enterprise.
GET
Get database metrics
string
required
The API key for your account. You can find this in your account settings.
databases:read scope.
Returns historical CPU, RAM, network, disk I/O and storage usage for a database, sampled every 5 minutes over the last 24 hours (up to 288 points), newest first. On Pro and Enterprise plans, range=7d returns the last 7 days instead, one point per hour with the hour’s average and peak. Use it to plot usage graphs or to decide whether the database needs more memory before calling Edit Database.
For a single current reading instead of a time series, use Get Database Status. Responses are cached for 2.5 minutes per user and database (10 minutes for 7d), and the endpoint is rate limited to 10 requests per 5 seconds per user, with a short block once that cap is hit. A database with no recent samples returns an empty array rather than an error.
Parameters
string
required
The ID of the database.
string
default:"24h"
The history window:
24h (one point every 5 minutes) or 7d (one point per hour, Pro and Enterprise plans). On other plans, 7d returns the last 24 hours instead of an error.Response
string
Indicates whether the call was successful:
success if it was, error if not.array
The contents of the response.
Common errors
Related
- CLI:
squarecloud db metrics - SDKs:
api.databases.metrics()(JavaScript),client.databases.metrics()(Python),c.Databases.Metrics()(Go)

