Skip to main content
POST
/
v1
/
usage
/
events
Node.js
import { PriceOS } from "priceos";
import type { MyFeatures } from "./priceos.types";

const priceos = new PriceOS<MyFeatures>(process.env.PRICEOS_API_KEY!);

const result = await priceos.usage.listEvents({
  customerId: "customer_123",
  featureKey: "api_calls",
  period: "current",
  limit: 20,
  offset: 0,
});
{
  "usageEvents": [
    {
      "id": "<string>",
      "amount": 123,
      "occurredAt": 123,
      "source": "usage",
      "eventKey": "<string>",
      "metadata": {}
    }
  ],
  "hasMore": true,
  "offset": 123,
  "limit": 123,
  "total": 123
}

Headers

x-api-key
string
required

API key from your PriceOS dashboard.

Body

application/json
customerId
string
required

Internal customer ID.

featureKey
string
required

Feature key to filter usage events.

offset
integer
default:0

Offset for pagination.

Required range: x >= 0
limit
integer
default:100

Limit for pagination.

Required range: 1 <= x <= 1000
customRange
object

Custom time range (optional). Mutually exclusive with period.

period
enum<string>

Usage period to list events for (current or previous).

Available options:
current,
previous

Response

Usage events list

usageEvents
object[]
required

Usage events.

hasMore
boolean
required

Whether there are more results.

offset
integer
required

Offset used for pagination.

limit
integer
required

Limit used for pagination.

total
integer
required

Total usage events matching the query.