POST/admin/v1/users/{userId}:createPortalSession

Create portal session

Create Portal session.

path parameters

  • userId

    string

    Required

    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

    string

    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).

    Examples:

    • /{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

    string

    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

    string

    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

    string

    The organization ID.

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

Returns

  • redirectUrl

    string

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

curl https://api.userhub.com/admin/v1/users/auth0%7C123456789@conn_26yEiYymqy6ZmG:createPortalSession \
  -H "Authorization: Bearer $ADMIN_API_KEY" \
  -X POST
Response bodyJSON
{
  "redirectUrl": "https://billing.example.com/signin?token=eyJhbGciOiJI..."
}
PreviousCreate API session
NextUser API

Turn users intorevenue
$

Subscribe to monthly product updates

© 2024 UserHub

Integrations

    UserHub & Auth0UserHub & Stripe BillingUserHub & Google CloudUserHub & FirebaseUserHub & custom auth