portal
Create portal session
Create a portal session for an end user and get the URL to redirect them to.
The URL carries a single-use exchange code valid for 15 minutes, which the portal redeems exactly once for a 24-hour access token via portal.exchangeCode.
Required Permissions
Your root key must be associated with a workspace that has an enabled portal.
post/v2/portal.createSession
Request body
Example request
{
"portal": "proj_1234abcd",
"externalId": "user_123",
"scopes": [
"keys:read",
"keys:reroll",
"analytics:read"
],
"returnUrl": "https://app.example.com/settings/api-keys"
}Response
Session created successfully. Redirect the end user to the returned URL.
Example response
{
"meta": {
"requestId": "req_123"
},
"data": {
"id": "ps_abc123def456",
"url": "https://portal.unkey.com/?code=pst_abc123def456"
}
}