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). - Read Manage contacts for how contacts become parties.
Add a company signatory
1
Find or create the company
Filter the company list by organization number first. The filter matches exactly and ignores a hyphen:If the response’s The response is the company:
data array is empty, create the company:country is an ISO 3166-1 alpha-2 country code and defaults to SE. Organization numbers are unique in the organization: creating a second company with the same number returns 409 ALREADY_EXISTS.2
Link a contact to the company
Create the contact with Replace
companyId and the person’s companyRole, or send them in a PATCH request to an existing contact:COMPANY_ID with the company id. The response is the contact, with the company in company.3
Add the contact as a company party
Reference the contact in a document’s Replace Send
parties. The party gets the person’s details and the company’s name and organization number, so its type is COMPANY:CONTACT_ID with the contact id. Without a contact, send name, email, and a company object on the party instead:company.name and company.orgNumber together or not at all. On the document, each party has its company in company, or null for a private individual. Template parties nest their company in company the same way. For more information, see Manage templates.Look up a company in the registry
To prefill a company from the external company registry, send aGET request to /api/v1/company-registry/ORG_NUMBER:
ORG_NUMBER with the organization number, with or without a hyphen. The response has the company’s basic details, with the organization number in basic.orgNumber, its address, legal form, VAT registration, business activity, signature rule, and the responsible persons, such as executives and board members. Results are cached for three days. The endpoint doesn’t create a company record; send a POST request to /api/v1/companies for that. For the full response, see Look up a company in the company registry.
List and get companies
GET /api/v1/companieslists companies, newest first.querymatches part of the name or organization number, andorgNumberandnamematch exactly. Every filter you pass must match. The response has the companies indata; whilehasMoreistrue, passnextCursorascursorto get the next page. For more information, see Pagination.GET /api/v1/companies/COMPANY_IDreturns the company. To list its contacts, callGET /api/v1/contacts?companyId=COMPANY_ID.
Choose between a company party and an individual party
A company party signs as a representative of the company, and the document shows both their name and the company. An individual party signs for themselves. When a person signs both for the company and personally, such as a CEO who also gives a personal guarantee, add them as two parties. To see who can sign for a Swedish company, read the signature rule from the registry lookup.Handle errors
400 VALIDATION_FAILED:nameis missing, or a party hascompany.namewithoutcompany.orgNumber.409 ALREADY_EXISTS: a company with the organization number exists. Use the existing one from the list.404 NOT_FOUNDfromcompany-registry: the registry has no company with the organization number.
Next steps
Manage contacts
Sync people into sajn contacts.
Set the signing method
Require an eID for company signatories.
List companies
See the company endpoints in the API reference.

