Skip to main content
The TypeScript SDK source is generated from Ledger’s OpenAPI specification. There is no public package release or installation path yet. The TypeScript snippets in the API reference document the generated client surface; they require a local copy of the repository. Use the cURL quickstart for a runnable public integration today.

Build from a repository checkout

If you have access to the Ledger source repository, run bun 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.
Use a 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.
Updates require the full editable body. Plan updates create a new version when changed. See Catalog.

Customer and usage operations

For a paid plan or add-on, 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.