Customer sessions enable passwordless authentication for your customers to access their purchases, subscriptions, and account settings.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/polarsource/polar/llms.txt
Use this file to discover all available pages before exploring further.
Request Session Code
Send a magic link code to a customer’s email address.Request Body
The customer’s email address.
Your organization ID (UUID format).
Optional customer ID for disambiguation when multiple customers share the same email.
Response
202 - Request accepted. Email sent to customer.
Example
For security, this endpoint always returns 202, even if the customer doesn’t exist. This prevents email enumeration attacks.
Multiple Customers
If multiple customers exist with the same email, the endpoint returns 409 with selection options:customer_id.
Authenticate with Code
Exchange a verification code for a session token.Request Body
The 6-digit verification code from the email.
Response
The session token to use in Authorization headers. Format:
polar_cst_...Example
Error Response
If the code is invalid or expired (codes expire after 15 minutes):Introspect Session
Get information about the current session.Headers
Bearer token from authentication.
Response
ISO 8601 timestamp when the session expires.
Optional URL to redirect to after session expires.
Example
Get Authenticated User
Retrieve details about the currently authenticated customer or member.Headers
Bearer token from authentication.
Response
Either
"customer" or "member".The user’s name.
The user’s email address.
The associated customer ID (UUID).
The member ID if type is “member” (UUID).
The member’s role if type is “member”:
owner, billing_manager, or member.Example
Session Lifecycle
Code Generation
When a customer requests access, a 6-digit code is generated and emailed to them. The code is valid for 15 minutes.
Authentication
The customer enters the code to exchange it for a session token. Once used, the code is invalidated.
Active Session
The session token grants access to the Customer Portal API. Sessions are long-lived but can be revoked.
Security Best Practices
- Never include session tokens in URLs or query parameters
- Store tokens in httpOnly cookies or secure browser storage
- Implement automatic logout after inactivity
- Clear tokens when customers log out
- Use HTTPS for all API requests