# LEI lookup

> POST /lei checks an LEI's ISO 17442 check digits and reads its GLEIF record: legal name, status, legal form, addresses and parents, or searches by name.

`POST https://api.qelka.com/v1/lei`

Look up a Legal Entity Identifier (LEI), the 20-character code of a legal entity in financial transactions, or find one from a company's legal name: you get the entity's legal name, status, legal form, addresses and parent companies from GLEIF, the Global Legal Entity Identifier Foundation. Each lookup costs 1 credit, found or not; errors and test keys are never billed.

## Request

Send either `lei` or `name`, never both.

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `lei` | string | One of `lei` or `name` | none | The LEI to look up: 20 characters, sent as 1 to 40 characters before spaces and hyphens are removed. Lower case is accepted. |
| `name` | string | One of `lei` or `name` | none | A legal name to search for, 2 to 200 characters. The GLEIF fuzzy search finds up to 10 candidates, and the full record of the best one is returned. |
| `fresh` | boolean | No | `false` | `true` skips the 7-day result cache and asks GLEIF again. |

A body with both `lei` and `name`, or with neither, is a `400 invalid_request`. The call waits for the GLEIF API, so every snippet sets a 30-second client timeout.

```bash title="cURL"
curl https://api.qelka.com/v1/lei \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lei": "5493001KJTIIGC8Y1R12"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/lei', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ lei: '5493001KJTIIGC8Y1R12' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/lei",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"lei": "5493001KJTIIGC8Y1R12"},
    timeout=30,
)
result = response.json()
print(result)
```
```php title="PHP"
<?php
$ch = curl_init('https://api.qelka.com/v1/lei');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('QELKA_API_KEY'),
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode(['lei' => '5493001KJTIIGC8Y1R12']),
    CURLOPT_TIMEOUT => 30,
]);
$result = json_decode(curl_exec($ch), true);
print_r($result);
```
```go title="Go"
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
	"time"
)

func main() {
	payload, _ := json.Marshal(map[string]any{"lei": "5493001KJTIIGC8Y1R12"})
	request, _ := http.NewRequest(http.MethodPost, "https://api.qelka.com/v1/lei", bytes.NewReader(payload))
	request.Header.Set("Authorization", "Bearer "+os.Getenv("QELKA_API_KEY"))
	request.Header.Set("Content-Type", "application/json")

	client := &http.Client{Timeout: 30 * time.Second}
	response, err := client.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	var result map[string]any
	if err := json.NewDecoder(response.Body).Decode(&result); err != nil {
		panic(err)
	}
	fmt.Println(result)
}
```
```ruby title="Ruby"
require 'json'
require 'net/http'

uri = URI('https://api.qelka.com/v1/lei')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{ENV.fetch('QELKA_API_KEY')}"
request['Content-Type'] = 'application/json'
request.body = JSON.generate({ lei: '5493001KJTIIGC8Y1R12' })

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true, read_timeout: 30) do |http|
  http.request(request)
end
result = JSON.parse(response.body)
puts result
```

## Response

Every lookup gets a `200`, found or not. Read `status` first: `found`, `not_found` or `invalid`.

| Field | Type | Description |
|---|---|---|
| `id` | string | Identifier of this lookup: `lkp_` followed by 26 characters. |
| `object` | string | Always `lei`. |
| `input` | string | The `lei` or `name` you sent, without surrounding spaces. |
| `query` | string | `lei` or `name`: how the lookup was made. |
| `valid` | boolean or null | `true` when the LEI has correct ISO 17442 check digits, `false` when it does not. For a name search, `true` when a record is found, else `null`. |
| `status` | string | `found`, `not_found` or `invalid`. |
| `reason` | string or null | Why no record is returned: `invalid_format`, `invalid_checksum`, `not_in_gleif` or `no_match`. `null` when one is found. |
| `lei` | string or null | The LEI, upper case. For a name search, the LEI of the best match. |
| `legal_name` | string or null | The legal name registered with GLEIF. |
| `entity_status` | string or null | `active` or `inactive`, as the entity reports it. |
| `registration_status` | string or null | The status of the LEI itself: `issued`, `lapsed`, `retired`, `merged`, `annulled`, `duplicate`, `pending_transfer` or `pending_archival`. |
| `jurisdiction` | string or null | The legal jurisdiction: an ISO 3166-1 code (`FR`) or an ISO 3166-2 subdivision (`US-DE`). |
| `category` | string or null | `general`, `branch`, `fund`, `sole_proprietor`, `resident_government_entity` or `international_organization`. |
| `legal_form` | object or null | The legal form of the entity. |
| `legal_form.code` | string or null | The ISO 20275 Entity Legal Form (ELF) code, such as `T91T`. `null`, `8888` or `9999` when the form has no ELF code. |
| `legal_form.name` | string or null | The name of the ELF code from the GLEIF code list, in English when there is one, or else the form as the entity recorded it. |
| `registered_as` | string or null | The identifier of the entity in its business register. |
| `legal_address` | object or null | The registered address of the entity. |
| `legal_address.lines` | array of strings | Street lines. |
| `legal_address.city` | string or null | City. |
| `legal_address.region` | string or null | ISO 3166-2 subdivision code, such as `US-DE`. |
| `legal_address.postal_code` | string or null | Postal code. |
| `legal_address.country` | string or null | ISO 3166-1 alpha-2 code. |
| `headquarters_address` | object or null | The headquarters address, with the same fields as `legal_address`. |
| `registration` | object or null | The LEI record itself. |
| `registration.initial_date` | string or null | When the LEI was first issued, ISO 8601. |
| `registration.last_update` | string or null | When the record last changed, ISO 8601. |
| `registration.next_renewal` | string or null | When the record must next be renewed, ISO 8601. |
| `registration.managing_lou` | string or null | The LEI of the Local Operating Unit (LOU), the organization that manages the record. |
| `direct_parent` | object or null | The direct accounting consolidating parent the entity reports. `null` when none is reported. |
| `direct_parent.lei` | string | LEI of the parent. |
| `direct_parent.legal_name` | string or null | Legal name of the parent. |
| `ultimate_parent` | object or null | The ultimate accounting consolidating parent, with the same fields as `direct_parent`. `null` when none is reported. |
| `matches` | array of objects or null | For a name search: up to 10 candidates, best first. `null` for a lookup by LEI. |
| `matches.lei` | string | LEI of the candidate. |
| `matches.legal_name` | string or null | Legal name of the candidate. |
| `credits_used` | integer | Credits debited for this call: 1 with a live key, `0` with a test key. |
| `cached` | boolean | `true` when the answer came from the 7-day cache. |

```json title="Response"
{
  "id": "lkp_01M85RP99BC7ZZVRF0NJSTPHSS",
  "object": "lei",
  "input": "5493001KJTIIGC8Y1R12",
  "query": "lei",
  "valid": true,
  "status": "found",
  "reason": null,
  "lei": "5493001KJTIIGC8Y1R12",
  "legal_name": "Bloomberg Finance L.P.",
  "entity_status": "active",
  "registration_status": "issued",
  "jurisdiction": "US-DE",
  "category": "general",
  "legal_form": { "code": "T91T", "name": "Limited Partnership" },
  "registered_as": "4348344",
  "legal_address": {
    "lines": ["C/O Corporation Service Company", "251 Little Falls Drive"],
    "city": "Wilmington",
    "region": "US-DE",
    "postal_code": "19808",
    "country": "US"
  },
  "headquarters_address": {
    "lines": ["731 Lexington Avenue"],
    "city": "New York",
    "region": "US-NY",
    "postal_code": "10022",
    "country": "US"
  },
  "registration": {
    "initial_date": "2012-12-06T20:55:22Z",
    "last_update": "2026-01-05T14:20:40Z",
    "next_renewal": "2027-01-25T16:50:02Z",
    "managing_lou": "5493001KJTIIGC8Y1R12"
  },
  "direct_parent": { "lei": "549300B56MD0ZC402L06", "legal_name": "Bloomberg L.P." },
  "ultimate_parent": { "lei": "549300RMUDWPHCUQNE66", "legal_name": "Bloomberg Inc." },
  "matches": null,
  "credits_used": 1,
  "cached": false
}
```

## Act on the status

| `status` | `reason` | What it means | What to do |
|---|---|---|---|
| `found` | `null` | GLEIF has a record for the LEI, or for the best match of the name. | Check `registration_status` and `entity_status`. After a name search, confirm that `legal_name` and `jurisdiction` are the entity you meant: the other candidates are in `matches`. |
| `invalid` | `invalid_format` | The LEI is not 18 letters or digits followed by 2 digits. GLEIF is not called. | Ask for the LEI again. |
| `invalid` | `invalid_checksum` | The check digits do not match the rest of the LEI. GLEIF is not called. | Ask the user to check each character: it is usually a typo. |
| `not_found` | `not_in_gleif` | The LEI is well formed but GLEIF has no record of it, or the best match of a name search has no record. | Ask for the LEI again, or search by legal name. |
| `not_found` | `no_match` | No legal name matches the search. `matches` is empty. | Try the full legal name as registered, legal form included. |

Every status is billed 1 credit, because the lookup ran.

Test keys never call GLEIF: any LEI with correct check digits, and any name, returns the sample entity `EXAMPLE HOLDINGS LTD`, and LEIs with wrong check digits are still `invalid`.

`registration_status: "issued"` means the LEI is current. In GLEIF's terms, `lapsed` means the record was not renewed by its `registration.next_renewal` date: when you rely on the record, ask the entity to renew it.

## How the check digits work

ISO 17442 makes the last two characters check digits computed with ISO 7064 MOD 97-10, the algorithm IBANs use: with letters turned into numbers (A = 10 to Z = 35), the whole LEI leaves a remainder of 1 when divided by 97. A single mistyped character always fails the check, so it is caught before any call to GLEIF.

## Find the parent companies

Entities with an LEI report their direct and ultimate accounting consolidating parents to GLEIF, the companies that consolidate their accounts. The API follows the parent relationships GLEIF lists and returns `null` when none is reported.

## Where the data comes from

Records come from the [GLEIF API](https://www.gleif.org/en/lei-data/gleif-api), queried at request time. GLEIF publishes the Global LEI Index free of charge under the CC0 license. Legal form names come from the GLEIF list of ISO 20275 Entity Legal Form codes. See the [data sources page](https://qelka.com/data-sources).

## Examples

### Search by legal name

Send `name` instead of `lei`. The best candidate's full record comes back, and every candidate is in `matches`, best first.

```bash title="cURL"
curl https://api.qelka.com/v1/lei \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Bloomberg Finance"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/lei', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'Bloomberg Finance' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/lei",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"name": "Bloomberg Finance"},
    timeout=30,
)
result = response.json()
print(result)
```

```json title="Response"
{
  "id": "lkp_01M8714FRZBEVYY3WNYQ12ASF8",
  "object": "lei",
  "input": "Bloomberg Finance",
  "query": "name",
  "valid": true,
  "status": "found",
  "reason": null,
  "lei": "5493001KJTIIGC8Y1R12",
  "legal_name": "Bloomberg Finance L.P.",
  "entity_status": "active",
  "registration_status": "issued",
  "jurisdiction": "US-DE",
  "category": "general",
  "legal_form": { "code": "T91T", "name": "Limited Partnership" },
  "registered_as": "4348344",
  "legal_address": {
    "lines": ["C/O Corporation Service Company", "251 Little Falls Drive"],
    "city": "Wilmington",
    "region": "US-DE",
    "postal_code": "19808",
    "country": "US"
  },
  "headquarters_address": {
    "lines": ["731 Lexington Avenue"],
    "city": "New York",
    "region": "US-NY",
    "postal_code": "10022",
    "country": "US"
  },
  "registration": {
    "initial_date": "2012-12-06T20:55:22Z",
    "last_update": "2026-01-05T14:20:40Z",
    "next_renewal": "2027-01-25T16:50:02Z",
    "managing_lou": "5493001KJTIIGC8Y1R12"
  },
  "direct_parent": { "lei": "549300B56MD0ZC402L06", "legal_name": "Bloomberg L.P." },
  "ultimate_parent": { "lei": "549300RMUDWPHCUQNE66", "legal_name": "Bloomberg Inc." },
  "matches": [
    { "lei": "5493001KJTIIGC8Y1R12", "legal_name": "Bloomberg Finance L.P." },
    { "lei": "549300S3UKXHMEQHC174", "legal_name": "BLOOMBERG FINANCIAL CORP." },
    { "lei": "254900JY1M565T6QM850", "legal_name": "Bloomberg Finance Singapore L.P." }
  ],
  "credits_used": 1,
  "cached": false
}
```

### Catch a mistyped LEI

The last digit is wrong, so the check digits fail and GLEIF is not called. The answer is billed, because the check ran.

```bash title="cURL"
curl https://api.qelka.com/v1/lei \
  --max-time 30 \
  -H "Authorization: Bearer $QELKA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"lei": "5493001KJTIIGC8Y1R13"}'
```
```javascript title="Node.js"
const response = await fetch('https://api.qelka.com/v1/lei', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.QELKA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ lei: '5493001KJTIIGC8Y1R13' }),
  signal: AbortSignal.timeout(30_000),
})
const result = await response.json()
console.log(result)
```
```python title="Python"
import os

import requests

api_key = os.environ["QELKA_API_KEY"]
response = requests.post(
    "https://api.qelka.com/v1/lei",
    headers={"Authorization": f"Bearer {api_key}"},
    json={"lei": "5493001KJTIIGC8Y1R13"},
    timeout=30,
)
result = response.json()
print(result)
```

```json title="Response"
{
  "id": "lkp_01M8714GP83NW30G6SM7GZ5196",
  "object": "lei",
  "input": "5493001KJTIIGC8Y1R13",
  "query": "lei",
  "valid": false,
  "status": "invalid",
  "reason": "invalid_checksum",
  "lei": "5493001KJTIIGC8Y1R13",
  "legal_name": null,
  "entity_status": null,
  "registration_status": null,
  "jurisdiction": null,
  "category": null,
  "legal_form": null,
  "registered_as": null,
  "legal_address": null,
  "headquarters_address": null,
  "registration": null,
  "direct_parent": null,
  "ultimate_parent": null,
  "matches": null,
  "credits_used": 1,
  "cached": false
}
```

## Errors

| Status | Type | When |
|---|---|---|
| 400 | [invalid_request](https://qelka.com/docs/errors#invalid_request) | Both or neither of `lei` and `name`, `lei` empty or longer than 40 characters, `name` shorter than 2 or longer than 200 characters, a body that is not a JSON object, or a field the request table does not list |
| 401 | [invalid_api_key](https://qelka.com/docs/errors#invalid_api_key) | The key is missing, unknown or revoked |
| 402 | [insufficient_credits](https://qelka.com/docs/errors#insufficient_credits) | Your balance is less than 1 credit (live keys only) |
| 403 | [forbidden](https://qelka.com/docs/errors#forbidden) | The key is restricted to other endpoints |
| 405 | [invalid_request](https://qelka.com/docs/errors#invalid_request) | The method is not `POST` |
| 429 | [rate_limited](https://qelka.com/docs/errors#rate_limited) | Too many requests: wait `Retry-After` seconds |
| 500 | [internal_error](https://qelka.com/docs/errors#internal_error) | Unexpected error on our side: retry with backoff |
| 502 | [upstream_unavailable](https://qelka.com/docs/errors#upstream_unavailable) | The GLEIF API could not be reached, answered with an error or did not answer in time: retry later |

No error is billed. An LEI that GLEIF does not know is not an error: it is a `200` with `status: "not_found"`.

## Related

- [LEI lookup API](https://qelka.com/products/lei-lookup)
- Free tool: [LEI lookup](https://qelka.com/tools/lei-lookup)
- [Batch](https://qelka.com/docs/api-reference/batch): up to 100 lookups in one call, each item with `type: "lei"`
- [Bulk](https://qelka.com/docs/api-reference/bulk): a whole file of LEIs with `type=lei`
- [Caching](https://qelka.com/docs/caching), [Errors](https://qelka.com/docs/errors), [Test mode](https://qelka.com/docs/test-mode)
