curatedapi
Browse the docs

Guides

Finance

Excel functions

Late payments

E-invoices

Accounting

Number checks

VAT and GST

Billing and pricing

Money and currencies

Dates and time

Math

Unit conversion

Everyday

Health

LEI check API

Check the length and check digits of a Legal Entity Identifier (ISO 17442).

POST https://api.curatedapi.com/v1/calc/check/lei

Checks a Legal Entity Identifier as ISO 17442 defines it: 20 letters and digits, the last two being check digits worked out with MOD 97-10. The first four characters identify the organisation that issued the LEI.

Formula

read A as 10 … Z as 35; the whole number must leave remainder 1 when divided by 97; check digits = 98 − (first 18 characters + 00) mod 97
  • The number is checked by arithmetic alone. Nothing is looked up, so a valid result means the number is well formed, not that the account, company or security exists.
  • Whether an LEI is issued and current is in GLEIF's public database, which is not consulted.

Inputs

Send numbers as strings to keep every digit. options sets precision and rounding (see numbers and rounding).

InputTypeDescription
number required string The 20-character LEI. Spaces, dots, hyphens and slashes are ignored, and lower-case letters are read as upper case. At most 64 characters.

Result

Under result in the answer, next to exactness, precision, inputs, formula, references and warnings.

ResultTypeDescription
validbooleanWhether the LEI passes every check.
normalizedstringThe number as it was checked: separators removed, letters in upper case.
problemstringWhat is wrong, when valid is false: CHARACTERS: a character that cannot appear in this kind of number; LENGTH: the wrong number of characters; COUNTRY: an unknown or unsupported country code; FORMAT: the right length but the wrong structure; CHECK_DIGIT: the check digit or check characters do not match the rest of the number.
messagestringThe result in a sentence, naming the rule that failed.
lou_prefixstringThe first four characters: the prefix of the issuing organisation (LOU).
check_digitsstringThe last two characters.
expected_check_digitsstringThe check digits the first 18 characters give.

Examples

A well-formed LEI

Requestcurl
curl https://api.curatedapi.com/v1/calc/check/lei \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "5493001KJTIIGC8Y1R12"
  }'
200 OKResponse
{
  "calculator": "check/lei@1",
  "result": {
    "valid": true,
    "normalized": "5493001KJTIIGC8Y1R12",
    "message": "A well-formed LEI.",
    "lou_prefix": "5493",
    "check_digits": "12",
    "expected_check_digits": "12"
  },
  "exactness": {},
  "precision": null,
  "inputs": {
    "number": "5493001KJTIIGC8Y1R12"
  },
  "formula": "read A as 10 … Z as 35; the whole number must leave remainder 1 when divided by 97; check digits = 98 − (first 18 characters + 00) mod 97",
  "references": [
    {
      "title": "GLEIF: ISO 17442, the LEI code structure",
      "url": "https://www.gleif.org/en/about-lei/iso-17442-the-lei-code-structure"
    }
  ],
  "warnings": []
}

Two characters swapped

Requestcurl
curl https://api.curatedapi.com/v1/calc/check/lei \
  -H "Authorization: Bearer $CURATEDAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "number": "5493001KJTIIGC8Y1R21"
  }'
200 OKResponse
{
  "calculator": "check/lei@1",
  "result": {
    "valid": false,
    "normalized": "5493001KJTIIGC8Y1R21",
    "problem": "CHECK_DIGIT",
    "message": "The check digits are 21, but the first 18 characters give 12 (ISO 17442, MOD 97-10).",
    "lou_prefix": "5493",
    "check_digits": "21",
    "expected_check_digits": "12"
  },
  "exactness": {},
  "precision": null,
  "inputs": {
    "number": "5493001KJTIIGC8Y1R21"
  },
  "formula": "read A as 10 … Z as 35; the whole number must leave remainder 1 when divided by 97; check digits = 98 − (first 18 characters + 00) mod 97",
  "references": [
    {
      "title": "GLEIF: ISO 17442, the LEI code structure",
      "url": "https://www.gleif.org/en/about-lei/iso-17442-the-lei-code-structure"
    }
  ],
  "warnings": []
}

References

Results follow each calculator's documented rules and the sources listed. They are not financial, tax or legal advice. Check that the rules fit your case before you rely on a result. See the terms.

Errors share one format; see errors. Billing, retries and batches work the same for every endpoint.