Skip to Content
Login

Start an eID attempt in your own UI

POST
/api/v1/login/sessions/{id}/start

Authenticate the user in your own interface instead of sajn's hosted page. You show the QR code and the button that opens the eID app; sajn talks to the eID provider.

Flow:

  1. POST /api/v1/login/sessions to create the session
  2. POST here, from your server, with the user's IP address. Show qrCode on desktop, or open autoStartUrl from a tap on mobile
  3. POST /api/v1/login/sessions/{id}/poll every 1 to 2 seconds and show the new qrCode
  4. When status is COMPLETED, read the result with GET /api/v1/login/sessions/{id}

Calling this again while an attempt runs returns that attempt. After a FAILED or EXPIRED attempt, calling it starts a new one while attemptsRemaining is above 0. The client must use your own BankID certificate.

Authorization

headerAuthorizationBearer <token>

API key, e.g. Authorization: Bearer sajn_svc_.... Not scope-limited: acts with its owner's workspace role.

Path Parameters

id*string

The login session ID, from POST /api/v1/login/sessions.

Header Parameters

Sajn-Version?string

API 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.

Value in"2026-09""2026-10"
Sajn-Workspace?string

ID 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?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
method?"SE_BANKID"

The eID to authenticate with, such as SE_BANKID. Leave it out when the client allows one method.

Value in"SE_BANKID"
endUserIp*|

The IP address of the person authenticating, as your server sees it. Never your server's own address.

userAgent?string

The user agent of the person's browser. It improves the eID provider's risk check and lets autoStartUrl return to the right browser.

Lengthlength <= 1024
returnUrl?string

Where the eID app sends a user on the same device when they are done. Must be registered on the client. Leave it out and the user switches back by hand.

Response Body

200

application/json
  1. response
id*string

The login session.

method*"SE_BANKID"
Value in"SE_BANKID"
qrCode*|

Render this as a QR code for a user on another device. It changes every second, so show the qrCode from each poll.

autoStartToken*|

Opens the eID app on this device if you build the link yourself. Null when the call resumed an attempt that was already running.

autoStartUrl*|

Open this on the user's device, from a tap, to launch the eID app. Null when the call resumed an attempt that was already running.

expiresAt*string

When the user must have finished this attempt by.

Formatdate-time
Example Request
curl -X POST 'https://app.sajn.se/api/v1/login/sessions/cm4k2x9p10033abcd1234efgh/start' \  -H 'Content-Type: application/json' \  -d '{  "method": "SE_BANKID",  "endUserIp": "192.0.2.10",  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15",  "returnUrl": "https://example.com/logga-in"}'
Example Response
{  "id": "cm4k2x9p10033abcd1234efgh",  "method": "SE_BANKID",  "qrCode": "bankid.67df3917-fa0d-44e5-b327-edcc928297f8.7.dd5bb5f5e2a4fbb09bc6eaaa0a5fd1f3e2a1b7d4e0c9f8a6b5d4c3b2a1908f7e",  "autoStartToken": "7c40b5c9-fa74-49cf-b98c-bfe651f9a7c6",  "autoStartUrl": "https://app.bankid.com/?autostarttoken=7c40b5c9-fa74-49cf-b98c-bfe651f9a7c6&redirect=null",  "expiresAt": "2026-10-28T22:00:00.000Z"}

Was this page helpful?