Skip to content

Portal

portal


POST /api/v1/portal/sessions

Create Portal Session

Description

Create a link to the SweatStack Portal, branded for your app.

Authenticate with the user's access token. destination is usually issue.destination from userinfo or /profile/status. return_url renders as "Back to {your app}" and follows the same rule as an OAuth redirect_uri: it must equal or sit under one of your registered redirect URIs. Without it the Portal tells the user to close the page.

Create the link when the user acts and send them straight there: do not store or reuse it. A delegated token gets 403, a token that belongs to no application 400.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
refreshed-token header No
token cookie string No

Request body

{
    "destination": "manage-teams",
    "return_url": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "destination": {
            "$ref": "#/components/schemas/PortalDestination"
        },
        "return_url": {
            "anyOf": [
                {
                    "type": "string",
                    "maxLength": 2048
                },
                {
                    "type": "null"
                }
            ],
            "title": "Return Url"
        }
    },
    "type": "object",
    "required": [
        "destination"
    ],
    "title": "PortalSessionRequest",
    "description": "Request body for `POST /api/v1/portal/sessions` (plan 076).\n\nThe caller authenticates with the user's access token; the app is the token's `aud`, so the\nbody carries nothing about the app. `destination` is usually `issue.destination` from the\naccount status. `return_url` renders as \"Back to {app}\" and must pass the same rule as an\nOAuth `redirect_uri` (`Logic._validate_redirect_uri`); without it the Portal tells the user\nto close the page."
}

Responses

{
    "url": "string"
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "url": {
            "type": "string",
            "title": "Url"
        }
    },
    "type": "object",
    "required": [
        "url"
    ],
    "title": "PortalSessionResponse"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

HTTPValidationError

Name Type Description
detail Array<ValidationError>

PortalDestination

Type: string

PortalSessionRequest

Name Type Description
destination PortalDestination
return_url

PortalSessionResponse

Name Type Description
url string

ValidationError

Name Type Description
loc Array<>
msg string
type string

Security schemes

Name Type Scheme Description
HTTPBearer http bearer
HTTPBasic http basic