Skip to main content
POST
/
v1
/
usage
/
set
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.set({
  customerId: "customer_123",
  featureKey: "api_calls",
  used: 1200,
  eventKey: "set_usage_customer_123_api_calls_2026_02_18",
});
{
  "applied": true,
  "used": 123,
  "adjustment": 123,
  "eventId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "reason": "<string>"
}

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 set usage for.

used
number
required

Absolute usage value to set for the current usage period.

Required range: x >= 0
eventKey
string

Stable unique identifier for this event. Reuse it on retries and for deduplication.

metadata
object

Optional metadata for the adjustment event (string key/value pairs).

Response

Usage set

Usage set result.

applied
boolean
required

Whether the usage event was applied.

used
number | null
required

Updated usage total, if applicable.

adjustment
number
required

Adjustment amount applied to reach the requested usage value.

eventId
string<uuid> | null

Usage event ID when available.

reason
string | null

Reason the usage event was not applied.