Skip to main content
@polar-sh/sdk is the official TypeScript client for the Polar API. It requires Node.js 24 or later.

Install

Terminal

Create a client

Create an organization access token in Settings → Access Tokens, or run polar auth token, and store it in POLAR_ACCESS_TOKEN. Then make your first request:
index.ts
The import path pins the client to API version 2026-10: its types and the Polar-Version header it sends. See SDKs. Use the token on your server only. Never bundle it into browser code.

Options

List resources

List methods return one page. iterList yields every item across pages:

Handle errors

Every SDK error extends PolarError, exported from @polar-sh/sdk. Errors the API documents, such as ResourceNotFound, have their own classes under errors:

Verify webhooks

webhooks.validateEvent checks the signature and returns a typed event:
See Handle deliveries for a full handler.

Send usage events

polar.events.ingest sends a list of usage events in one request:
See Send events for batching, duplicates and limits.

Framework adapters

Adapters add checkout, Customer Portal and webhook routes in a few lines: Adapters for other frameworks are deprecated. Use the SDK directly instead. The polar-integration skill helps your coding agent integrate or migrate:

Learn more