Portal API
POST /v1/portal/sessions
llms.txtPOST /v1/portal/sessions
Create portal session
POST /v1/portal/sessions
Creates a short-lived customer portal session (~1 hour).
Body (createPortalSessionSchema):
| Field | Type | Required |
|---|---|---|
customerId | string (UUID) | Yes |
returnUrl | string | No |
Response 201:
{
"sessionId": "uuid",
"url": "https://kwit.dev/portal/ps_xxx",
"expiresAt": "2026-05-27T12:00:00.000Z"
}Redirect your customer to url so they can manage subscriptions, invoices, and billing details.
Errors: 400 validation, 404 customer not found.
const portal = await kwit.portal.sessions.create({
customerId: customer.id,
returnUrl: "https://your-app.com/account",
});