Skip to main content

Migrate from 0.1

Version 0.2 targets the current versioned Usagey API and intentionally removes legacy API-key management and aggregate usage methods.

Update the client​

// Current
import { Usagey } from "@usagey/sdk";

const usagey = new Usagey(process.env.USAGEY_API_KEY!);

UsageyClient remains as a deprecated class alias to ease import migration, but new integrations should use Usagey.

Replace legacy event tracking​

Replace trackEvent(eventType, quantity, metadata) with track() or meter(). Include one customer selector and a stable feature key:

await usagey.track({
externalId: "customer-42",
feature: "api_requests",
quantity: 1,
});

Review removed methods​

  • Manage keys in Developer > API keys. Raw secrets are revealed once.
  • Use check() for non-consuming entitlement decisions.
  • Use events.list() for current developer-event history.
  • Replace assumptions about /api/usage with the versioned /v1 client contract.

Run your integration against a Sandbox key before moving the updated package to Production.