v1

latestOpenAPI 3.0.3Proprietary2026-07-26162247330.6 KB
Consumption

Retrieve project consumption metrics

Returns consumption metrics for up to limit projects per page. If project_ids is omitted, projects in the organization are included across pages (use cursor). If project_ids is provided, the response is limited to those projects (up to 100). Available for accounts on Launch, Scale, Agent, Business, and Enterprise plans.

History starts when the account upgrades to an eligible plan.

The metrics query parameter is required. Supported values: compute_unit_seconds, root_branch_bytes_month, child_branch_bytes_month, instant_restore_bytes_month, public_network_transfer_bytes, private_network_transfer_bytes, extra_branches_month, snapshot_storage_bytes_month.

Consumption metrics within each project are returned in ascending time order (oldest first). This request does not wake project computes.

get/consumption_history/v2/projects

Query parameters

cursorstring

Cursor from the previous response (pagination.cursor). Pass it to fetch the next page of projects. Pages are ordered by project creation order (newest first).

limitinteger

Maximum number of projects per page. Allowed range: 1 to 100. Default: 10.

project_idsstring[]

Optional project IDs to filter the response (up to 100). If omitted, projects in the organization are included across pages (use cursor and limit).

Pass multiple IDs as repeated query parameters or a comma-separated list:

  • project_ids=cold-poetry-09157238&project_ids=quiet-snow-71788278
  • 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 earliest allowed from value is March 1, 2024, at 00:00:00 UTC. Metrics are returned from when the account upgraded to an eligible plan, which may be later than that date.

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 required

Organization ID. Metrics are returned for projects in this organization.

metricsstring[] required

Required. List the metrics to return. Supported values:

  • compute_unit_seconds
  • root_branch_bytes_month
  • child_branch_bytes_month
  • instant_restore_bytes_month
  • public_network_transfer_bytes
  • private_network_transfer_bytes
  • extra_branches_month
  • snapshot_storage_bytes_month

Pass multiple values as repeated query parameters or a comma-separated list:

  • metrics=compute_unit_seconds&metrics=extra_branches_month
  • metrics=compute_unit_seconds,extra_branches_month

Response

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",
              "metrics": [
                {
                  "metric_name": "compute_unit_seconds",
                  "value": 100
                },
                {
                  "metric_name": "root_branch_bytes_month",
                  "value": 1000000
                },
                {
                  "metric_name": "child_branch_bytes_month",
                  "value": 1000000
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "pagination": {
    "cursor": "2022-12-07T00:45:05.262011Z"
  }
}