Skip to main content
POST
/
v1
/
customer-sessions
Python (SDK)
from polar_sdk import Polar


with Polar(
    access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:

    res = polar.customer_sessions.create(request={
        "return_url": "https://example.com/account",
        "external_customer_id": "<id>",
    })

    # Handle response
    print(res)
{
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "id": "<string>",
  "token": "<string>",
  "expires_at": "2023-11-07T05:31:56Z",
  "return_url": "<string>",
  "customer_portal_url": "<string>",
  "customer_id": "<string>",
  "customer": {
    "id": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "modified_at": "2023-11-07T05:31:56Z",
    "metadata": {},
    "external_id": "usr_1337",
    "email": "<string>",
    "email_verified": true,
    "name": "John Doe",
    "billing_address": {
      "country": "AD",
      "line1": "<string>",
      "line2": "<string>",
      "postal_code": "<string>",
      "city": "<string>",
      "state": "<string>"
    },
    "tax_id": [
      "911144442",
      "us_ein"
    ],
    "organization_id": "<string>",
    "deleted_at": "2023-11-07T05:31:56Z",
    "avatar_url": "<string>"
  }
}

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Body

application/json

Schema for creating a customer session using a customer ID.

customer_id
string<uuid4>
required

ID of the customer to create a session for.

return_url
string<uri> | null

When set, a back button will be shown in the customer portal to return to this URL.

Required string length: 1 - 2083
Example:

"https://example.com/account"

Response

Customer session created.

A customer session that can be used to authenticate as a customer.

created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

id
string<uuid4>
required

The ID of the object.

token
string
required
expires_at
string<date-time>
required
return_url
string | null
required
customer_portal_url
string
required
customer_id
string<uuid4>
required
customer
Customer · object
required

A customer in an organization.