purpose: "portal" — to sign an already signed-in customer of your site into your store’s customer portal without email verification. This is an API Key exclusive endpoint.
How It Works
- Your server calls this endpoint with API Key authentication
- You receive a short-lived session token
- Pass the token to the customer’s browser
- The customer uses the token (
Authorization: Bearer <token>) to create orders and interact with checkout
Customer Portal Mode
Passpurpose: "portal" to get a link into the customer portal for the customer your site has already signed in. The call is the same; these rules change:
To send the customer into the portal, append
#token=<token> to portalUrl and answer the customer’s browser with a 302 redirect to the result. The SDK helpers build this URL for you — see Let Signed-In Customers Manage Orders.
A portal token is bound to its environment. If you also call the Customer Portal API with it, send an X-Environment header that matches the API Key’s environment; any other value is rejected with 403 Environment mismatch.
Requests without purpose behave exactly as before.
Request Body
Example Request
Success Response (200)
purpose: "portal":
Response Fields
Errors
Retry policy: Never retry 4xx — fix the request and resubmit. Retry 5xx with exponential backoff (start 5s, max 3 attempts).
Two pitfalls worth knowing
Do not reuse one idempotency key to mint tokens. Sending the sameX-Idempotency-Key on repeated calls hits the platform’s 24-hour cache and replays the FIRST response — handing you a token that expired long ago. The SDKs no longer derive keys, so this only happens if you set the header yourself (directly over REST, or by passing the same idempotencyKey twice). If you mint tokens for the same buyer repeatedly (a token-refresh endpoint, a plan-change link generator), use a fresh key per call or none at all.
Mint right before you redirect. The token lives 15 minutes (sliding), while a checkout or plan-change session lives 24 hours by default. A token minted alongside the session and parked in a queue or an email will be dead by the time the buyer clicks. For plan-change links specifically, the token goes in the URL fragment — see Building the link the customer opens.