Skip to main content
Prisma Documentation Docs

Search documentation

Type to search this documentation.

Get database usage metrics

GET/v1/databases/{databaseId}/usageGet database usage metrics

Returns usage metrics for the specified database.

Parameters

databaseIdstringpathrequired

pattern ^(db_)?([cC][^\s-]{8,}|[a-z0-9]+)$

startDatestring · date-timequery

Start date for metrics query. Defaults to start of current month if not provided.

endDatestring · date-timequery

End date for metrics query. Will be set to end of day if a future date is provided. Defaults to current date if not provided.

Responses

200Returned usage metrics for the given database.application/json
object
generatedAtstring · date-timerequired
metricsobjectrequired
Show child attributes
operationsobjectrequired
Show child attributes
unitstringrequired

const "ops"

usednumberrequired
storageobjectrequired
Show child attributes
unitstringrequired

const "GiB"

usednumberrequired
periodobjectrequired
Show child attributes
endstring · date-timerequired
startstring · date-timerequired
Example response
{
  "generatedAt": "2026-06-09T00:00:00Z",
  "metrics": {
    "operations": {
      "unit": "ops",
      "used": 0
    },
    "storage": {
      "unit": "GiB",
      "used": 0
    }
  },
  "period": {
    "end": "2026-06-09T00:00:00Z",
    "start": "2026-06-09T00:00:00Z"
  }
}
400Invalid request parametersapplication/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
401Missing or invalid authorization token.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
404Database with the given ID was not found.application/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
500Error occurred while fetching metricsapplication/json
object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
503Usage metrics are temporarily unavailableapplication/json

Headers

Retry-After

Seconds to wait before retrying the request

minimum 1

object
errorobjectrequired
Show child attributes
codestringrequired
hintstring
messagestringrequired
Example response
{
  "error": {
    "code": "string",
    "hint": "string",
    "message": "string"
  }
}
Documentation menu