---
title: "Run TIC Risk Open on API data"
description: "Download a company's risk model input from the LENS API and score it on your own machine with TIC Risk Open, the open bankruptcy model: the same data and the same answer as TIC's own scores."
url: https://docs.tic.io/api-lens/risk-model-input
lastmod: 2026-11-10T13:27:05.000Z
---

# Run TIC Risk Open on API data

Download a company's risk model input from the LENS API and score it on your own machine with TIC Risk Open, the open bankruptcy model: the same data and the same answer as TIC's own scores.

[TIC Risk Open](https://huggingface.co/tic-oss/tic-risk-v2) is TIC's bankruptcy model for Swedish limited companies, published as open weights with a command, `tic-risk`, that scores a company on your own machine. The model reads a company's history as a set of files. The LENS API gives you those files for any aktiebolag, read from the same data TIC scores with, so the score you compute is TIC's score. You can also add your own data before you score.

1. Get the command and the model.
2. Download a company's input by its ID or by its organisationsnummer.
3. Check it and score it.

## Access

- A plan with `max` or `enterprise`.
- The API key needs the `risk-model-input` scope. The scope is not part of any plan: contact TIC to have it added to a key. Without it the endpoint returns `403` with the code `insufficient_permissions`.
- Each download counts as one request against the key's monthly limit (see [Rate limits](/api-lens/rate-limits)).
- Aktiebolag only, the companies the model was trained on. Another legal form returns `422` with the code `legal_form_not_scored`.

## 1. Get the command and the model

Download the signed Windows build or the static Linux build from the [tic-risk releases](https://github.com/the-intelligence-company/tic-risk/releases), then download the model (about 900 MB, every file checked against its SHA-256 checksum):

```bash
tic-risk download
```

The command runs offline on the CPU. Only `download` uses the network.

## 2. Download a company's input

By the company's internal ID ([Download the company's risk model input](/api-lens/companies/download-the-companys-risk-model-input)):

```bash
curl -H "x-api-key: YOUR_API_KEY" \
  -o company.zip \
  "https://lens-api.tic.io/companies/12345/risk/model-input"
unzip company.zip -d company
```

Or by its organisationsnummer, with or without the dash ([by registration number](/api-lens/companies/download-the-companys-risk-model-input-by-registration-number)):

```bash
curl -H "x-api-key: YOUR_API_KEY" \
  -o company.zip \
  "https://lens-api.tic.io/companies/by-registration-number/556677-8899/risk/model-input"
```

On Windows, use `Expand-Archive company.zip -DestinationPath company` in PowerShell.

The archive holds the files at its root, in the format the command reads (`tic-risk-input/1`):

| File | Content |
| --- | --- |
| `meta.json` | The format, the company's ID (`focal`), when the data was read (`read_at`), the dates the input was prepared for (`as_of`) and the company's name |
| `lives.csv` | The company and its related aktiebolag: ID, legal form, registration date and end date |
| `events.jsonl` | One event per line for the company and its related companies: annual reports and their figures, tax registrations, payroll declarations, late fees, enforcement debts, payment orders, registry cases, board changes and more. `t` is the day it happened and `ka` the day it became known |
| `relations.jsonl` | Ownership, auditor and role relations between the companies |
| `economy.jsonl` | The national economic series as they were published. Most of the archive's size |
| `sector.jsonl`, `calendar.jsonl` | Industry key figures for the company's industry and the years they were published. Can be empty |

The data is not anonymised. IDs are TIC's internal IDs, the same as everywhere in the LENS API, so `focal` is the company's `id` and a related company's ID can be looked up with [Get core company details](/api-lens/companies/get-core-company-details). Persons are not in the files: a board change says only which role started or ended.

## 3. Check and score

```bash
tic-risk check --input company
tic-risk score --input company --as-of 2026-11-10
```

`check` shows what the model reads on each date and anything it leaves out. `score` with one `--as-of` date, normally the `asOf` you downloaded for, prints the 12-month probability of bankruptcy with its risk class (1 = highest risk, 5 = lowest), a score from 0 to 100 and a 90 % interval, the risk history for the last 36 months, the other four predictions and the events that drive the score. It takes a few seconds.

Without `--as-of` the command scores every date the input was prepared for (`as_of` in `meta.json`, 37 dates with the default `monthsBack`) and adds a chart and a table of every prediction over time, which takes about half a minute. Add `--json` for one JSON line per date and prediction:

```bash
tic-risk --json score --input company --as-of 2026-11-10
```

`check` can warn about events for companies that are not in `lives.csv`. These are related companies of another legal form, such as an owning kommanditbolag. The model leaves them out, as TIC's own scoring does.

## The same answer as TIC

The response carries the model TIC scores with in two headers:

| Header | Description |
| --- | --- |
| `X-Tic-Risk-Release` | The model release |
| `X-Tic-Risk-Vocab-Hash` | The release's vocabulary hash |

When `X-Tic-Risk-Vocab-Hash` equals `vocab_hash` in the downloaded model's `checkpoint/manifest.json`, your model is TIC's. The probabilities, intervals, classes and scores are then TIC's. The model's raw output can differ by about one in a million, because TIC scores on a GPU and the command on the CPU.

## Earlier dates

The model only reads what was known on the date it scores, so one download can be scored as of earlier dates:

```bash
tic-risk score --input company --as-of 2025-05-10 --as-of 2025-11-10 --as-of 2026-05-10
```

The files hold the related companies the model reads on the dates they were prepared for: `asOf` (default today) and the same day of each of the `monthsBack` months before it (default 36, the months of the risk history). For another date the command warns that data on related companies may be missing; download with a larger `monthsBack` (at most 60) or an earlier `asOf` to cover it.

## Adding your own data

The input is plain text, so you can add what you know about the company before you score it: append lines to `events.jsonl` with the company's ID as `c` and the same event types and codes as the existing lines. Run `tic-risk check` afterwards: it lists event types, attributes and codes the model does not know, and those are left out. The code lists are in the [tic-risk repository](https://github.com/the-intelligence-company/tic-risk) under `crates/risk-tokens/texts/`.

## Errors

| Status | Code | Cause |
| --- | --- | --- |
| `400` | `invalid_registration_number` | The organisationsnummer is not valid (the registration-number route) |
| `403` | `insufficient_permissions` | The API key does not have the `risk-model-input` scope |
| `403` | `feature_required` | The plan does not include `max` or `enterprise` |
| `404` | - | The company does not exist or is not accessible |
| `422` | `legal_form_not_scored` | The company is not an aktiebolag |
| `422` | - | `asOf` is not a date, or `monthsBack` is above 60 |
| `503` | - | The risk model is temporarily unavailable |
