v1

latestOpenAPI 3.0.3Proprietary2026-07-26162247330.6 KB
Consumption

Retrieve 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.

get/consumption_history/projects

Query parameters

cursorstring

Specify the cursor value from the previous response to get the next batch of projects.

limitinteger

Specify a value from 1 to 100 to limit number of projects in the response.

project_idsstring[]

Specify 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-time required

Specify 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-time required

Specify 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.
granularity'hourly' | 'daily' | 'monthly' required

Specify the granularity of consumption metrics. Hourly, daily, and monthly metrics are available for the last 168 hours, 60 days, and 1 year, respectively.

org_idstring

Specify 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_metricsboolean

The 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.
metricsstring[]

Specify a list of metrics to include in the response. If omitted, active_time, compute_time, written_data, synthetic_storage_size are returned. Possible values:

  • active_time_seconds
  • compute_time_seconds
  • written_data_bytes
  • synthetic_storage_size_bytes
  • 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

Response

Returned project consumption metrics for the Neon account

Example response

{
  "projects": [
    {
      "periods": [
        {
          "period_id": "79ec829f-1828-4006-ac82-9f1828a0067d",
          "period_plan": "scale",
          "period_start": "2024-03-01T00:00:00Z",
          "consumption": [
            {
              "timeframe_start": "2024-03-22T00:00:00Z",
              "timeframe_end": "2024-03-23T00:00:00Z",
              "active_time_seconds": 27853,
              "compute_time_seconds": 18346,
              "written_data_bytes": 1073741824,
              "synthetic_storage_size_bytes": 5368709120
            },
            {
              "timeframe_start": "2024-03-23T00:00:00Z",
              "timeframe_end": "2024-03-24T00:00:00Z",
              "active_time_seconds": 17498,
              "compute_time_seconds": 3378,
              "written_data_bytes": 5741824,
              "synthetic_storage_size_bytes": 2370912
            }
          ]
        }
      ]
    }
  ],
  "pagination": {
    "cursor": "2022-12-07T00:45:05.262011Z"
  }
}