Start a sajn Login session
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:
POSThere to getloginUrl- Open it; the user authenticates with BankID on sajn's hosted page
- We redirect to your
redirectUriwith?sessionId=…(and?state=…if you sent one) 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.
AuthorizationBearer <token>API key, e.g. Authorization: Bearer sajn_svc_.... Not scope-limited: acts with its owner's workspace role.
Sajn-Version?stringAPI version for this request. Without it, the request uses the organization's default version; an organization without a default is pinned to the latest version by its first request.
"2026-09""2026-10"Sajn-Workspace?stringID of the workspace this request acts in, from GET /api/v1/workspaces. Without it, an API key acts in its default workspace. The token's user must be a member of the workspace; an OAuth token only accepts the workspace it was granted for. A workspace that doesn't exist or can't be reached returns 403 WORKSPACE_ACCESS_DENIED.
Idempotency-Key?stringMakes 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.
length <= 255Body
application/json- body
clientId*stringThe sajn Login client to authenticate against.
1 <= lengthredirectUri*stringWhere to send the user when authentication finishes. Must be registered on the client.
1 <= lengthstate?stringOpaque value echoed back on the redirect and in the session result.
length <= 512200
application/json- response
id*stringThe sajn Login session ID.
status*string"PENDING""COMPLETED""FAILED""EXPIRED"method*|The eID the user authenticated with, such as SE_BANKID. Null until status is COMPLETED.
"SE_BANKID""NO_BANKID_BIOMETRIC""NO_BANKID_HIGH""NO_QES""DK_MITID""DK_MITID_ERHVERV""FI_FTN""NL_IDIN""ZEALID_QES"nullcompletedAt*|date-timestate*string|nullsub*string|nullclaims*|The claims your client is approved for. A claim it isn't approved for is null.
loginUrl*|Open this in a browser or an in-app browser to authenticate the user. Set only in the response to the create request; null otherwise.
expiresAt*|When the user must have authenticated by. Set only in the response to the create request; null otherwise.
date-timecurl -X POST 'https://app.sajn.se/api/v1/login/sessions' \ -H 'Content-Type: application/json' \ -d '{ "clientId": "cm4k2x9p10039abcd1234efgh", "redirectUri": "https://example.com/auth/callback", "state": "f9a1c2e3"}'{ "id": "cm4k2x9p10033abcd1234efgh", "status": "COMPLETED", "method": "SE_BANKID", "completedAt": "2026-09-29T07:41:00.000Z", "state": "f9a1c2e3", "sub": "sajn|7f3e1c92b4", "claims": { "sub": "sajn|7f3e1c92b4", "amr": [ "SE_BANKID" ], "auth_time": 1790667660, "name": "Kai Lindqvist", "given_name": "Kai", "family_name": "Lindqvist", "birthdate": "1990-01-01", "nin": "191212121212", "nin_type": "SE_PERSONNUMMER" }, "loginUrl": "https://login.sajn.se/l/cm4k2x9p10033abcd1234efgh/open", "expiresAt": "2026-10-28T22:00:00.000Z"}Was this page helpful?