Start an eID attempt in your own UI
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:
POST /api/v1/login/sessionsto create the sessionPOSThere, from your server, with the user's IP address. ShowqrCodeon desktop, or openautoStartUrlfrom a tap on mobilePOST /api/v1/login/sessions/{id}/pollevery 1 to 2 seconds and show the newqrCode- When
statusisCOMPLETED, read the result withGET /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.
AuthorizationBearer <token>API key, e.g. Authorization: Bearer sajn_svc_.... Not scope-limited: acts with its owner's workspace role.
id*stringThe login session ID, from POST /api/v1/login/sessions.
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
method?"SE_BANKID"The eID to authenticate with, such as SE_BANKID. Leave it out when the client allows one method.
"SE_BANKID"endUserIp*|The IP address of the person authenticating, as your server sees it. Never your server's own address.
userAgent?stringThe user agent of the person's browser. It improves the eID provider's risk check and lets autoStartUrl return to the right browser.
length <= 1024returnUrl?stringWhere 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.
200
application/json- response
id*stringThe login session.
method*"SE_BANKID""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*stringWhen the user must have finished this attempt by.
date-timecurl -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"}'{ "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?