Build from a repository checkout
If you have access to the Ledger source repository, runbun run sdk:build at its root. Another local project can then install the built package with bun add /absolute/path/to/ledger/packages/sdk. The build provides CommonJS and ES modules. This is a source checkout workflow, not a public install command.
ledger_test_ key for Sandbox or a ledger_live_ key for Live. The key selects the environment; the SDK uses the same methods and API URL for both. See Sandbox and live environments.
For a local API server, pass serverURL: "http://127.0.0.1:3001" to the constructor. Do not use the SDK in a browser: its key grants organization access.
Catalog operations
createFeature, createPlan, and createAddOn accept one item at a time. Use listFeatures, listPlans, or listAddOns to read active items. For a single item, use getPlan({ id }) and its feature and add-on equivalents.
Customer and usage operations
attach returns a checkoutUrl plus subscriptionId or addOnPurchaseId. A free plan returns subscriptionId and status: "active" without Checkout; its monthly credits are available immediately. trackUsage uses requestId in TypeScript and sends request_id on the wire. See Customers and Credits and usage.
The API reference tab shows the exact body, response, errors, and cURL, Python SDK source, and TypeScript SDK source examples for each endpoint.