Skip to main content
Issue a Session Token for a customer to create orders in your store, or — with 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.
Authentication: API Key

How It Works

  1. Your server calls this endpoint with API Key authentication
  2. You receive a short-lived session token
  3. Pass the token to the customer’s browser
  4. The customer uses the token (Authorization: Bearer <token>) to create orders and interact with checkout
Session tokens are scoped to a single store and expire automatically.

Customer Portal Mode

Pass purpose: "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.
The portal link is not single-use. Anyone holding it can open the portal as that customer while the session is alive. Treat the token and the full link as bearer credentials: mint them on your server right before the redirect, and never log them, store them, or send them by email.
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)

With 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 same X-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.