Skip to main content

create-session

Create a short-lived Customer Portal session
1 min read

Create an exchange code valid for 15 minutes and exchangeable exactly once for a 24-hour portal access token. Redirect the end user to the returned URL.

Usage#

Flags#

--portalstringrequired#
Portal configuration ID or slug.
--external-idstringrequired#
The end user's identifier in your system.
--scopesstring[]required#
Capabilities: keys:read, keys:create, keys:reroll, and analytics:read.
--previewbool#
Create a preview session for testing.

Default: "false"

--return-urlstring#
Absolute URL to return the end user to when they leave the portal.

Global Flags#

FlagTypeDescription
--root-keystringOverride root key ($UNKEY_ROOT_KEY)
--api-urlstringOverride API base URL (default: https://api.unkey.com)
--configstringPath to config file (default: ~/.unkey/config.toml)
--outputstringOutput format, use json for raw JSON
--bodystringSend this JSON string as the request body. You cannot combine it with request-building flags.

Examples#