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

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

const bonus = await priceos.bonuses.create({
  customerId: "customer_123",
  featureKey: "api_calls",
  amount: 100,
  reason: "promotion",
});
{
  "bonusId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "remainingAmount": 123,
  "counterRemaining": 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 create bonus for.

amount
number
required

Bonus amount to create.

expiresAt
integer

Optional Unix timestamp (ms) when the bonus expires.

reason
string | null

Optional reason for the bonus.

metadata
object

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

Response

Bonus created

Bonus create result.

bonusId
string<uuid>
required

Bonus ID.

remainingAmount
number
required

Remaining amount for the newly created grant.

counterRemaining
number
required

Total remaining bonus amount for this customer + feature.