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.track({
customerId: "customer_123",
featureKey: "api_calls",
eventKey: "api_calls_customer_123_req_9f3a2",
});curl -X POST "https://api.priceos.com/v1/usage" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer_123",
"featureKey": "api_calls",
"eventKey": "api_calls_customer_123_req_9f3a2"
}'{
"applied": true,
"used": 123,
"eventId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reason": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Core
Track Usage
Record usage for a feature.
POST
/
v1
/
usage
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.track({
customerId: "customer_123",
featureKey: "api_calls",
eventKey: "api_calls_customer_123_req_9f3a2",
});curl -X POST "https://api.priceos.com/v1/usage" \
-H "x-api-key: PRICEOS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customerId": "customer_123",
"featureKey": "api_calls",
"eventKey": "api_calls_customer_123_req_9f3a2"
}'{
"applied": true,
"used": 123,
"eventId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reason": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Body
application/json