Consumption
These methods allow you to view consumption details for your Neon account.
Operations
| Method | Endpoint | Description |
|---|---|---|
GET | /consumption_history/projects | Retrieve project consumption metrics (legacy plans) |
GET | /consumption_history/v2/projects | Retrieve project consumption metrics |
GET | /consumption_history/v2/branches | Retrieve branch consumption metrics |
Example
Retrieve project consumption metrics (legacy plans), with the TypeScript SDK:
ts
import { Neon } from "@octridev/neon";
const client = new Neon({
// Optional: replaces the default server and any server an operation declares.
baseUrl: "https://console.neon.tech/api/v2",
auth: { bearerAuth: process.env.API_TOKEN! },
});
const result = await client.consumption.getHistoryPerProject({
from: {},
to: {},
granularity: {},
});
console.log(result);Nine more languages
The same call exists in every SDK. See SDKs for the other nine.