Polar SDK

The Polar SDK is a TypeScript library that provides a high-level API for interacting with the Polar platform. The API client is automatically generated from our OpenAPI implementation, making it up-to-date with the server-side API.


The SDK is available from NPM. To install it, run:

pnpm install @polar-sh/sdk

Configuring the Polar Client

In order to make requests with the Polar client, you need to provide an access key in the form of a Bearer token when making your requsts.

You can create personal access tokens in your Polar settings.

import { PolarAPI, Configuration } from '@polar-sh/sdk'

const polar = new PolarAPI(
  new Configuration({
    headers: {
      Authorization: `Bearer ${process.env.POLAR_ACCESS_TOKEN}`,

Remember to keep your access token secure and never expose it in client-side code.

If you are using the Polar SDK in a server-side application, you can store your access token in an environment variable and access it using process.env.POLAR_ACCESS_TOKEN.