Skip to the text
SEDIS Partner API API reference

Keys, sign-in and limits

There are two ways in. Who is calling decides which one.

Who is calling How Can
A system: an integration, a report server, a nightly job An organisation key in X-Api-Key Read and write
A person: you, in a script of your own or in an AI app Your own Sedis account, with two-factor authentication Read

Organisation keys

Sedis issues the key. Write to info@sedis.se.

  • It is a password for your company's data. Keep it in a secret store on a server. Never put it in a web page, an app, version control or a log, and do not give it to people: they sign in with their own accounts.
  • Have several. One for each system and environment, so that one can be changed without stopping the others. Each has its own limits.
  • Change it without a stop. Ask for a new one, switch your systems over, then ask us to revoke the old one.
  • If it has leaked, tell us at once. A revoked key stops working within about a minute, and after that the answer is 401.

A key reaches the products that were chosen for it, and always your own company's data.

Sign in as a person

If you write a script or a notebook for yourself, sign in with your own account. You need:

  • two-factor authentication on your Sedis account (Mitt konto › Tvåfaktorsautentisering)
  • access to Fråga Sedis and the API, which Sedis opens for you. Ask info@sedis.se.

You reach the products you have on the web, and no more.

The script uses the device flow of OAuth 2.0 (RFC 8628). It prints a link, you open the link and confirm with your two-factor code, and the script continues:

import json
import pathlib
import time

import requests

LOGIN = "https://app.sedis.se/connect"
SAVED = pathlib.Path.home() / ".sedis-token.json"  # as secret as a password


def token(**form):
    return requests.post(f"{LOGIN}/token", data={"client_id": "sedis-cli", **form}, timeout=30).json()


def sign_in():
    device = requests.post(f"{LOGIN}/device", timeout=30, data={
        "client_id": "sedis-cli",
        "scope": "sedis.bolagsanalys sedis.fastighetsbenchmark offline_access"}).json()
    print(f"Open {device['verification_uri_complete']}\nand check that it shows {device['user_code']}")
    while True:
        time.sleep(5)
        answer = token(grant_type="urn:ietf:params:oauth:grant-type:device_code", device_code=device["device_code"])
        if "access_token" in answer:
            return answer
        if answer["error"] not in ("authorization_pending", "slow_down"):
            raise SystemExit(f"Not signed in: {answer['error']}")


saved = json.loads(SAVED.read_text()) if SAVED.exists() else {}
answer = token(grant_type="refresh_token", refresh_token=saved["refresh_token"]) if saved else {}
if "access_token" not in answer:
    answer = sign_in()
SAVED.write_text(json.dumps(answer))

session = requests.Session()
session.headers["Authorization"] = f"Bearer {answer['access_token']}"
companies = session.get("https://api.sedis.se/v2/bolagsanalys/companies", params={"pageSize": 5}, timeout=30)
companies.raise_for_status()
print([company["name"] for company in companies.json()["data"]])

Good to know:

  • A sign-in lasts a week from the two-factor code, whatever the script does. Then it asks again. That is deliberate: a connection cannot be handed on to somebody who does not have your code.
  • The access token lasts an hour. The script gets a new one with the refresh token. Each refresh token works once, so always save the latest.
  • Never confirm a link that somebody else has sent you. It would give them your access.
  • See and end your sign-ins under Mitt konto › Anslutna AI-appar on Sedis. If you change your password or your two-factor authentication, all of them end.
Scope Gives
sedis.bolagsanalys Bolagsanalys
sedis.fastighetsbenchmark Fastighetsbenchmark
offline_access A refresh token

Every address a client needs is in /.well-known/oauth-authorization-server. A token for the API does not work in Fråga Sedis, or the other way round.

Rate limits

There is a limit per second and one per minute. They are counted for each key, or each person, and separately for Bolagsanalys and Fastighetsbenchmark.

Level Per second Per minute
Standard 20 600
HighVolume 60 2000
Enterprise 200 6000

You have Standard if nothing else has been agreed. Calls that write have a limit of their own: 60 per minute on every level. Send many property units in one upload rather than one call each.

Past a limit the answer is 429 Too Many Requests, and Retry-After says how many seconds to wait. Wait that long and try again. To stay below the limits, ask for 500 rows at a time and do not run many calls in parallel.

Next: Errors