DEV Community

Your Evenings Data
Your Evenings Data

Posted on

LEIs due for renewal in the next 30 days, by country, with the GLEIF API in Python (no API key)

Article type: How-to guide (one task: list the LEIs in one country that are due for renewal in the next 30 days, plus the ones that lapsed in the last 30, in a CSV)

Prerequisites: Python 3.9 or later with requests (pip install requests). No API key or account: the GLEIF API is open and the LEI data is CC0. An Apify account only if you use the hosted version at the end.

Tested on: 17 November 2026, against the live GLEIF API.

Every Legal Entity Identifier (LEI) has a renewal date, and the free GLEIF API can list the ones about to lapse in any country with a short Python script. If you run KYC or trade reporting, a lapsed LEI on a counterparty is a problem you'd rather see coming; if you renew LEIs for clients, the same list is your work queue. This guide lists the LEIs with an Irish legal address that are due for renewal in the next 30 days, adds the ones that lapsed in the last 30, and saves both as a CSV.

All the data in this post comes from one API:

GET https://api.gleif.org/api/v1/lei-records

with filters as query parameters, for example filter[entity.legalAddress.country]=IE, filter[registration.status]=ISSUED and filter[registration.nextRenewalDate]=2026-11-18..2026-12-17T23:59:59Z (a range). Results come in pages of up to 200, with the total under meta.pagination. The script also calls lei-issuers/{lei} to turn each issuer's LEI into a name. No key, no login.

How do I list LEIs due for renewal with the GLEIF API?

Save this as lei_renewals.py and run python lei_renewals.py (Ireland, 30 days), or pass a country and a number of days, for example python lei_renewals.py LU 14:

import csv
import sys
import time
from collections import Counter
from datetime import date, timedelta

import requests

COUNTRY = sys.argv[1] if len(sys.argv) > 1 else "IE"    # legal-address country, ISO 3166 two letters
DAYS = int(sys.argv[2]) if len(sys.argv) > 2 else 30
API = "https://api.gleif.org/api/v1"
session = requests.Session()
session.headers["User-Agent"] = "lei-renewal-tutorial/1.0 (python-requests)"


def get(path, params=None):
    time.sleep(1.1)                       # GLEIF's published limit is 60 requests a minute
    r = session.get(f"{API}/{path}", params=params, timeout=60)
    r.raise_for_status()
    return r.json()


def search(status, renewal_range):
    params = {
        "filter[entity.legalAddress.country]": COUNTRY,
        "filter[registration.status]": status,
        "filter[registration.nextRenewalDate]": renewal_range,   # "from..to"; renewals carry a time of day
        "sort": "registration.nextRenewalDate",
        "page[size]": 200,                                      # the maximum
    }
    page = 1
    while True:
        j = get("lei-records", {**params, "page[number]": page})
        if j["meta"]["pagination"]["total"] > 10_000:
            sys.exit("more than 10,000 matches: split the date range")
        yield from j["data"]
        if page >= j["meta"]["pagination"]["lastPage"]:
            break
        page += 1


today = date.today()
# A bare date means midnight, so end each range at 23:59:59 or you lose renewals later that day.
due = list(search("ISSUED", f"{today + timedelta(days=1)}..{today + timedelta(days=DAYS)}T23:59:59Z"))
lapsed = list(search("LAPSED", f"{today - timedelta(days=DAYS)}..{today - timedelta(days=1)}T23:59:59Z"))

# The managing LOU (the issuer that renews the LEI) comes back as an LEI; look up each one's name once.
lous = {x["attributes"]["registration"]["managingLou"] for x in due + lapsed}
lou_name = {lou: get(f"lei-issuers/{lou}")["data"]["attributes"]["name"] for lou in lous}

out = f"lei_renewals_{COUNTRY}_{today}.csv"
with open(out, "w", newline="", encoding="utf-8") as f:
    w = csv.writer(f)
    w.writerow(["lei", "legal_name", "category", "registration_status", "next_renewal", "managing_lou", "record_url"])
    for x in due + lapsed:
        a = x["attributes"]
        w.writerow([x["id"], a["entity"]["legalName"]["name"], a["entity"]["category"], a["registration"]["status"],
                    a["registration"]["nextRenewalDate"][:10], lou_name[a["registration"]["managingLou"]],
                    f"https://search.gleif.org/#/record/{x['id']}"])

print(f"{COUNTRY}: {len(due)} issued LEIs due for renewal in the next {DAYS} days "
      f"({today + timedelta(days=1)} to {today + timedelta(days=DAYS)})")
print(f"{COUNTRY}: {len(lapsed)} LEIs lapsed with a renewal date in the last {DAYS} days")
print(f"wrote {len(due) + len(lapsed)} rows to {out}\n")
print("due, by category:", dict(Counter(x["attributes"]["entity"]["category"] for x in due).most_common()))
print("lapsed, by category:", dict(Counter(x["attributes"]["entity"]["category"] for x in lapsed).most_common()))
print("due, by managing LOU:")
for lou, n in Counter(x["attributes"]["registration"]["managingLou"] for x in due).most_common(5):
    print(f"  {n:>4}  {lou_name[lou]}")
Enter fullscreen mode Exit fullscreen mode

Output on 17 November 2026 (it took about 27 seconds, mostly the 1.1-second pause before each request):

IE: 980 issued LEIs due for renewal in the next 30 days (2026-11-18 to 2026-12-17)
IE: 191 LEIs lapsed with a renewal date in the last 30 days
wrote 1171 rows to lei_renewals_IE_2026-11-17.csv

due, by category: {'GENERAL': 660, 'FUND': 320}
lapsed, by category: {'GENERAL': 145, 'FUND': 45, 'BRANCH': 1}
due, by managing LOU:
   382  The Irish Stock Exchange Plc
   248  Bloomberg Finance L.P.
   162  London Stock Exchange LEI Limited
    92  Ubisecure Oy
    46  EQS Group GmbH
Enter fullscreen mode Exit fullscreen mode

Some rows from lei_renewals_IE_2026-11-17.csv (legal names and links left out):

lei,category,registration_status,next_renewal,managing_lou
635400DRI6E7YE2KGW57,GENERAL,ISSUED,2026-11-18,The Irish Stock Exchange Plc
635400KBD4LDA1TPND91,FUND,ISSUED,2026-11-18,The Irish Stock Exchange Plc
213800R5PQOXRMFXH447,GENERAL,LAPSED,2026-10-18,London Stock Exchange LEI Limited
549300RE2CX3V6XBFC68,BRANCH,LAPSED,2026-10-21,EQS Group GmbH
5493005FAT85HZ73DG37,FUND,LAPSED,2026-10-18,Bloomberg Finance L.P.
Enter fullscreen mode Exit fullscreen mode

The managing LOU (Local Operating Unit) is the issuer that holds the record and renews it.

Why it's built this way:

  • Let the API filter and sort. Country, status and renewal range all go to the server, sorted by registration.nextRenewalDate, so the script reads 5 pages of 200 for the due list and 1 for the lapsed list instead of every Irish LEI (38,750).
  • Two lists, one file. "Due soon" (status ISSUED) is what to chase; "lapsed in the last 30 days" (status LAPSED) is what slipped through. The registration_status column tells them apart.
  • Issuer names looked up once. The record gives the managing LOU as an LEI. The script collects the distinct ones and asks lei-issuers once for each, not once per row.
  • Paced. GLEIF publishes a limit of 60 requests a minute and sends no rate-limit headers, so the script waits 1.1 seconds before every request.

What should I check before I trust the list?

  1. Renewal dates have a time of day. Many are midnight UTC, but not all, and a bare date in a range means midnight. Ending the range at 2026-12-17 instead of 2026-12-17T23:59:59Z gave 954 instead of 980: it lost the renewals due later on 17 December. For one day, 22 November, midnight alone matched 23 and the whole day 45. End every range at 23:59:59.
  2. The status changes after the renewal date, not on it. At 17:53 UTC on 17 November, 13 Irish LEIs whose renewal time had passed still showed ISSUED; none due before 16 November did. Give it a day before you read ISSUED as "renewed".
  3. Lapsed doesn't mean the company is gone. All 11,509 lapsed Irish LEIs, including all of those that lapsed in the last 30 days, have entity status ACTIVE. A lapsed LEI usually means the record wasn't renewed in time, so it's still a counterparty you need to ask.
  4. A third are funds. 320 of the 980 LEIs due are FUND records (660 GENERAL). Across all 23,033 issued Irish LEIs, 9,759 are funds. Add filter[entity.category]=GENERAL if you only want companies.
  5. Strict, but not everywhere. Status values must be upper case (issued returns HTTP 400 "Invalid enum value"), and dates must be ISO 8601 (16/11/2026 returns HTTP 400). Country codes are not case-sensitive: ie returned all 38,750.
  6. Paging limits. page[size] above 200 returns HTTP 400, and so does any page past the first 10,000 results (page 51 at 200 a page). The script stops if a search matches more; split the date range.
  7. Not every record is checked against a register. Of the 980 LEIs due, 920 were FULLY_CORROBORATED, 20 PARTIALLY_CORROBORATED and 40 ENTITY_SUPPLIED_ONLY (the entity's own word). That's in the record's corroborationLevel if it matters to you.

To change the task, pass another country code and window, or swap the second search for RETIRED or ANNULLED to see LEIs that ended for good.

The hosted version (Disclosure: we built this)

We built an Apify Actor, LEI Lookup & Company Ownership API, that reads the same GLEIF API. Its search mode filters by country, LEI status, entity status, category, legal form, city, register number and dates, including renewalDueWithinDays or a renewalDueFrom and renewalDueTo range, and each row can carry the direct and ultimate parent. Sole proprietors and trusts are skipped and never charged, and status rows are free. Monitor mode returns only records that are new or have changed since the last run, for example an LEI that lapsed. Requests are paced to stay under GLEIF's limit.

What it doesn't do: the managing LOU comes back as an LEI, not a name; it returns rows, not the counts by category or issuer; and its renewal window ends at midnight on the last day, so renewals due later that day are left out (5 in our test). Set renewalDueTo a day later to cover them. It's pay per event; prices on the Actor's Pricing tab. For example (not run on the Apify platform for this post; a free local run of the Actor's code with this input on 15 November returned 895 records and skipped 29 trusts):

{
  "mode": "search",
  "countries": ["IE"],
  "registrationStatuses": ["ISSUED"],
  "renewalDueWithinDays": 30,
  "includeParents": false,
  "maxResults": 0
}
Enter fullscreen mode Exit fullscreen mode

LEI Lookup & Company Ownership API on Apify

Data: GLEIF API (Global LEI Index), read 17 November 2026. LEI data is available under CC0 1.0. This post and the Actor are not affiliated with, endorsed by or sponsored by the Global Legal Entity Identifier Foundation (GLEIF).

Your Evenings

Top comments (0)