---
title: ARES (Czech Republic)
url: http://0.0.0.0:4000/govern/rest-api-enricher-samples/ares-czech-republic
content_type: reference
section: Govern & improve > REST API enricher samples
---

# ARES (Czech Republic)

> reference: Facts, options, APIs.

This example looks up an organization's Czech identification number (IČO) in ARES, the Administrative Register of Economic Subjects run by the Czech Ministry of Finance, by using its public [ARES REST API](https://ares.gov.cz/swagger-ui/). ARES combines the Czech public registers (the commercial register, the trade register, the register of economic subjects, the VAT register and others). For each golden record it stores the registered name, legal form code, tax identification number (DIČ) and whether the entity is registered for VAT, the registered office, and the establishment and termination dates. No API key is needed.

**Enricher version:** V2  
**API key:** not needed

To set up the enricher, see [Add REST API enricher](http://0.0.0.0:4000/govern/enrichment/rest-api#add-rest-api-enricher), then use the settings and script on this page.

## Settings

- **Accepted Business Domain** – `/Organization`, or the business domain that holds your companies.

- **Version** – V2 (recommended).

- **API Key** – leave empty.

- **Filters** – we recommend a rule that only accepts golden records where `organization.ico` has a value. Otherwise, every record without an IČO is listed on the enricher's **Logs** tab as having returned no results.

## Vocabulary and Properties

```
organization.ico
```

`organization.ico` holds the 8-digit IČO. The [Register of Legal Entities (Slovakia)](http://0.0.0.0:4000/govern/rest-api-enricher-samples/rpo-slovakia) sample uses the same key, because Slovak and Czech identification numbers have the same format. If your data holds both, use a separate key for each country, or a filter on the country. If your data uses another vocabulary key, change this field and the `ICO_KEY` value at the top of the script.

## Request and response

**Base URL:** `https://ares.gov.cz/ekonomicke-subjekty-v-be/rest`  
**Endpoint:** `GET /ekonomicke-subjekty/{ico}`  
**Authentication:** none  
**Rate limit:** no fixed limit is published. The [Ministry of Finance](https://mf.gov.cz/cs/ministerstvo/informacni-systemy/ares) says it sets limits on the number of queries per user, and may restrict users who send more than 500 queries a minute.

The script sends one request per golden record:

```http
GET https://ares.gov.cz/ekonomicke-subjekty-v-be/rest/ekonomicke-subjekty/45274649
Accept: application/json
```

Shortened response:

```json
{
  "ico": "45274649",
  "obchodniJmeno": "ČEZ, a. s.",
  "sidlo": {
    "kodStatu": "CZ",
    "nazevStatu": "Česká republika",
    "nazevKraje": "Hlavní město Praha",
    "nazevObce": "Praha",
    "nazevUlice": "Duhová",
    "cisloDomovni": 1444,
    "cisloOrientacni": 2,
    "nazevCastiObce": "Michle",
    "psc": 14000,
    "textovaAdresa": "Duhová 1444/2, Michle, 14000 Praha 4"
  },
  "pravniForma": "121",
  "financniUrad": "013",
  "datumVzniku": "1992-05-06",
  "datumAktualizace": "2026-11-10",
  "dic": "CZ45274649",
  "adresaDorucovaci": { "radekAdresy1": "Duhová 1444/2", "radekAdresy2": "Michle", "radekAdresy3": "14000 Praha 4" },
  "seznamRegistraci": { "stavZdrojeRos": "AKTIVNI", "stavZdrojeVr": "AKTIVNI", "stavZdrojeDph": "AKTIVNI" },
  "primarniZdroj": "ros"
}
```

## Properties added by the enricher

| Property | Response field | Example |
| -------- | -------------- | ------- |
| `ares.ico` | `ico` | `45274649` |
| `ares.name` | `obchodniJmeno` | `ČEZ, a. s.` |
| `ares.legalFormCode` | `pravniForma` | `121` |
| `ares.vatNumber` | `dic` | `CZ45274649` |
| `ares.vatRegistered` | `True` when `seznamRegistraci.stavZdrojeDph` is `AKTIVNI` | `True` |
| `ares.address` | `sidlo.textovaAdresa` (or the lines of `adresaDorucovaci`) | `Duhová 1444/2, Michle, 14000 Praha 4` |
| `ares.municipality` | `sidlo.nazevObce` | `Praha` |
| `ares.postalCode` | `sidlo.psc` | `14000` |
| `ares.region` | `sidlo.nazevKraje` | `Hlavní město Praha` |
| `ares.countryCode` | `sidlo.kodStatu` | `CZ` |
| `ares.establishmentDate` | `datumVzniku` | `1992-05-06` |
| `ares.terminationDate` | `datumZaniku` | `2020-06-30` |
| `ares.dissolved` | `True` when `datumZaniku` is set | `True` |
| `ares.updateDate` | `datumAktualizace` | `2026-11-10` |

A property is added only when ARES returns a value for it.

If the enricher has a **Preview** tab, the results appear there first. To add them to golden records, go to the **Map** tab, select **Map Data**, and choose **Auto Mapping**. Select the business domain, enter a new vocabulary named `ARES` with the key prefix `ares`, and then create the mapping. Auto mapping also uses `name` as the golden record name, so remove that from the mapping if you want to keep your existing names. Then process the data on the **Process** tab. If the enricher has no **Preview** tab, the properties are added to the golden record as soon as it is enriched.

## How the script handles input and errors

- Spaces and a leading `IČO`, `ICO`, or `CZ` are removed, so `CZ 452 74 649` (a company's DIČ) is looked up as `45274649`. Numbers written without their leading zeros are padded to 8 digits, so `177041` is looked up as `00177041`. The number must have a valid modulus 11 check digit. Golden records without a valid IČO are skipped without calling ARES.

- If the IČO isn't in ARES (HTTP 404, `NENALEZENO`), the request is invalid (HTTP 400, `CHYBA_VSTUPU`), or ARES returns another error, the script logs the reason and adds nothing.

- An entity that has ceased to exist is still returned. The script adds `ares.terminationDate` and `ares.dissolved` = `True`.

- If ARES reports that it is too busy (HTTP 429), the script throws an error that makes the enricher try the golden record again later.

- Successful results are cached for 24 hours per IČO. To change this, edit `CACHE_MILLISECONDS` in the script.

## Testing the enricher

- **Test connection** checks only that the script runs. It doesn't call ARES.

- To try the setup, create a golden record with `organization.ico` set to `45274649` (ČEZ, a. s.) or `00177041` (Škoda Auto a.s.).

## Limitations

- Only the legal form code is returned (for example `121` for a joint-stock company). The names are in the ARES code list `PravniForma`.

- Economic activities (CZ-NACE) aren't added: the endpoint returns all of an entity's registered activities without marking the main one.

- Details that only the individual registers hold, such as statutory bodies, shareholders, and registered capital, aren't added. ARES has a separate endpoint for each register, for example `/ekonomicke-subjekty-vr/{ico}` for the commercial register.

- Names and addresses are in Czech.

## Process script

```javascript
// REST API enricher (V2) - Czech company lookup with ARES
//
// Looks up a golden record's Czech identification number (IČO) in ARES, the Administrative
// Register of Economic Subjects run by the Czech Ministry of Finance, using its public REST API
// (https://ares.gov.cz/swagger-ui/), and adds the result to the golden record as ares.*
// properties:
//
//   ares.ico               8-digit IČO that was looked up
//   ares.name              registered name (obchodní jméno)
//   ares.legalFormCode     legal form code, for example 121 (joint-stock company)
//   ares.vatNumber         tax identification number (DIČ), for example CZ45274649
//   ares.vatRegistered     "True" / "False" - currently registered for VAT
//   ares.address           registered office address on one line
//   ares.municipality      municipality of the registered office
//   ares.postalCode        postal code of the registered office
//   ares.region            region of the registered office
//   ares.countryCode       country code of the registered office
//   ares.establishmentDate date the entity was established (YYYY-MM-DD)
//   ares.terminationDate   date the entity ceased to exist (YYYY-MM-DD)
//   ares.dissolved         "True" when the entity has ceased to exist
//   ares.updateDate        date ARES last updated the record (YYYY-MM-DD)
//
// No API key is needed. See README.md next to this file for the enricher settings.
//
// A record gets no result (nothing is stored) when it has no valid IČO, when the IČO isn't in
// ARES, or when the API can't answer.

// ---- Settings -------------------------------------------------------------------------

// Vocabulary key to read. Add the same key to the Vocabulary and Properties field.
const ICO_KEY = "organization.ico";

const ARES_URL = "https://ares.gov.cz/ekonomicke-subjekty-v-be/rest/ekonomicke-subjekty/";

// How long to reuse an answer for the same IČO. 0 turns caching off.
const CACHE_MILLISECONDS = 24 * 60 * 60 * 1000;

// ---- Script ---------------------------------------------------------------------------

function getValue(key) {
  // A plain loop rather than vocabularies.find(...): vocabularies is a .NET list, and when
  // .find is called from inside a function, later calls return the first call's match.
  const items = vocabularies || [];
  for (let i = 0; i < items.length; i++) {
    if (items[i].Key === key) {
      const value = items[i].Value;
      return value === null || value === undefined ? "" : String(value).trim();
    }
  }
  return "";
}

// Accepts "45274649", "452 74 649", "IČO: 45274649", a company's DIČ ("CZ45274649") and shorter
// numbers written without their leading zeros ("177041" -> "00177041"). Returns the 8 digits,
// or null when the value isn't a valid IČO (modulus 11 check digit).
function parseIco(raw) {
  const text = raw.toUpperCase().replace(/^(IČO|ICO|CZ)\s*:?\s*/, "");
  if (!/^[0-9\s]+$/.test(text)) {
    return null;
  }
  let digits = text.replace(/\s/g, "");
  if (digits.length < 6 || digits.length > 8) {
    return null;
  }
  while (digits.length < 8) {
    digits = "0" + digits;
  }
  let sum = 0;
  for (let i = 0; i < 7; i++) {
    sum += Number(digits.charAt(i)) * (8 - i);
  }
  const checkDigit = (11 - (sum % 11)) % 10;
  return checkDigit === Number(digits.charAt(7)) ? digits : null;
}

function clean(value) {
  if (value === null || value === undefined) {
    return null;
  }
  const text = String(value).replace(/\s+/g, " ").trim();
  return text === "" ? null : text;
}

function parseJson(text) {
  try {
    return JSON.parse(text);
  } catch (e) {
    return null;
  }
}

function dateOnly(value) {
  const text = clean(value);
  return text ? text.substring(0, 10) : null;
}

function formatAddress(entity) {
  const office = entity.sidlo || {};
  if (clean(office.textovaAdresa)) {
    return clean(office.textovaAdresa);
  }
  const delivery = entity.adresaDorucovaci || {};
  const lines = [delivery.radekAdresy1, delivery.radekAdresy2, delivery.radekAdresy3].map(clean).filter((x) => !!x);
  return lines.length > 0 ? lines.join(", ") : null;
}

// Calls the API. Returns the economic subject, or null when there's no answer to store.
function lookUp(ico) {
  const apiResponse = http.send({
    url: ARES_URL + ico,
    method: "GET",
    headers: [{ Key: "Accept", Value: "application/json" }],
  });

  const status = String(apiResponse.HttpStatus || "");
  const body = parseJson(apiResponse.Content);

  if (status === "TooManyRequests") {
    throw new Error("TooManyRequests - the ARES API is busy, the record will be retried");
  }

  if (status === "OK" && body && body.ico) {
    return body;
  }

  // 404 with kod NENALEZENO: the IČO isn't in ARES. 400 with kod CHYBA_VSTUPU: invalid input.
  const reason = body && body.kod ? `${body.kod}: ${body.popis}` : String(apiResponse.Content || "").substring(0, 200);
  log(`ARES could not look up ${ico}. HTTP ${status}. ${reason}`);
  return null;
}

function run() {
  const ico = parseIco(getValue(ICO_KEY));
  if (!ico) {
    // No valid IČO on this record (this is also what Test connection hits, because it passes
    // placeholder values instead of real ones).
    return [];
  }

  const cacheKey = `ares:${ico}`;
  const cached = CACHE_MILLISECONDS > 0 ? cache.get(cacheKey) : null;
  let entity = cached ? parseJson(String(cached)) : null;

  if (!entity) {
    entity = lookUp(ico);
    if (!entity) {
      return [];
    }
    if (CACHE_MILLISECONDS > 0) {
      cache.set(cacheKey, JSON.stringify(entity), CACHE_MILLISECONDS);
    }
  }

  const office = entity.sidlo || {};
  const registrations = entity.seznamRegistraci || {};
  const vatState = clean(registrations.stavZdrojeDph);
  const terminationDate = dateOnly(entity.datumZaniku);

  const data = {
    "ares.ico": clean(entity.ico),
    "ares.name": clean(entity.obchodniJmeno),
    "ares.legalFormCode": clean(entity.pravniForma),
    "ares.vatNumber": clean(entity.dic),
    "ares.vatRegistered": vatState ? vatState === "AKTIVNI" : null,
    "ares.address": formatAddress(entity),
    "ares.municipality": clean(office.nazevObce),
    "ares.postalCode": clean(office.psc),
    "ares.region": clean(office.nazevKraje),
    "ares.countryCode": clean(office.kodStatu),
    "ares.establishmentDate": dateOnly(entity.datumVzniku),
    "ares.terminationDate": terminationDate,
    "ares.dissolved": terminationDate ? true : null,
    "ares.updateDate": dateOnly(entity.datumAktualizace),
  };

  // Leave out values the register didn't return, so they don't overwrite existing data with blanks.
  Object.keys(data).forEach((key) => {
    if (data[key] === null) {
      delete data[key];
    }
  });

  return [{ Data: data, Score: 100 }];
}

response = JSON.stringify(run());
```

Up: [REST API enricher samples](http://0.0.0.0:4000/govern/rest-api-enricher-samples.md)
