Legacy Portal Sessions
Create short-lived customer portal links.
Legacy (v1) API. This page describes the Stripe-first legacy API. It stays supported for existing integrations but is frozen: new features ship only in v2. Prefer v2 for new work: Customer portal and admin links.
POST /api/billstack/teams/{teamId}/projects/{projectId}/portal/by-external-idAuth
Private API key. If called with a dashboard session instead of an API key, the caller needs project admin permission; API key callers are not subject to this check.
Body
{
"externalId": "user_123",
"ttlMs": 900000
}ttlMs is optional and capped by BillStack.
Response
Returns 201 Created.
{
"sessionId": "ps_...",
"token": "...",
"portalUrl": "https://billing.w3dev.app/portal/...",
"expiresAt": "2026-06-12T12:00:00.000Z"
}Redirect the user to portalUrl. The body also includes url, equal to portalUrl, as a deprecated alias for SDK versions before 0.4.1. The default session lifetime is 24 hours and the maximum is 7 days.
The hosted page at portalUrl serves Stripe and Razorpay customers; see Customer portal. This differs from the v2 POST .../v2/.../portal route, which returns a provider-hosted portal (Stripe only).
Errors
| Status | Meaning |
|---|---|
400 | externalId is missing from the body |
404 | No project customer exists for the external ID |
If you already hold an internal BillStack customerId (rather than your app's external ID), use POST /api/billstack/teams/{teamId}/projects/{projectId}/portal instead. It takes { customerId, ttlMs? } and returns the identical response shape.