Skip to content

Search Sweden Sites

Popular searches

Shortcuts

Can’t find what you’re looking for?

Go to the search page

PersonAPI

How to look up name, address and company roles from a Swedish personal number – step by step, with ready-made code examples.

How it works

Your system sends a personal number and gets back the details you ask for – in one call from your server.

  1. 1Your server askswith the personal number and the fields you want.
  2. 2We check the keyand that your account is active.
  3. 3We look the person upin the population register and the company register.
  4. 4You get the answeras JSON – only the fields you asked for.

What you need

  • API keyA password only your server knows.
  • A serverThe call is made from your server, never from the browser.
  • A legal basisYou are responsible for having a GDPR basis for every lookup.

The key is in My pages → PersonAPI. Get your key →

Would you rather have us connect PersonAPI for you? Contact us

Get started

It takes two steps. You get your API key in My pages and let your server send a call with the personal number.

Step 1: Get your API key

You get the key at once when you order PersonAPI, and you can always make a new one in My pages → PersonAPI. It works like a password: keep it on your server only, for example in an environment variable, never in a web page or app. Whoever has the key can make lookups on your account.

Step 2: Send a lookup

Send the personal number and the fields you want back. Choose the language your server is written in:

[[tabs: PHP | Node.js | curl]]

<?php
$ch = curl_init('https://swedensites.com/api/personapi.php');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTPHEADER => ['Content-Type: application/json', 'Authorization: Bearer ' . getenv('PERSONAPI_KEY')],
    CURLOPT_POSTFIELDS => json_encode(['pnr' => '198001011234', 'toReturn' => ['usedName', 'lastName', 'street', 'postalcode', 'city']]),
]);
$answer = json_decode((string) curl_exec($ch), true);

if (($answer['responseCode'] ?? 0) === 2000) {
    // $answer['result']['usedName'], $answer['result']['street'] …
}
const r = await fetch('https://swedensites.com/api/personapi.php', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${process.env.PERSONAPI_KEY}` },
  body: JSON.stringify({ pnr: '198001011234', toReturn: ['usedName', 'lastName', 'street', 'postalcode', 'city'] }),
});
const answer = await r.json();

if (answer.responseCode === 2000) {
  // answer.result.usedName, answer.result.street …
}
curl -X POST https://swedensites.com/api/personapi.php \
  -H "Authorization: Bearer $PERSONAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pnr":"198001011234","toReturn":["usedName","lastName","street","postalcode","city"]}'

The answer comes as JSON:

{
  "success": true,
  "responseCode": 2000,
  "message": "",
  "result": {
    "usedName": "Anna",
    "lastName": "Andersson",
    "street": "Storgatan 12",
    "postalcode": "12345",
    "city": "Stad"
  }
}

Done! The personal number in the examples is made up – use a real one.

The call

Everything goes to one address, always with POST:

POST https://swedensites.com/api/personapi.php
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Field Type Description
pnr text The Swedish personal number. Preferably 12 digits (YYYYMMDDNNNN); 10 digits and a hyphen work too.
toReturn list The fields you want back (see below). Left out, you get usedName, street, postalcode and city.

Only ask for the fields you actually need. It is good for privacy, and the answer is smaller.

The fields

Field Type Contents
firstName text All first names, as in the population register.
usedName text The preferred first name. Only when it is known.
lastName text The surname.
co text A c/o address, when the person has one.
street text Street address.
postalcode text Postcode, five digits.
city text Postal town.
ssnStatus text The status of the personal number in the register, for example whether the person has died or emigrated.
companiesExist yes/no true if the person has company roles.
companies list The companies the person is involved in (see below).

When there is no answer for a field it is left out, and its name is in message, for example "Inget svar för: co." (no answer for).

Company roles

Each company in companies:

Field Contents
organizationNumber The organisation number, ten digits.
companyName The company’s name.
typeOfCommitment The roles in words (Swedish), for example "Styrelseledamot, Verkställande direktör" (board member, CEO).
functions The roles as codes, for example ["LE", "VD"].
companyCode The legal form as a code, as the register gives it.
soleProprietorship true for a sole trader. The organisation number is then the owner’s personal number – handle it accordingly.
registrationYear The year the company was registered, or null when not known.
url A link to the company on allabolag.se, or null for a sole trader.
"companies": [
  {
    "organizationNumber": "5566778899",
    "companyName": "Andersson Konsult AB",
    "typeOfCommitment": "Styrelseledamot, Verkställande direktör",
    "functions": ["LE", "VD"],
    "soleProprietorship": false,
    "registrationYear": 2015,
    "url": "https://www.allabolag.se/5566778899"
  }
]

Answers and error codes

Every answer has the same shape: success, responseCode, message and result. Look at responseCode – 2000 means the lookup went well. Messages are in Swedish.

HTTP responseCode Means Billed
200 2000 The lookup went well. Yes
401 4010 The API key is missing or wrong. No
403 4030 The account is paused or ended. No
405 4050 The call was not made with POST. No
422 4220 pnr is not a valid personal number. No
422 4221 toReturn is not a list of field names. No
429 4290 Too many calls – wait a minute. No
502 5020 The lookup could not be made right now. Try again shortly. No
502 5021 The register answered with an error. The reason is in message. No
503 5030 The service is temporarily unavailable. No

Only lookups answered 2000 are billed.

Limits

  • At most 60 calls a minute per account. Going over gives 429 and the header Retry-After: 60.
  • Every successful lookup is billed, also when you ask about the same person again. Keep the answer on your side if you need it more than once.
  • Wait up to 30 seconds for an answer before giving up.

Security and GDPR

A personal number is sensitive, and whoever makes a lookup is responsible for it being allowed.

  • Legal basis. You are responsible for having a basis in the GDPR for every lookup, for example a contract with the person or a legal obligation.
  • The key stays on the server. Never call PersonAPI from a browser or app – anyone could then see the key.
  • Everything is logged. Every lookup – when, from which address and the answer – is kept and shown in My pages, where you can also export the log.
  • Has the key leaked? Contact us at once and we replace it.

Versions

Version Date Change
v1 2026-12-03 The first version of the documentation.

Help

Stuck? Write to info@swedensites.com and tell us what happens – ideally with the responseCode and the time of the call. Never send your API key. We are also happy to connect PersonAPI for you.

Cookie settings

Choose which cookies we may use. You can change your mind at any time under Cookie settings at the bottom of the page.

Read more in our cookie policy

Would you like to start the chat?

To use the chat, you need to accept the cookies the chat needs to work.

Read more in our cookie policy and privacy policy.

AI summary

The reply is written by AI based on this entry. Check important details with us.