Companies Registration Office (Ireland)
reference Facts, options, APIs
On this page
- Settings
- Vocabulary and Properties
- Request and response
- Properties added by the enricher
- How the script handles input and errors
- Testing the enricher
- Limitations
- Process script
This example looks up an organization’s Irish company number in the register of the Companies Registration Office (CRO) by using CRO Open Services, CRO’s REST API. For each golden record it stores the registered name, registered office address and Eircode, company type, status and status date, registration date, the dates of the last and next annual return and of the last accounts, and the place of business.
Enricher version: V2
API key: the email address you signed up with and your CRO Open Services API key, entered as email:API key. To get a key, sign up on services.cro.ie and send CRO the signed Open Services terms and conditions; there is no charge for company details.
To set up the enricher, see 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 – the email address you signed up with and your API key, separated by a colon:
email:API key, for examplesomeone@example.com:00000000-0000-0000-0000-000000000000. Both are case sensitive. The script sends them with HTTP Basic authentication. If the field is empty or has no colon, the script adds nothing and doesn’t call CRO. -
Filters – we recommend a rule that only accepts golden records where
organization.croNumberhas a value. Otherwise, every record without a company number is listed on the enricher’s Logs tab as having returned no results.
Vocabulary and Properties
organization.croNumber
organization.croNumber holds the CRO company number. If your data uses another vocabulary key, change this field and the COMPANY_NUMBER_KEY value at the top of the script.
To look up registered business names instead of companies, set COMPANY_BUS_IND at the top of the script to B and use a vocabulary key that holds business name numbers.
Request and response
Base URL: https://services.cro.ie/cws
Endpoint: GET /company/{companyNumber}/{C|B}?format=json
Authentication: HTTP Basic authentication with your sign-up email address and API key
Rate limits: CRO doesn’t publish a rate limit. CRO’s status endpoint, https://services.cro.ie/cws/status, tells you whether the service is running.
The script sends one request per golden record. Without format=json, CRO answers in XML:
GET https://services.cro.ie/cws/company/512080/C?format=json&htmlEnc=0
Authorization: Basic <base64 of email:API key>
Accept: application/json
Response (a real CRO record):
{
"company_num": 512080,
"company_bus_ind": "C",
"company_name": "GOOGLE COMMERCE LIMITED",
"company_addr_1": "70 SIR JOHN ROGERSON'S QUAY",
"company_addr_2": "DUBLIN 2.",
"company_addr_3": "DUBLIN 2, DUBLIN, D02R296, IRELAND",
"company_addr_4": "",
"company_reg_date": "2012-04-18T00:00:00Z",
"company_status_desc": "Normal ",
"company_status_date": "2012-04-18T00:00:00Z",
"last_ar_date": "2026-09-30T00:00:00Z",
"next_ar_date": "2027-09-30T00:00:00Z",
"last_acc_date": "2025-12-31T00:00:00Z",
"comp_type_desc": "LTD - Private Company Limited by Shares",
"company_type_code": 1153,
"company_status_code": 1151,
"place_of_business": "IRELAND",
"eircode": "D02R296"
}
Properties added by the enricher
| Property | Response field | Example |
|---|---|---|
cro.companyNumber | company_num | 512080 |
cro.name | company_name | GOOGLE COMMERCE LIMITED |
cro.address | company_addr_1 to company_addr_4, on one line | 70 SIR JOHN ROGERSON'S QUAY, DUBLIN 2., DUBLIN 2, DUBLIN, D02R296, IRELAND |
cro.eircode | eircode | D02R296 |
cro.companyType | comp_type_desc | LTD - Private Company Limited by Shares |
cro.companyTypeCode | company_type_code | 1153 |
cro.status | company_status_desc | Normal |
cro.statusCode | company_status_code | 1151 |
cro.statusDate | company_status_date, as YYYY-MM-DD | 2012-04-18 |
cro.registrationDate | company_reg_date, as YYYY-MM-DD | 2012-04-18 |
cro.lastAnnualReturnDate | last_ar_date, as YYYY-MM-DD | 2026-09-30 |
cro.nextAnnualReturnDate | next_ar_date, as YYYY-MM-DD | 2027-09-30 |
cro.lastAccountsDate | last_acc_date, as YYYY-MM-DD | 2025-12-31 |
cro.placeOfBusiness | place_of_business | IRELAND |
A property is added only when CRO returns a value for it. CRO uses 0001-01-01 for a date it doesn’t have (for example, no accounts filed); such dates aren’t added.
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 CRO with the key prefix cro, 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, leading zeros, and a leading
CROorNo.are removed, soCRO 0512 080is looked up as512080. Values that aren’t 1 to 7 digits, such as an Irish VAT number, are skipped without calling CRO. -
CRO answers an unknown company number with a record whose values are empty. In that case, and when CRO returns an error, the script logs the reason and adds nothing.
-
If CRO rejects the credentials (HTTP 401 or 403, for example
Access denied. Invalid API credentials in Header.), the script throws an error, so the golden record is listed on the Logs tab with a message to check the API Key field. -
If CRO reports that it is too busy (HTTP 429 or 503), the script throws an error that makes the enricher try the golden record again later.
-
Successful results are cached for 24 hours per company number. To change this, edit
CACHE_MILLISECONDSin the script.
Testing the enricher
-
Test connection checks only that the script runs. It doesn’t call CRO.
-
To try the setup, create a golden record with
organization.croNumberset to512080(Google Commerce Limited). -
CRO’s own sample code includes a test email address and key. They only return a few sample companies (for example
83740, Foster Wheeler Ireland Limited); for other numbers CRO answersAuthorization credentials are not valid, and the script reports that the credentials were rejected. Use your own key for real enrichment.
Limitations
-
Only the company details are added. Officers, filed documents (submissions) and beneficial ownership aren’t added; documents are available from CRO for a fee.
-
The registered office address is returned as up to four free-text lines, which the script joins on one line. It isn’t split into street, town and county.
Process script
// REST API enricher (V2) - Irish company lookup with the Companies Registration Office (CRO)
//
// Looks up a golden record's Irish company number in the register of the Companies Registration
// Office (CRO) by using CRO Open Services (https://services.cro.ie/), and adds the result to the
// golden record as cro.* properties:
//
// cro.companyNumber company number that was looked up
// cro.name registered company name
// cro.address registered office address on one line
// cro.eircode Eircode of the registered office
// cro.companyType company type, for example LTD - Private Company Limited by Shares
// cro.companyTypeCode CRO company type code
// cro.status company status, for example Normal, Dissolved, Liquidation
// cro.statusCode CRO company status code
// cro.statusDate date of the current status (YYYY-MM-DD)
// cro.registrationDate date the company was registered (YYYY-MM-DD)
// cro.lastAnnualReturnDate date of the last annual return (YYYY-MM-DD)
// cro.nextAnnualReturnDate date the next annual return is due (YYYY-MM-DD)
// cro.lastAccountsDate date of the last accounts (YYYY-MM-DD)
// cro.placeOfBusiness place of business, for example Ireland
//
// Needs a CRO Open Services API key (free, after you sign CRO's terms and conditions). Enter
// "email:API key" in the enricher's API Key field, using the email address you signed up with.
// See README.md next to this file for the enricher settings.
//
// A record gets no result (nothing is stored) when it has no valid company number, when no
// company is registered with it, or when the API can't answer. Missing credentials make no call;
// rejected credentials fail the record with an error that says so.
// ---- Settings -------------------------------------------------------------------------
// Vocabulary key to read. Add the same key to the Vocabulary and Properties field.
const COMPANY_NUMBER_KEY = "organization.croNumber";
const CRO_URL = "https://services.cro.ie/cws/company/";
// C looks up companies. Use B to look up registered business names instead.
const COMPANY_BUS_IND = "C";
// The {APIKey} placeholder is replaced with the API Key field value ("email:API key").
const API_KEY = "{APIKey}";
// How long to reuse an answer for the same company number. 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 "512080", "512 080", "CRO 512080" and "0512080". Returns the number without leading
// zeros, or null when it isn't a company number (1 to 7 digits).
function parseCompanyNumber(raw) {
const text = raw.toUpperCase().replace(/^CRO/, "").replace(/^NO\.?/, "");
if (/[A-Z]/.test(text)) {
return null;
}
const digits = text.replace(/[^0-9]/g, "").replace(/^0+/, "");
return /^[1-9]\d{0,6}$/.test(digits) ? digits : null;
}
// "email:API key" from the API Key field as a Basic authorization header value, or null.
function authorization() {
const value = String(API_KEY || "").trim();
const separator = value.indexOf(":");
if (separator <= 0 || separator === value.length - 1) {
return null;
}
return "Basic " + stringEncoder.toBase64(value);
}
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;
}
}
// CRO dates are date-times such as 1981-07-08T00:00:00Z. Returns YYYY-MM-DD; .NET's default
// date (0001-01-01) means none.
function dateOnly(value) {
const text = clean(value);
if (!text || !/^\d{4}-\d{2}-\d{2}/.test(text) || text.indexOf("0001-01-01") === 0) {
return null;
}
return text.substring(0, 10);
}
function formatAddress(company) {
const lines = [company.company_addr_1, company.company_addr_2, company.company_addr_3, company.company_addr_4]
.map((x) => clean(x))
.filter((x) => !!x);
return lines.length > 0 ? lines.join(", ") : null;
}
// Calls the API. Returns the company, or null when there's no answer to store.
function lookUp(companyNumber, authorizationHeader) {
const apiResponse = http.send({
// format=json: without it, CRO answers in XML.
url: `${CRO_URL}${companyNumber}/${COMPANY_BUS_IND}?format=json&htmlEnc=0`,
method: "GET",
headers: [
{ Key: "Authorization", Value: authorizationHeader },
{ Key: "Accept", Value: "application/json" },
],
});
const status = String(apiResponse.HttpStatus || "");
const body = parseJson(apiResponse.Content);
if (status === "TooManyRequests" || status === "ServiceUnavailable") {
throw new Error(`TooManyRequests - CRO Open Services is busy (HTTP ${status}), the record will be retried`);
}
if (status === "Unauthorized" || status === "Forbidden") {
const reason = clean(String(apiResponse.Content || "").replace(/<[^>]*>/g, " ").replace(/"/g, ""));
throw new Error(`CRO rejected the credentials in the API Key field (HTTP ${status}: ${reason}). Enter "email:API key", with the email address you signed up with.`);
}
// An unknown company number comes back as a company with empty values.
if (status === "OK" && body && !Array.isArray(body) && clean(body.company_name)) {
return body;
}
log(`CRO could not look up company ${companyNumber}. HTTP ${status}. ${String(apiResponse.Content || "").substring(0, 200)}`);
return null;
}
function run() {
const companyNumber = parseCompanyNumber(getValue(COMPANY_NUMBER_KEY));
if (!companyNumber) {
// No valid company number on this record (this is also what Test connection hits, because
// it passes placeholder values instead of real ones).
return [];
}
const authorizationHeader = authorization();
if (!authorizationHeader) {
log('No CRO credentials. Enter "email:API key" in the API Key field of the enricher.');
return [];
}
const cacheKey = `cro:${COMPANY_BUS_IND}:${companyNumber}`;
const cached = CACHE_MILLISECONDS > 0 ? cache.get(cacheKey) : null;
let company = cached ? parseJson(String(cached)) : null;
if (!company) {
company = lookUp(companyNumber, authorizationHeader);
if (!company) {
return [];
}
if (CACHE_MILLISECONDS > 0) {
cache.set(cacheKey, JSON.stringify(company), CACHE_MILLISECONDS);
}
}
const data = {
"cro.companyNumber": clean(company.company_num) || companyNumber,
"cro.name": clean(company.company_name),
"cro.address": formatAddress(company),
"cro.eircode": clean(company.eircode),
"cro.companyType": clean(company.comp_type_desc),
"cro.companyTypeCode": clean(company.company_type_code),
"cro.status": clean(company.company_status_desc),
"cro.statusCode": clean(company.company_status_code),
"cro.statusDate": dateOnly(company.company_status_date),
"cro.registrationDate": dateOnly(company.company_reg_date),
"cro.lastAnnualReturnDate": dateOnly(company.last_ar_date),
"cro.nextAnnualReturnDate": dateOnly(company.next_ar_date),
"cro.lastAccountsDate": dateOnly(company.last_acc_date),
"cro.placeOfBusiness": clean(company.place_of_business),
};
// Leave out values CRO 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());