Package 'gleifr'

Title: Client for the 'GLEIF' API
Description: Download legal entity reference data from the 'Global Legal Entity Identifier Foundation' ('GLEIF') API. Retrieve Legal Entity Identifier ('LEI') records, their direct and ultimate parent and child relationships, accredited issuers ('Local Operating Units'), and mappings from 'LEI' codes to other identifiers such as 'ISIN', 'BIC', and 'MIC'. See <https://www.gleif.org/en/lei-data/gleif-api> for further details.
Authors: Maximilian Mücke [aut, cre] (ORCID: <https://orcid.org/0009-0000-9432-9795>)
Maintainer: Maximilian Mücke <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0.9000
Built: 2026-06-21 19:25:35 UTC
Source: https://github.com/m-muecke/gleifr

Help Index


Get or manage the gleifr API cache

Description

lei_cache_dir() returns the path where cached API responses are stored. lei_cache_clear() clears all cached responses.

Usage

lei_cache_dir()

lei_cache_clear()

Details

The cache is only used when enabled with options(gleifr.cache = TRUE). Cached responses are stored for 1 day by default, but this can be customized with options(gleifr.cache_max_age = seconds).

Value

lei_cache_dir() returns a string with the path to the cache directory.

lei_cache_clear() is called for its side effect of clearing the cached responses and returns NULL invisibly.

Examples

## Not run: 
# enable caching
options(gleifr.cache = TRUE)

# view cache location
lei_cache_dir()

# clear the cache
lei_cache_clear()

## End(Not run)

Autocomplete LEI records

Description

Performs a prefix-based completion against the GLEIF API, returning candidate values together with their LEI. Useful for typeahead-style lookups. For typo-tolerant matching, see lei_fuzzy().

Usage

lei_autocomplete(q, field = c("fulltext", "owns"))

Arguments

q

(character(1))
The search query.

field

(character(1))
The field to search. One of "fulltext" or "owns". Default is "fulltext".

Value

A data.frame() with columns:

  • value: The matched value

  • lei: The Legal Entity Identifier of the matched record, or NA if none is linked

Source

https://www.gleif.org/en/lei-data/gleif-api

See Also

lei_fuzzy() for typo-tolerant matching, lei_record_by_id() for full records.

Examples

lei_autocomplete("Appl")

Fetch LEI child records

Description

Fetches the direct or ultimate child records of a given LEI.

Usage

lei_children(id, type = c("direct", "ultimate"), limit = 200L, simplify = TRUE)

Arguments

id

(character(1))
The Legal Entity Identifier (LEI) to fetch the children for.

type

(character(1))
The type of children to fetch. One of "direct" or "ultimate". Default is "direct".

limit

(NULL | integer(1))
Maximum number of records to return. Default 200L. Use NULL to fetch all.

simplify

(logical(1))
Should the output be simplified? Default TRUE.

Value

When simplify = TRUE, a long-format data.frame() with columns:

  • lei: The Legal Entity Identifier

  • name: The attribute name

  • value: The attribute value

When simplify = FALSE, a named list() containing the raw API response.

See Also

lei_parent() to fetch the parent record of a LEI.

Examples

# get direct children
head(lei_children("O2RNE8IBXP4R0TD8PU41", limit = 5))

# get ultimate children
head(lei_children("O2RNE8IBXP4R0TD8PU41", type = "ultimate", limit = 5))

Fetch the list of countries

Description

Fetches the list of countries (ISO 3166-1) recognized by the GLEIF API.

Usage

lei_countries()

Value

A data.frame() with columns:

  • code: The country code

  • name: The country name

Examples

head(lei_countries())

Fuzzy search for LEI records

Description

Performs a typo-tolerant, approximate search against the GLEIF API. Unlike the filters in lei_records(), which match literal substrings, this matches on edit distance and returns candidate values together with their LEI. Useful for resolving messy or misspelled entity names to a LEI, which can then be passed to lei_record_by_id().

Usage

lei_fuzzy(q, field = c("fulltext", "entity.legalName", "owns", "ownedBy"))

Arguments

q

(character(1))
The search query.

field

(character(1))
The field to search. One of "fulltext", "entity.legalName", "owns", or "ownedBy". Default is "fulltext".

Value

A data.frame() with columns:

  • value: The matched value

  • lei: The Legal Entity Identifier of the matched record, or NA if none is linked

Source

https://www.gleif.org/en/lei-data/gleif-api

See Also

lei_autocomplete() for prefix-based completion, lei_record_by_id() for full records.

Examples

lei_fuzzy("Deutsch Bank", field = "entity.legalName")

Fetch ISINs for a LEI

Description

Fetches the ISINs associated with a given LEI.

Usage

lei_isins(id, limit = 200L)

Arguments

id

(character(1))
The Legal Entity Identifier (LEI) to fetch ISINs for.

limit

(NULL | integer(1))
Maximum number of records to return. Default 200L. Use NULL to fetch all.

Value

A data.frame() with columns:

  • lei: The Legal Entity Identifier

  • isin: The ISIN

Examples

head(lei_isins("529900W18LQJJN6SJ336", limit = 10))

Fetch LEI issuers

Description

Fetches the list of LEI issuers (Local Operating Units) from the GLEIF API.

Usage

lei_issuers()

Value

A data.frame() with columns:

  • lei: The Legal Entity Identifier of the issuer

  • name: The issuer name

  • marketing_name: The marketing name

  • website: The issuer website

  • accreditation_date: The accreditation date

Examples

head(lei_issuers())

Fetch the list of jurisdictions

Description

Fetches the list of jurisdictions (countries and their subdivisions) recognized by the GLEIF API.

Usage

lei_jurisdictions()

Value

A data.frame() with columns:

  • code: The jurisdiction code

  • name: The jurisdiction name

Examples

head(lei_jurisdictions())

Download the latest LEI mapping data

Description

Download the latest Legal Entity Identifier (LEI) mapping data from the Global Legal Entity Identifier Foundation (GLEIF).

Usage

lei_mapping(type = c("isin", "bic", "mic", "oc"))

Arguments

type

(character(1))
The type of mapping data to download. One of "isin", "bic", "mic", or "oc". Default is "isin".

Value

A data.frame() with the lei and the corresponding mapping.

Source

https://www.gleif.org/en/lei-data/lei-mapping

Examples

head(lei_mapping("isin"))

Fetch the change history of a LEI record

Description

Fetches the field-level modification history of a given LEI, i.e. an audit log of every recorded change to the entity (recordType "LEI") and its relationships (recordType "RR").

Usage

lei_modifications(id, limit = 200L)

Arguments

id

(character(1))
The Legal Entity Identifier (LEI) to fetch the change history for.

limit

(NULL | integer(1))
Maximum number of records to return. Default 200L. Use NULL to fetch all.

Value

A data.frame() with columns:

  • lei: The Legal Entity Identifier

  • record_type: The record the change applies to, "LEI" or "RR"

  • modification_type: The type of change, e.g. "UPDATE"

  • field: The path of the changed field

  • date: The date of the change

  • value_old: The previous value, or NA if none

  • value_new: The new value, or NA if none

Source

https://www.gleif.org/en/lei-data/gleif-api

Examples

head(lei_modifications("529900W18LQJJN6SJ336", limit = 10))

Fetch a LEI parent record

Description

Fetches the direct or ultimate parent record of a given LEI.

Usage

lei_parent(id, type = c("direct", "ultimate"), simplify = TRUE)

Arguments

id

(character(1))
The Legal Entity Identifier (LEI) to fetch the parent for.

type

(character(1))
The type of parent to fetch. One of "direct" or "ultimate". Default is "direct".

simplify

(logical(1))
Should the output be simplified? Default TRUE.

Value

When simplify = TRUE, a long-format data.frame() with columns:

  • lei: The Legal Entity Identifier

  • name: The attribute name

  • value: The attribute value

When simplify = FALSE, a named list() containing the raw API response.

See Also

lei_children() to fetch the child records of a LEI.

Examples

# get direct parent
head(lei_parent("529900W18LQJJN6SJ336"))

# get ultimate parent
head(lei_parent("529900W18LQJJN6SJ336", type = "ultimate"))

Fetch a LEI record

Description

Fetch a single LEI record by its Legal Entity Identifier. To fetch records by attribute filters, see lei_records().

Usage

lei_record_by_id(id, simplify = TRUE)

Arguments

id

(character(1))
The Legal Entity Identifier (LEI) to fetch.

simplify

(logical(1))
Should the output be simplified? Default TRUE.

Value

When simplify = TRUE, a long-format data.frame() with columns:

  • lei: The Legal Entity Identifier

  • name: The attribute name

  • value: The attribute value

When simplify = FALSE, a named list() containing the raw API response.

See Also

lei_records() to fetch records by attribute filters.

Examples

# get simplified long-format data.frame
head(lei_record_by_id("529900W18LQJJN6SJ336"))

# get raw API response as named list
str(lei_record_by_id("529900W18LQJJN6SJ336", simplify = FALSE), max.level = 2)

Fetch LEI records

Description

Fetch LEI records from the GLEIF database, optionally filtered by attribute. The filters are combined with logical AND, so each one you supply narrows the results further. To fetch a single record by its LEI, see lei_record_by_id().

Usage

lei_records(
  legal_name = NULL,
  fulltext = NULL,
  country = NULL,
  jurisdiction = NULL,
  registration_status = NULL,
  entity_status = NULL,
  category = NULL,
  isin = NULL,
  ...,
  limit = 200L,
  simplify = TRUE
)

Arguments

legal_name

(NULL | character(1))
Filter by legal name.

fulltext

(NULL | character(1))
Full-text search query.

country

(NULL | character(1))
Filter by legal address country (ISO 3166-1 alpha-2 code), e.g. "DE".

jurisdiction

(NULL | character(1))
Filter by jurisdiction (ISO 3166-1 alpha-2 code), e.g. "DE".

registration_status

(NULL | character(1))
Filter by LEI registration status, e.g. "ISSUED" or "LAPSED".

entity_status

(NULL | character(1))
Filter by entity status, one of "ACTIVE" or "INACTIVE".

category

(NULL | character(1))
Filter by entity category, e.g. "FUND", "BRANCH", or "GENERAL".

isin

(NULL | character(1))
Filter by ISIN.

...

Additional filter parameters passed to the GLEIF API. These are appended as query parameters, e.g. "filter[entity.subCategory]" = "CENTRAL_GOVERNMENT".

limit

(NULL | integer(1))
Maximum number of records to return. Default 200L. Use NULL to fetch all matching records.

simplify

(logical(1))
Should the output be simplified? Default TRUE.

Value

When simplify = TRUE, a long-format data.frame() with columns:

  • lei: The Legal Entity Identifier

  • name: The attribute name

  • value: The attribute value

When simplify = FALSE, a list() of the raw record objects from the API.

See Also

lei_record_by_id() to fetch a single record by its LEI.

Examples

# search by legal name
head(lei_records(legal_name = "Deutsche Bank", limit = 5))

# filter by country and registration status
head(lei_records(country = "DE", registration_status = "ISSUED", limit = 5))

Fetch LEI regions

Description

Fetches the list of regions from the GLEIF API.

Usage

lei_regions()

Value

A data.frame() with columns:

  • code: The region code

  • language: The language of the region name

  • name: The region name

Examples

head(lei_regions())

Fetch the list of registration authorities

Description

Fetches the list of registration authorities (RA codes) recognized by the GLEIF API. These resolve the registration authority codes that appear in lei_record_by_id() output to the issuing business registries.

Usage

lei_registration_authorities()

Value

A data.frame() with columns:

  • code: The registration authority (RA) code

  • international_name: The international name of the authority

  • local_name: The local name of the authority, or NA if none

  • website: The authority website, or NA if none

Examples

head(lei_registration_authorities())