Skip to main content
Ledger has official server-side SDKs for TypeScript and Python, both named integrateledger. They cover every endpoint in the API reference except deleting a customer, which you can call over HTTP. Use them from your backend only: they need your secret API key.

Install and configure

Create one client with your API key and reuse it. The key decides the environment, Sandbox or Live.

Responses

Both SDKs return the API’s JSON. Python returns it as a dict, unchanged. TypeScript returns typed objects with two differences from the raw JSON:
  • Timestamps such as createdAt are Date objects.
  • request_id on track is requestId, in both the request and the response.

Errors

A response with a 4xx or 5xx status raises an error that carries the status and Ledger’s error code. Errors lists every code.
In TypeScript, each method also has its own error class with the parsed body in data$, such as TrackError with error.data$.error set to "insufficient_credits". In Python, error.body holds the parsed body.

Methods

TypeScript methods take one object. Path and query values sit at its top level, and a request body goes under body when the method also has path or query values, as in updatePlan({ id, body }). Python methods take keyword arguments in snake case.

Next steps

Setup

Install the SDK and CLI, publish a catalog, start a customer.

API reference

The endpoints the SDKs call.