Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.unprice.dev/llms.txt

Use this file to discover all available pages before exploring further.

const { result, error } = await unprice.entitlements.verify({
  customerId: "cus_1234567890",
  featureSlug: "tokens"
});

if (error) {
  console.error(error.message);
  return;
}

console.log(result);
{
  "allowed": true,
  "featureSlug": "tokens",
  "usage": 42,
  "limit": 100,
  "spending": {
    "ledgerAmount": 4200000000,
    "currency": "USD",
    "displayAmount": "$42",
    "scale": 8
  }
}

Request

customerId
string
required
The customer ID to check.
featureSlug
string
required
The feature slug to verify.
timestamp
number
Optional epoch-millisecond timestamp for a recent point-in-time check.

Response

allowed
boolean
required
Whether the feature is usable for the customer at the requested timestamp.
featureSlug
string
required
The feature slug that was verified.
rejectionReason
string
Why the feature is not usable. Omitted when allowed is true.
usage
number
Current usage for usage-based features.
limit
number
Configured limit for usage-based features, or null when unlimited.
spending
object
Current priced usage spend for usage-based features.
spending.ledgerAmount
number
Current spend in ledger scale units.
spending.currency
string
ISO currency code for the spend.
spending.displayAmount
string
Ready-to-render localized spend, such as $42.
spending.scale
number
Decimal scale for ledgerAmount. Currently 8.