Create portal session

Create Portal session.

path parameters

  • userId



    The user ID.

    In addition to supporting the UserHub user ID, you can also pass in the User Provider external identifier in the format <externalId>@<connectionId> and if the user doesn't exist in UserHub they will automatically be imported.

body parameters

  • portalUrl


    The portal URL, this is the target URL on the portal site.

    If not defined the root URL for the portal will be used.

    This does not need to be the full URL, you have the option of passing in a path instead (e.g. /).

    You also have the option of including the {accountId} string in the path/URL which will be replaced with either the UserHub user ID (if organizationId is not specified) or the UserHub organization ID (if specified).


    • /{accountId} - the billing dashboard
    • /{accountId}/plans - select a plan to checkout
    • /{accountId}/checkout/<some-plan-id> - checkout specified plan
    • /{accountId}/cancel - cancel current plan
    • /{accountId}/members - manage organization members
    • /{accountId}/invite - invite a user to an organization
  • returnUrl


    The URL the user should be sent to when they want to return to the app (e.g. cancel checkout).

    If not defined the app URL will be used.

  • successUrl


    The URL the user should be sent after they successfully complete an action (e.g. checkout).

    If not defined the return URL will be used.

  • organizationId


    The organization ID.

    When specified the {accountId} in the portalUrl will be replaced with the organization ID, otherwise the user ID will be used.


  • redirectUrl


    The URL you should redirect the user to after calling create portal session.

curl \
  -H "Authorization: Bearer $ADMIN_API_KEY" \
Response bodyJSON
  "redirectUrl": ""
PreviousCreate API session
NextUser API

Turn users intorevenue

Subscribe to monthly product updates

© 2024 UserHub


    UserHub & Auth0UserHub & Stripe BillingUserHub & Google CloudUserHub & FirebaseUserHub & Custom Auth