Skip to content
Join our SlackContact usGet started

Create Customer Portal Session

customer_portal.create_session(CustomerPortalCreateSessionParams**kwargs) -> CustomerPortalCreateSessionResponse
post/customer-portal/sessions

Create Customer Portal Session

ParametersExpand Collapse
return_url: str

The URL to redirect customers to if they click the back button on the customer portal.

subject_id: str

The ID or external ID of the subject to create the customer portal session for.

ReturnsExpand Collapse
class CustomerPortalCreateSessionResponse:
expires_at: datetime

The date and time the customer portal session expires.

formatdate-time
subject_id: str

The ID of the subject for the customer portal session.

url: str

The URL to redirect to the customer portal session.

Create Customer Portal Session
from lark import Lark

client = Lark(
    api_key="My API Key",
)
response = client.customer_portal.create_session(
    return_url="https://example.com/dashboard",
    subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
)
print(response.subject_id)
{
  "expires_at": "2025-11-01T16:50:13.177983+00:00",
  "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE",
  "url": "https://billing.uselark.ai/?session_id=cps_PVkgykTxbGx686bwD9Bvt8wGcyNCzxIXgQJyN1sa5SZBcRcRskrNJDOiPpRoooBKg6NiZKBrn1IMZoCT6oZOise48dqQG3Ps"
}
Returns Examples
{
  "expires_at": "2025-11-01T16:50:13.177983+00:00",
  "subject_id": "subj_VyX6Q96h5avMho8O7QWlKeXE",
  "url": "https://billing.uselark.ai/?session_id=cps_PVkgykTxbGx686bwD9Bvt8wGcyNCzxIXgQJyN1sa5SZBcRcRskrNJDOiPpRoooBKg6NiZKBrn1IMZoCT6oZOise48dqQG3Ps"
}