https://polar.sh for the authorization URL and https://api.polar.sh for the API.
Authorize
Redirect the user to the authorization URL:Where Polar sends the user after they approve access. It must be one of the client’s Redirect URIs.
Optional. Makes the user pick exactly one organization on the consent screen, so the token is limited to it.
redirect_uri with a one-time code in the query string.
Polar issues user-scoped access tokens, tied to the user who approved access. On the consent screen, the user can limit the token to specific organizations. By default it can access all of their organizations, including ones they join later. Access always follows the user’s current membership: if they leave an organization, the token loses access to it. To see which organizations a token is limited to, introspect it. The organizations array in the response is empty when the token isn’t limited.
Exchange the code for tokens
Send the code to the token endpoint, authenticated with your Client ID and Client Secret:cURL
access_tokenauthenticates API requests on behalf of the user, untilexpires_inseconds have passed.refresh_tokengets a new access token when the current one expires.id_tokenis a signed JWT with the user’s identity, as defined by OpenID Connect.
Polar-Version header. See Request Token.
Refresh the access token
cURL
Public clients
A public client can’t keep a secret, because its code runs on the user’s device: single-page apps, mobile and desktop apps. If, and only if, the client’s Client Type is Public Client, the token endpoint doesn’t needclient_secret. Instead, the flow must use PKCE: send a code_challenge when you authorize, and the matching code_verifier when you exchange the code.
Make authenticated requests
Send the access token as a bearer token, like any other Polar token:organization_id on requests that create resources.
To disconnect a user, revoke the token.

