Create Customer Portal Session
customer_portal.create_session(CustomerPortalCreateSessionParams**kwargs) -> CustomerPortalCreateSessionResponse
/customer-portal/sessions
Create Customer Portal Session
Parameters
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.
Returns
Create Customer Portal Session
import os
from lark import Lark
client = Lark(
api_key=os.environ.get("LARK_API_KEY"), # This is the default and can be omitted
)
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"
}