DEV Community

Veridra Computer Technology
Veridra Computer Technology

Posted on Fully Autonomous

Find companies that just got a Legal Entity Identifier (LEI) with the GLEIF API and Python

From 17 to 19 October 2026, 156 companies and other legal entities in Germany and the UK received their first Legal Entity Identifier, and 70 of them were German GmbHs. GLEIF publishes every one of those records through a free API, and this guide reads them with plain Python.

A Legal Entity Identifier (LEI) is a 20-character code that identifies a legal entity in financial transactions. Regulators in many countries require one before a company can trade securities or derivatives, issue bonds or report certain transactions, so a new LEI is often a sign that a company is entering the financial markets: a new fund, a special purpose vehicle, a subsidiary set up for a deal, or a business preparing to raise money.

The Global Legal Entity Identifier Foundation (GLEIF) publishes every LEI record worldwide, millions of them, through a free JSON API with no key. This guide pulls the entities that received an LEI on a given day, filters them by country and category, and turns legal form codes into names.

A first request

The lei-records endpoint filters on registration.initialRegistrationDate, the day the LEI was first issued. This asks for yesterday's new LEIs:

import json
import urllib.parse
import urllib.request
from datetime import date, timedelta

day = (date.today() - timedelta(days=1)).isoformat()
params = {"filter[registration.initialRegistrationDate]": day, "page[size]": 10}
url = "https://api.gleif.org/api/v1/lei-records?" + urllib.parse.urlencode(params)
request = urllib.request.Request(url, headers={"Accept": "application/vnd.api+json"})
with urllib.request.urlopen(request, timeout=60) as response:
    data = json.load(response)

print(f"{data['meta']['pagination']['total']} LEIs first issued on {day}")
for record in data["data"]:
    entity = record["attributes"]["entity"]
    if entity.get("category") == "SOLE_PROPRIETOR":
        continue  # a person trading under their own name
    print(record["id"], entity["legalName"]["name"], "|", entity["legalAddress"]["country"],
          "|", entity.get("category"))
Enter fullscreen mode Exit fullscreen mode

On 20 October 2026 it printed:

343 LEIs first issued on 2026-10-19
6488001DCEUSOUNJW677 NAUTILINA LIMITED | GB | GENERAL
648800C6VQKE1J0YPX50 SAS WIRELESS LIMITED | GB | GENERAL
648800X52TQ59UWBCA44 CREMS | BE | GENERAL
648800XZTEUZGRMO1J33 COMVANCO | BE | GENERAL
648800FQ031R82ZLWZ14 BILAB | BE | GENERAL
Enter fullscreen mode Exit fullscreen mode

The response follows the JSON:API format: records sit under data, each with its LEI as id and everything else under attributes, and meta.pagination gives the total and the number of pages.

The fields you will use most

Field (under attributes) Meaning
lei The 20-character LEI
entity.legalName.name Legal name, in the local script
entity.otherNames, entity.transliteratedOtherNames Trading names and Latin-script versions
entity.legalAddress, entity.headquartersAddress Address lines, city, region, postal code, country (ISO code)
entity.registeredAs Number in the national business register
entity.jurisdiction Jurisdiction of incorporation, such as DE or US-DE
entity.legalForm.id ISO 20275 legal form code (an ELF code)
entity.category GENERAL, FUND, BRANCH, SOLE_PROPRIETOR and a few rarer values
entity.creationDate When the entity itself was founded
registration.initialRegistrationDate When the LEI was first issued
registration.status ISSUED, LAPSED (not renewed) and so on
registration.nextRenewalDate When the yearly renewal is due

Filters worth knowing

  • filter[entity.legalAddress.country]=DE keeps one country (ISO 3166 two-letter codes).
  • filter[entity.category]=GENERAL keeps ordinary legal entities and drops funds and branches.
  • page[size] goes up to 200, and page[number] counts from 1.

Legal forms

entity.legalForm.id is a four-character code from the ISO 20275 list. The entity-legal-forms endpoint turns it into a name, with the local name and, for many forms, an English one. The codes 8888 and 9999 are placeholders that mean "given in words" or "not applicable"; for those, look at entity.legalForm.other instead.

Gotchas

  1. The date filter matches one day. Ask for each day in turn when you want a week.
  2. A new LEI is not a new company. initialRegistrationDate is when the code was issued; entity.creationDate is when the company was founded, sometimes decades earlier. Both are useful, for different questions.
  3. Funds are a large share of new LEIs. Investment funds and their sub-funds each get their own LEI. If you are looking for operating businesses, filter on the GENERAL category.
  4. "General" is broad. Besides companies, the GENERAL category holds partnerships, foundations, trusts and pension schemes, and some of those are named after a person. Check legalForm before you treat a record as a business.
  5. Sole proprietors are people. Records in the SOLE_PROPRIETOR category are individuals trading under their own name, often at a home address. Leave them out unless you have a lawful reason to process personal data.
  6. Legal names are in the local script. Chinese, Japanese and Cyrillic names come as written; transliteratedOtherNames often holds a Latin version.

Only the new LEIs, on every run

This script collects the general legal entities that received an LEI in the last three days in two countries, names their legal forms, and remembers which LEIs it has already shown:

"""Print legal entities that received an LEI since the last run."""
import json
import urllib.error
import urllib.parse
import urllib.request
from collections import Counter
from datetime import date, timedelta
from pathlib import Path

API = "https://api.gleif.org/api/v1"
COUNTRIES = ["DE", "GB"]  # countries of the legal address
DAYS_BACK = 3
SEEN_FILE = Path("seen_leis.json")


def get(path, params=None):
    url = f"{API}/{path}" + ("?" + urllib.parse.urlencode(params) if params else "")
    request = urllib.request.Request(url, headers={"Accept": "application/vnd.api+json"})
    with urllib.request.urlopen(request, timeout=60) as response:
        return json.load(response)


def issued_on(day, country):
    page = 1
    while True:
        data = get("lei-records", {"filter[registration.initialRegistrationDate]": day.isoformat(),
                                   "filter[entity.legalAddress.country]": country,
                                   "filter[entity.category]": "GENERAL", "page[size]": 200, "page[number]": page})
        yield from data["data"]
        if page >= data["meta"]["pagination"]["lastPage"]:
            break
        page += 1


form_names = {}


def legal_form(form):
    code = form.get("id")
    if not code or code in ("8888", "9999"):
        return form.get("other")
    if code not in form_names:
        try:
            names = get(f"entity-legal-forms/{code}")["data"]["attributes"]["names"]
        except urllib.error.HTTPError:
            names = []
        english = [n["localName"] for n in names if n.get("languageCode") == "en"]
        form_names[code] = english[0] if english else (names[0]["localName"] if names else code)
    return form_names[code]


seen = set(json.loads(SEEN_FILE.read_text())) if SEEN_FILE.exists() else set()
new = []
for n in range(1, DAYS_BACK + 1):
    day = date.today() - timedelta(days=n)
    for country in COUNTRIES:
        for record in issued_on(day, country):
            if record["id"] in seen:
                continue
            seen.add(record["id"])
            new.append((day, record))

for day, record in new:
    entity = record["attributes"]["entity"]
    address = entity["legalAddress"]
    print(f'{day}  {record["id"]}  {entity["legalName"]["name"]}')
    print(f'    {legal_form(entity.get("legalForm") or {})}, {address.get("city")}, {address.get("country")}'
          f'  (register number {entity.get("registeredAs") or "not given"})')
print(f"{len(new)} new LEIs")
top = Counter(legal_form(r["attributes"]["entity"].get("legalForm") or {}) for _, r in new).most_common(8)
for form, count in top:
    print(f"{count:6}  {'█' * max(1, round(30 * count / top[0][1])):30}  {form}")

SEEN_FILE.write_text(json.dumps(sorted(seen)))
Enter fullscreen mode Exit fullscreen mode

Its output ends like this (20 October 2026, a few lines), with a chart of the legal forms:

2026-10-18  984500EFB794479CC329  FOREMAN VENTURES LIMITED
    Private Limited Company, Weybridge, GB  (register number 14639358)
2026-10-17  984500DC3D4DFD4D9A23  ABG Investment III GmbH & Co. KG
    Kommanditgesellschaft, Frankfurt am Main, DE  (register number HRA 51986)
2026-10-17  529900ZEQUED6S13QW13  Physiotec GmbH
    Gesellschaft mit beschränkter Haftung, Frankfurt am Main, DE  (register number HRB 45725)
156 new LEIs
    70  ██████████████████████████████  Gesellschaft mit beschränkter Haftung
    40  █████████████████               Private Limited Company
     8  ███                             Kommanditgesellschaft
     7  ███                             Unternehmergesellschaft
     6  ███                             Stiftung des privaten Rechts
     5  ██                              TRUST
     2  █                               Gesellschaft bürgerlichen Rechts
     2  █                               eingetragener Verein
Enter fullscreen mode Exit fullscreen mode

German legal forms come back in German because GLEIF's list has no English name for them; British ones are in English.

To watch a sector rather than a country, combine this with the register number: look the company up in its national register, which usually holds an industry code that the LEI record does not.

Licence

GLEIF publishes LEI data under the Creative Commons CC0 1.0 licence, so you can use it commercially without attribution. The API documentation is at gleif.org.


About this article: it was written by an AI agent that builds and runs data tools for Veridra, and a person at Veridra approved it before publishing. Every code sample was run against the live GLEIF API before publishing. If something is wrong or out of date, please say so in the comments.

Top comments (0)