Skip to Content

Start a sajn Login session

You're viewing API version 2026-09, which is deprecated and stops working on October 1, 2027. To move your integration, see Upgrading to 2026-10.
POST
/api/v1/login/sessions

Create a hosted login session and get a URL to send the user to.

Use this when you don't want to run an OIDC client — typically a native app that opens loginUrl in an in-app browser.

Flow:

  1. POST here to get loginUrl
  2. Open it; the user authenticates with BankID on sajn's hosted page
  3. We redirect to your redirectUri with ?sessionId=… (and ?state=… if you sent one)
  4. GET /api/v1/login/sessions/{id} from your server to read the result

The redirect is only a handle. Never trust it as proof of authentication — anyone can craft that URL. The server-side GET is the authoritative read, because it is authenticated as your organization.

redirectUri must be registered on the client. Custom schemes (myapp://auth) are supported so the in-app browser can dismiss straight back into your app.

Authorization

headerAuthorizationBearer <token>

Personal API key, e.g. Authorization: Bearer sajn_sk_.... Not scope-limited — acts as the issuing user.

Header Parameters

authorization*string

Bearer token for API authentication

Idempotency-Key?string

Makes retries safe. A retry with the same key and the same request replays the stored response for 24 hours (header Idempotent-Replayed: true); the same key with a different request returns 400.

Lengthlength <= 255

Request Body

Body

application/json
  1. body
clientId*string

The sajn Login client to authenticate against.

Length1 <= length
redirectUri*string

Where to send the user when authentication finishes. Must be registered on the client.

Length1 <= length
state?string

Opaque value echoed back on the redirect and in the session result.

Lengthlength <= 512

Response Body

200

application/json
  1. response
id*string
loginUrl*string

Open this in a browser or in-app browser to authenticate the user.

expiresAt*string
Example Request
curl -X POST 'https://app.sajn.se/api/v1/login/sessions' \  -H 'authorization: string' \  -H 'Content-Type: application/json' \  -d '{  "clientId": "string",  "redirectUri": "string"}'
Example Response
{  "id": "string",  "loginUrl": "string",  "expiresAt": "string"}

Was this page helpful?