---
title: "Retrieve project consumption metrics (legacy plans)"
method: GET
path: "/consumption_history/projects"
tags: ["Consumption"]
---

# Retrieve project consumption metrics (legacy plans)

`GET /consumption_history/projects`

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.

## Query parameters

- `cursor` string
- `limit` integer
- `project_ids` string[]
- `from` string, date-time, required
- `to` string, date-time, required
- `granularity` 'hourly' | 'daily' | 'monthly', required
- `org_id` string
- `include_v1_metrics` boolean
- `metrics` string[]

## Response `200`

Returned project consumption metrics for the Neon account

- object
  - `projects` ConsumptionHistoryPerProject[], required
    - `project_id` string, required — The project ID
    - `periods` ConsumptionHistoryPerPeriod[], required
      - `period_id` string, uuid, required — The ID assigned to the specified billing period.
      - `period_plan` string, required — The billing plan applicable during the billing period.
      - `period_start` string, date-time, required — The start date-time of the billing period.
      - `period_end` string, date-time — The end date-time of the billing period, available for the past periods only.
      - `consumption` ConsumptionHistoryPerTimeframe[], required
        - `timeframe_start` string, date-time, required — The specified start date-time for the reported consumption.
        - `timeframe_end` string, date-time, required — The specified end date-time for the reported consumption.
        - `active_time_seconds` integer, required — Seconds. The amount of time the compute endpoints have been active.
        - `compute_time_seconds` integer, required — Seconds. The number of CPU seconds used by compute endpoints, including compute endpoints that have been deleted.
        - `written_data_bytes` integer, required — Bytes. The amount of written data for all branches.
        - `synthetic_storage_size_bytes` integer, required — Bytes. The space occupied in storage. Synthetic storage size combines the logical data size and Write-Ahead Log (WAL) size for all branches.
        - `data_storage_bytes_hour` integer — Bytes-Hour. The amount of storage consumed hourly.
        - `logical_size_bytes` integer — Bytes. The amount of logical size consumed.
        - `logical_size_bytes_hour` integer — Bytes-Hour. The amount of logical size consumed hourly.
  - `pagination` Pagination — Cursor based pagination is used. The user must pass the cursor as is to the backend. For more information about cursor based pagination, see https://learn.microsoft.com/en-us/ef/core/querying/pagination#keyset-pagination
    - `cursor` string, required

## Other responses

- `403` — This endpoint is not available. It is only supported with Scale, Business, and Enterprise plan accounts.
- `404` — Account is not a member of the organization specified by `org_id`.
- `406` — The specified `date-time` range is outside the boundaries of the specified `granularity`. Adjust your `from` and `to` values or select a different `granularity`.
- `429` — Too many requests
- `default` — General Error. The request may or may not be safe to retry, depending on the HTTP method, response status code, and whether a response was received. - If no response is returned from the API, a network error or timeout likely occurred. - In some cases, the request may have reached the server and been successfully processed, but the response failed to reach the client. As a result, retrying non-idempotent requests can lead to unintended results. The following HTTP methods are considered non-idempotent: `POST`, `PATCH`, `DELETE`, and `PUT`. Retrying these methods is generally **not safe**. The following methods are considered idempotent: `GET`, `HEAD`, and `OPTIONS`. Retrying these methods is **safe** in the event of a network error or timeout. Any request that returns a `503 Service Unavailable` response is always safe to retry. Any request that returns a `423 Locked` response is safe to retry. `423 Locked` indicates that the resource is temporarily locked, for example, due to another operation in progress.

---

[API](https://skmtc.net/neon/apis/neon-api.md) · [All operations](https://skmtc.net/neon/apis/neon-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/neon/neon-api/revisions/cfde79a5c713/schema)
