DEV Community

Gio Rich
Gio Rich

Posted on

Building a Latvian B2B prospect list with turnover and headcount from the open company register (Python)

I built this actor; it's a paid tool on Apify with a free trial credit.

Latvia publishes its whole company register as open data. The Register of Enterprises (Uzņēmumu reģistrs, UR) puts every company on data.gov.lv: registration number, name, legal form, status, registration date and legal address. It also publishes the annual reports companies file, so you can see employees, net turnover, net income, total assets and equity for most established firms. In early November 2026 it held 140,324 active limited companies (SIA).

The catch is that it comes as separate datasets: the register in one, the financial statements in others, keyed by registration number and report ID. Joining them by hand is fine once. If you want "every SIA in Liepāja with at least 10 staff and a profit last year" every month, you want an API. I'm an 18-year-old engineering student, and I built Latvia Company Register & Financials Scraper to do that join for you. This post covers calling it from Python and Node, what a row looks like, and a small project: a ranked shortlist of established, profitable companies in one town.

How it works

The actor queries the UR datasets on data.gov.lv over plain HTTP (no browser, no login). It filters the register by town, legal form, name word or registration date, then looks up each company's newest annual report. If a group files both a stand-alone and a consolidated report, it uses the company's own one and tells you which one it is (financials.consolidated). Amounts filed in thousands of euros are scaled to whole euros, so the numbers are comparable across companies.

The town filter matches the place parts of the legal address, not the street. Liepāja won't pick up "Rīga, Liepājas iela", which is a common mistake if you just search the address text. Accents are optional.

People-run forms (individual merchants, individual and family enterprises) are never output. They're usually named after the owner, and this is a company list.

Python example

pip install apify-client
Enter fullscreen mode Exit fullscreen mode
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")

run = client.actor("rel8ble/latvia-company-register").call(run_input={
    "towns": ["Rīga", "Mārupes nov."],
    "companyTypes": ["SIA", "AS"],
    "minEmployees": 50,
    "includeFinancials": True,
    "maxResultsPerSearch": 200,
})

for c in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(c["registrationNumber"], "|", c["nameInQuotes"], "|", c["employees"], "staff |",
          c["netTurnover"], "EUR |", c["town"])
Enter fullscreen mode Exit fullscreen mode

Companies below minEmployees or minTurnover are read but not saved, so you don't pay for them. Each town is its own search with its own row limit.

Node example

npm install apify-client
Enter fullscreen mode Exit fullscreen mode
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });

// New companies: Riga SIA registered since 1 October, newest first
const run = await client.actor('rel8ble/latvia-company-register').call({
    towns: ['Rīga'],
    companyTypes: ['SIA'],
    registeredFrom: '2026-10-01',
    sortOrder: 'newest',
    includeFinancials: false,
    maxResultsPerSearch: 0,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length, 'new Riga companies');
Enter fullscreen mode Exit fullscreen mode

When I ran that on 7 November 2026 it gave 512 companies. New companies have no annual report yet, so turn financials off for this kind of search. Size filters can't work on them either.

What a row looks like

Real row from the prefilled demo (active SIA in Liepāja, oldest first, 7 November 2026), trimmed:

{
    "registrationNumber": "42102001645",
    "nameInQuotes": "MŪRNIEKS",
    "type": "SIA",
    "typeEn": "Limited liability company (SIA)",
    "register": "Commercial register",
    "registered": "1991-04-30",
    "status": "active",
    "address": "Liepāja, Krūmu iela 11/13",
    "postalCode": "LV-3401",
    "town": "Liepāja",
    "financialYear": 2025,
    "employees": 63,
    "netTurnover": 2368333,
    "netIncome": 200684,
    "totalAssets": 1016357,
    "equity": 831327,
    "financials": { "periodEnd": "2025-12-31", "consolidated": false, "currency": "EUR", "filedAt": "2026-04-22" }
}
Enter fullscreen mode Exit fullscreen mode

The full row also has the Latvian and English legal form names, strike-off date, SEPA creditor ID, gross profit, profit before tax, cash and current liabilities.

Small project: a shortlist of established, profitable companies in one town

A raw register list is mostly noise. In the 20-row Liepāja demo, 6 companies showed zero turnover and 6 had negative equity: dormant shells and holding vehicles that you don't want to call. The script below keeps companies with real staff, a profit and a healthy balance sheet, then ranks them by turnover.

from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("rel8ble/latvia-company-register").call(run_input={
    "towns": ["Liepāja"],
    "companyTypes": ["SIA"],
    "sortOrder": "oldest",
    "minEmployees": 10,
    "maxResultsPerSearch": 500,
})
rows = list(client.dataset(run["defaultDatasetId"]).iterate_items())

def margin(c):
    return c["netIncome"] / c["netTurnover"] if c.get("netTurnover") else None

def equity_ratio(c):
    return c["equity"] / c["totalAssets"] if c.get("totalAssets") else None

keep = [c for c in rows
        if (margin(c) or 0) > 0 and (equity_ratio(c) or 0) >= 0.3]

for c in sorted(keep, key=lambda c: -c["netTurnover"]):
    print(f'{c["nameInQuotes"]:<28} {c["employees"]:>4} staff  '
          f'EUR {c["netTurnover"]:>10,}  margin {margin(c):6.1%}  '
          f'equity {equity_ratio(c):4.0%}  {c["registrationNumber"]}')
print(len(keep), "of", len(rows), "companies kept")
Enter fullscreen mode Exit fullscreen mode

On the 20 real demo rows, 8 companies had at least 10 employees. 3 of those made a loss in their 2025 accounts (one at -42.6% margin) and one had only 27% equity, which leaves 4:

LIEPĀJAS ŪDENS                138 staff  EUR  6,822,786  margin   7.0%  equity  48%  42103000897
MŪRNIEKS                       63 staff  EUR  2,368,333  margin   8.5%  equity  82%  42102001645
ARHITEKTA G.VĪKSNAS BIROJS     13 staff  EUR  1,052,672  margin  24.0%  equity  71%  42103000401
DENTISTS                       15 staff  EUR    786,662  margin   7.1%  equity  88%  42103000986
4 of 8 companies kept
Enter fullscreen mode Exit fullscreen mode

Turnover per employee is worth adding as a column too. For those 8 companies it ran from about EUR 20,000 to EUR 81,000, and it tells you more about a firm's business model than headcount alone. Swap the town and floors, schedule it monthly, and diff against last month's registration numbers to catch companies that newly crossed your size line after filing their accounts (15 of the 20 reports in this sample were filed between April and June 2026).

Things to know

  • Price: $0.90 per 1,000 companies, no start fee, financials included. 100 companies cost $0.09. Rows filtered out by your size floors are not charged.
  • No contact data: the open register has no e-mails, phone numbers, websites or people, so you'll need a second step for contacts. It has no NACE industry codes either. Use name words (koks, būv, logistics) or the size filters instead.
  • Financials lag: the newest report is usually last year's, and companies younger than a year have none.
  • Legal address: this is the registered address, which for small firms is often an accountant's office.

Questions or broken fields: the Issues tab on the actor page comes straight to me.

Latvia Company Register & Financials Scraper on Apify

Need a custom scraper or a ready dataset? Hire me on Fiverr: https://www.fiverr.com/rel8ble


This article was drafted with AI and published by me.

Top comments (0)