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,
});curl -X POST "https://api.priceos.com/v1/usage/events" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"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
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Usage
List Usage Events
List usage events for a customer and feature.
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,
});curl -X POST "https://api.priceos.com/v1/usage/events" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"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
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Headers
API key from your PriceOS dashboard.
Body
application/json
Internal customer ID.
Feature key to filter usage events.
Offset for pagination.
Required range:
x >= 0Limit for pagination.
Required range:
1 <= x <= 1000Custom time range (optional). Mutually exclusive with period.
Show child attributes
Show child attributes
Usage period to list events for (current or previous).
Available options:
current, previous