- With a national identity number: when you send
nationalId, BankID checks that the person has that number. - With the name: without
nationalId, BankID checks that the person’s name matchesfullName. Use this when you don’t need the identity number.
Before you begin
- Store your API key in the
SAJN_API_KEYenvironment variable. To create a key, go to workspace settings in the sajn app, then Utvecklare (Developer) > API-nycklar (API keys). - Subscribe a webhook endpoint to
identity_check.verified,identity_check.failed, andidentity_check.cancelled. For more information, see Webhooks. - Each check counts toward your organization’s monthly identity check quota.
Run an identity check
1
Create the check
Send a The request takes the following fields:
POST request to /api/v1/identity-checks. Creating the check also sends it, so there’s no separate send step:fullNameandchannelare required. With"channel": "SMS", sendphoneinstead ofemail.nationalIdmakes BankID check the identity number.referenceis your own ID for the check, returned in the check and its webhook events.contactIdlinks the check to a contact.languageis the language of the messages, as an ISO 639-1 code such asen. The default issv.expiresAtis when the link stops working. The default is seven days after creation.
id. Only this response has verificationUrl, in case you want to show the link yourself:2
Get the result
When the person finishes, sajn sends an Replace
identity_check.verified event. A failed or cancelled check sends identity_check.failed or identity_check.cancelled, and identity_check.failed adds the reason in data.failureReason. The event’s data.object is the check, so find your record by its reference:markVerified and markFailed stand for your own code. To verify the signature, see Verify webhook signatures. For the full event, see Webhook payloads.To read the check without webhooks, poll it:CHECK_ID with the check id. status moves through CREATED, SENT, OPENED, and ends at VERIFIED, FAILED, EXPIRED, or CANCELLED. A verified check also has verifiedAt, the BankID result in data, and its event history in audits.data contains personal data, such as the identity number. Store only what you need.
List checks
GET /api/v1/identity-checks lists the organization’s checks, newest first. Filter with status, such as status=VERIFIED,FAILED, and with createdAfter, createdBefore, updatedAfter, and updatedBefore. The response has the checks in data, each with audits, data, and verificationUrl set to null. To read audits and data, get the check by ID. While hasMore is true, pass nextCursor as cursor to get the next page. For more information, see Pagination.
Handle errors
400 VALIDATION_FAILED:fullNameorchannelis missing, the channel’s address is missing, orexpiresAtisn’t in the future.- A check with
statusFAILED: the person canceled, BankID failed, or the name or identity number didn’t match. The person can open the link again until it expires. Otherwise, create a new check. - A check with
statusEXPIRED: the person didn’t finish beforeexpiresAt. Create a new check.
Next steps
Verify identity before signing
Run a sajn ID check, then send a contract.
sajn ID
Learn how sajn ID works.
Set the signing method
Verify identity as part of signing instead.
Create an identity check
See the endpoint in the API reference.

