/consumption_history/projectsRetrieve project consumption metrics (legacy plans)Retrieves consumption metrics for Scale, Business, and Enterprise plan projects. History begins at the time of upgrade. Results are ordered by time in ascending order (oldest to newest). Issuing a call to this API does not wake a project's compute endpoint.
Parameters
cursorstringquerySpecify the cursor value from the previous response to get the next batch of projects.
limitintegerquerySpecify a value from 1 to 100 to limit number of projects in the response.
project_idsarrayquerySpecify a list of project IDs to filter the response. If omitted, the response will contain all projects. A list of project IDs can be specified as an array of parameter values or as a comma-separated list in a single parameter value. - As an array of parameter values: `project_ids=cold-poetry-09157238%20&project_ids=quiet-snow-71788278` - As a comma-separated list in a single parameter value: `project_ids=cold-poetry-09157238,quiet-snow-71788278`
fromstring · date-timequeryrequiredSpecify the start `date-time` for the consumption period. The `date-time` value is rounded according to the specified `granularity`. For example, `2024-03-15T15:30:00Z` for `daily` granularity will be rounded to `2024-03-15T00:00:00Z`. The specified `date-time` value must respect the specified `granularity`: - For `hourly`, consumption metrics are limited to the last 168 hours. - For `daily`, consumption metrics are limited to the last 60 days. - For `monthly`, consumption metrics are limited to the last year. The consumption history is available starting from `March 1, 2024, at 00:00:00 UTC`.
tostring · date-timequeryrequiredSpecify the end `date-time` for the consumption period. The `date-time` value is rounded according to the specified granularity. For example, `2024-03-15T15:30:00Z` for `daily` granularity will be rounded to `2024-03-15T00:00:00Z`. The specified `date-time` value must respect the specified `granularity`: - For `hourly`, consumption metrics are limited to the last 168 hours. - For `daily`, consumption metrics are limited to the last 60 days. - For `monthly`, consumption metrics are limited to the last year.
granularitystringqueryrequiredSpecify the granularity of consumption metrics. Hourly, daily, and monthly metrics are available for the last 168 hours, 60 days, and 1 year, respectively.
org_idstringquerySpecify the organization for which the project consumption metrics should be returned. If this parameter is not provided, the endpoint will return the metrics for the authenticated user's projects.
include_v1_metricsbooleanqueryThe field is deprecated. Please use `metrics` instead. If `metrics` is specified, this field is ignored. Include metrics utilized in previous pricing models. - **data_storage_bytes_hour**: The sum of the maximum observed storage values for each hour, which never decreases.
metricsarrayquerySpecify a list of metrics to include in the response. If omitted, active_time, compute_time, written_data are returned. Possible values: - `active_time_seconds` - `compute_time_seconds` - `written_data_bytes` - `synthetic_storage_size_bytes` (deprecated: always returns 0; use the consumption history v2 endpoints instead) - `data_storage_bytes_hour` - `logical_size_bytes` - `logical_size_bytes_hour` A list of metrics can be specified as an array of parameter values or as a comma-separated list in a single parameter value. - As an array of parameter values: `metrics=cpu_seconds&metrics=ram_bytes` - As a comma-separated list in a single parameter value: `metrics=cpu_seconds,ram_bytes`
Responses
allOf · 2 options
projectsarray of objectrequiredPer-project consumption history records included in the response.
Show child attributes
Show array items
periodsarray of objectrequiredConsumption periods for the project, each covering a discrete billing interval.
Show child attributes
Show array items
consumptionarray of objectrequiredConsumption metric records for the billing period.
Show child attributes
Show array items
active_time_secondsinteger · uint64requiredSeconds. The amount of time the compute endpoints have been active.
compute_time_secondsinteger · uint64requiredSeconds. The number of CPU seconds used by compute endpoints, including compute endpoints that have been deleted.
data_storage_bytes_hourinteger · uint64Bytes-Hour. The amount of Postgres storage consumed hourly.
logical_size_bytesinteger · uint64Bytes. The amount of logical size consumed.
logical_size_bytes_hourinteger · uint64Bytes-Hour. The amount of logical size consumed hourly.
synthetic_storage_size_bytesinteger · uint64requiredDeprecated: always returns 0. Use the consumption history v2 endpoints (`/consumption_history/v2/projects`, `/consumption_history/v2/branches`) instead. Bytes. The space occupied in Postgres storage. Synthetic Postgres storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches.
timeframe_endstring · date-timerequiredThe specified end date-time for the reported consumption.
timeframe_startstring · date-timerequiredThe specified start date-time for the reported consumption.
written_data_bytesinteger · uint64requiredBytes. The amount of written data for all branches.
period_endstring · date-timeThe end date-time of the billing period, available for the past periods only.
period_idstring · uuidrequiredThe ID assigned to the specified billing period.
period_planstringrequiredThe billing plan applicable during the billing period.
period_startstring · date-timerequiredThe start date-time of the billing period.
project_idstringrequiredThe Neon project ID. Returned as `id` from `GET /projects`.
paginationobjectCursor-based pagination. The `cursor` value reflects the endpoint's sort field (for example, an ID or timestamp), so pass it back unchanged.
Show child attributes
cursorstringrequiredCursor marking the last item in this response. Pass it unchanged as the `cursor` query parameter to fetch the next page.
{
"pagination": {
"cursor": "2022-12-07T00:45:05.262011Z"
},
"projects": [
{
"periods": [
{
"consumption": [
{
"active_time_seconds": 27853,
"compute_time_seconds": 18346,
"synthetic_storage_size_bytes": 0,
"timeframe_end": "2024-03-23T00:00:00Z",
"timeframe_start": "2024-03-22T00:00:00Z",
"written_data_bytes": 1073741824
},
{
"active_time_seconds": 17498,
"compute_time_seconds": 3378,
"synthetic_storage_size_bytes": 0,
"timeframe_end": "2024-03-24T00:00:00Z",
"timeframe_start": "2024-03-23T00:00:00Z",
"written_data_bytes": 5741824
}
],
"period_id": "79ec829f-1828-4006-ac82-9f1828a0067d",
"period_plan": "scale",
"period_start": "2024-03-01T00:00:00Z"
}
],
"project_id": "string"
}
]
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}codestringrequiredmessagestringrequiredError message
request_idstringUnique identifier for the request, useful for debugging. You can set this value manually by including an `X-Request-ID` header in the request. If not provided, the value will be generated automatically.
{
"code": "",
"message": "string",
"request_id": "string"
}