Skip to main content
In this guide, you create a company record, link a contact to it, and add that contact to a document as a party who signs on behalf of the company. A company party’s name, company name, and organization number appear on the document and in the signing certificate.

Before you begin

  • Store your API key in the SAJN_API_KEY environment 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 data array is empty, create the company:
The response is 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 companyId and the person’s companyRole, or send them in a PATCH request to an existing contact:
Replace 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 parties. The party gets the person’s details and the company’s name and organization number, so its type is COMPANY:
Replace CONTACT_ID with the contact id. Without a contact, send name, email, and a company object on the party instead:
Send 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 a GET request to /api/v1/company-registry/ORG_NUMBER:
Replace 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/companies lists companies, newest first. query matches part of the name or organization number, and orgNumber and name match exactly. Every filter you pass must match. The response has the companies in data; while hasMore is true, pass nextCursor as cursor to get the next page. For more information, see Pagination.
  • GET /api/v1/companies/COMPANY_ID returns the company. To list its contacts, call GET /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: name is missing, or a party has company.name without company.orgNumber.
  • 409 ALREADY_EXISTS: a company with the organization number exists. Use the existing one from the list.
  • 404 NOT_FOUND from company-registry: the registry has no company with the organization number.
For the error shape and every code, see Errors.

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.