Connecticut Secretary of the State (United States)
reference Facts, options, APIs
On this page
- Open data, not the live register
- 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 Connecticut business ID in the Connecticut Business Registry, which the Business Services Division of the Secretary of the State keeps. It uses the registry’s master business table that is published on CT Open Data (dataset n7gp-d28j, Connecticut Business Registry - Business Master), which covers businesses of every status. For each golden record it stores the business name, business type, status and sub-status, where it was formed, its registration, dissolution and annual report dates, its business and mailing addresses, its email address and its NAICS code. No API key is needed.
Enricher version: V2
API key: not needed (an optional data.ct.gov app token raises the rate limit)
Open data, not the live register
The dataset is a copy of the Connecticut Business Registry that the portal refreshes daily (its metadata says Update Frequency: Daily; the create_dt column of each row says when it was last refreshed). It isn’t a live query of the registry, so a filing made today appears the next day. For the current state of a business, use the Secretary of the State’s business search.
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 – leave empty, or enter a data.ct.gov app token. Without a token, data.ct.gov limits how many requests it accepts from one address; with one, the limit is much higher. To get a token, sign in to data.ct.gov and create an app token in your developer settings (see Socrata app tokens). The script sends it in the
X-App-Tokenheader. -
Filters – we recommend a rule that only accepts golden records where
organization.connecticutBusinessIdhas a value. Otherwise, every record without a business ID is listed on the enricher’s Logs tab as having returned no results.
Vocabulary and Properties
organization.connecticutBusinessId
organization.connecticutBusinessId holds the 7-digit Connecticut business ID, which the dataset calls the account number (AccountNumber, the authoritative legal entity identifier), for example 0668349. If your data uses another vocabulary key, change this field and the BUSINESS_ID_KEY value at the top of the script.
Request and response
Base URL: https://data.ct.gov/resource
Endpoint: GET /n7gp-d28j.json?accountnumber={businessId}
Authentication: none; optional app token in the X-App-Token header
Rate limits: requests without an app token are throttled per IP address; requests with one aren’t, unless they are abusive (see Socrata app tokens). Each request takes about 1 second.
The script sends one request per golden record:
GET https://data.ct.gov/resource/n7gp-d28j.json?accountnumber=0668349
Accept: application/json
Response (one row; the business ID is unique):
[
{
"id": "001t000000WmspmAAB",
"name": "AETNA INC.",
"business_type": "Stock",
"status": "Active",
"sub_status": "Annual report due",
"accountnumber": "0668349",
"annual_report_due_date": "2027-12-13T00:00:00.000",
"began_transacting_in_ct": "2000-12-13T00:00:00.000",
"billingstreet": "151 Farmington Avenue",
"billingcity": "Hartford",
"billingcountry": "United States",
"billingpostalcode": "06156",
"billingstate": "CT",
"business_email_address": "CLS-CTARMSEVIDENCE@WOLTERSKLUWER.COM",
"business_name_in_state_country": "AETNA INC.",
"citizenship": "Foreign",
"country_formation": "United States",
"date_registration": "2000-12-13T00:00:00.000",
"formation_place": "PA",
"state_or_territory_formation": "PA",
"mailing_address": "151 Farmington Avenue , ,Hartford ,CT ,United States ,06156",
"woman_owned_organization": false,
"veteran_owned_organization": false,
"minority_owned_organization": false,
"org_owned_by_person_s_with": false,
"organization_is_lgbtqi_owned": false,
"naics_code": "Offices of Other Holding Companies (551112)",
"naics_sub_code": "551112",
"create_dt": "2026-12-01 00:15:45.2400000"
}
]
An empty array ([]) means that the business ID isn’t in the dataset. Fields without a value are left out of the row.
Properties added by the enricher
| Property | Response field | Example |
|---|---|---|
connecticut.businessId | accountnumber | 0668349 |
connecticut.recordId | id (the key that links the registry’s companion datasets) | 001t000000WmspmAAB |
connecticut.name | name | AETNA INC. |
connecticut.businessType | business_type | Stock |
connecticut.status | status | Active |
connecticut.subStatus | sub_status | Annual report due |
connecticut.citizenship | citizenship (Domestic or Foreign) | Foreign |
connecticut.formationPlace | state_or_territory_formation, or formation_place | PA |
connecticut.formationCountry | country_formation | United States |
connecticut.nameInFormationJurisdiction | business_name_in_state_country (foreign businesses) | AETNA INC. |
connecticut.registrationDate | date_registration (formed, or registered in Connecticut for a foreign business), as YYYY-MM-DD | 2000-12-13 |
connecticut.beganTransactingDate | began_transacting_in_ct, as YYYY-MM-DD | 2000-12-13 |
connecticut.dissolutionDate | dissolution_date (also the withdrawal date of a foreign business), as YYYY-MM-DD | 2021-11-15 |
connecticut.dissolutionReason | reason_for_administrative | Failure to appoint or maintain an agent for service |
connecticut.annualReportDueDate | annual_report_due_date, as YYYY-MM-DD | 2027-12-13 |
connecticut.address | billingstreet, billing_unit, billingcity, billingstate, billingpostalcode, billingcountry (the business address), on one line | 151 Farmington Avenue, Hartford, CT 06156, United States |
connecticut.city | billingcity | Hartford |
connecticut.state | billingstate | CT |
connecticut.postalCode | billingpostalcode | 06156 |
connecticut.country | billingcountry | United States |
connecticut.mailingAddress | mailing_address, without its empty parts | 151 Farmington Avenue, Hartford, CT, United States, 06156 |
connecticut.email | business_email_address | CLS-CTARMSEVIDENCE@WOLTERSKLUWER.COM |
connecticut.naicsCode | naics_sub_code, or the number in brackets at the end of naics_code | 551112 |
connecticut.naicsDescription | naics_code, without the number in brackets | Offices of Other Holding Companies |
connecticut.totalAuthorizedShares | total_authorized_shares | 200 |
connecticut.updatedDate | create_dt (the date the row was last refreshed), as YYYY-MM-DD | 2026-12-01 |
A property is added only when the dataset has a value for it. Address parts that hold only NONE or punctuation are left out. The business ownership survey answers (woman-owned, veteran-owned and so on), the records address, the addresses in the jurisdiction of formation and the dataset’s map location columns 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 Connecticut with the key prefix connecticut, 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, dots and dashes are removed, and IDs that lost their leading zeros are padded to 7 digits, so
668349is looked up as0668349. IDs that have more than 7 digits, contain letters, or are all zeros are skipped without calling the API. -
The dataset includes businesses of every status, so a dissolved, forfeited or withdrawn business is added with its status, for example
connecticut.status=Dissolvedand itsconnecticut.dissolutionDate. -
If the business ID isn’t in the dataset, the request is rejected, or the API returns an error, the script logs the reason and adds nothing, and nothing is cached.
-
If you entered an app token and data.ct.gov rejects it, the script throws an error that says so, and the golden record fails.
-
If data.ct.gov limits the requests (HTTP 429), the script throws an error that makes the enricher try the golden record again later. Enter an app token if this happens often.
-
Successful results are cached for 24 hours per business ID. To change this, edit
CACHE_MILLISECONDSin the script.
Testing the enricher
-
Test connection checks only that the script runs. It doesn’t call the API.
-
To try the setup, create a golden record with
organization.connecticutBusinessIdset to0668349(Aetna Inc.) or0783036(The Travelers Companies, Inc.).
Limitations
-
The dataset is refreshed daily, not a live query of the registry (see Open data, not the live register).
-
Lookups by name aren’t supported.
-
Principals, registered agents, filing history and name changes aren’t added. They are separate datasets on data.ct.gov (
ka36-64k6,qh2m-n44y,ah3s-bes7andenwv-52we), linked byconnecticut.recordId. -
The business email address is the one given to the registry; for many businesses it belongs to the registered agent or a filing service.
-
Values are as they were entered in the registry, so their capitalization and the format of the country of formation (
United States,USA,US) vary.
Process script
// REST API enricher (V2) - Connecticut business lookup
//
// Looks up a golden record's Connecticut business ID (account number) in the Connecticut Business
// Registry of the Secretary of the State, using the Business Master table that is published on CT
// Open Data (https://data.ct.gov/, dataset n7gp-d28j, "Connecticut Business Registry - Business
// Master"), and adds the result to the golden record as connecticut.* properties:
//
// connecticut.businessId business ID (account number) that was looked up
// connecticut.recordId the registry's internal ID, which links the companion datasets (principals, agents, filings)
// connecticut.name business name
// connecticut.businessType business type, for example LLC, Stock or Non-Stock
// connecticut.status status, for example Active, Dissolved, Forfeited or Withdrawn
// connecticut.subStatus sub-status, for example Annual report due
// connecticut.citizenship Domestic (formed in Connecticut) or Foreign
// connecticut.formationPlace state or territory of formation
// connecticut.formationCountry country of formation
// connecticut.nameInFormationJurisdiction name in the jurisdiction of formation (foreign businesses)
// connecticut.registrationDate date formed (domestic) or registered in Connecticut (foreign) (YYYY-MM-DD)
// connecticut.beganTransactingDate date a foreign business began transacting business in Connecticut (YYYY-MM-DD)
// connecticut.dissolutionDate date dissolved or withdrawn (YYYY-MM-DD)
// connecticut.dissolutionReason reason for an administrative dissolution or forfeiture
// connecticut.annualReportDueDate date the next annual report is due (YYYY-MM-DD)
// connecticut.address business address, on one line
// connecticut.city business address city
// connecticut.state business address state
// connecticut.postalCode business address ZIP code
// connecticut.country business address country
// connecticut.mailingAddress mailing address, on one line
// connecticut.email business email address
// connecticut.naicsCode NAICS code, for example 551112
// connecticut.naicsDescription NAICS description, for example Offices of Other Holding Companies
// connecticut.totalAuthorizedShares total authorized shares
// connecticut.updatedDate date the dataset row was last refreshed (YYYY-MM-DD)
//
// No API key is needed. An optional Socrata app token (for higher rate limits) can be entered
// in the API Key field. See README.md next to this file for the enricher settings.
//
// A record gets no result (nothing is stored) when it has no valid business ID, when the business
// ID isn't in the dataset, or when the API can't answer.
// ---- Settings -------------------------------------------------------------------------
// Vocabulary key to read. Add the same key to the Vocabulary and Properties field.
const BUSINESS_ID_KEY = "organization.connecticutBusinessId";
// The enricher replaces {APIKey} with the API Key field value: an optional data.ct.gov
// (Socrata) app token. Leave the field empty to call the API without one.
const APP_TOKEN = "{APIKey}";
const CONNECTICUT_URL = "https://data.ct.gov/resource/n7gp-d28j.json";
// How long to reuse an answer for the same business ID. 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 "";
}
// Connecticut business IDs are 7 digits, for example 0668349. Spaces, dashes and dots are
// removed, and numbers that lost their leading zeros are padded. Returns the ID or null.
function parseBusinessId(raw) {
const text = raw.replace(/[\s.\-]/g, "");
if (!/^\d{1,7}$/.test(text) || /^0+$/.test(text)) {
return null;
}
return ("0000000" + text).slice(-7);
}
function clean(value) {
if (value === null || value === undefined) {
return null;
}
const text = String(value).replace(/\s+/g, " ").trim();
return text === "" ? null : text;
}
// Address parts in this dataset sometimes hold "NONE" or a stray character such as "`".
function cleanPart(value) {
const text = clean(value);
return text && /[A-Za-z0-9]/.test(text) && text.toUpperCase() !== "NONE" ? text : null;
}
function parseJson(text) {
try {
return JSON.parse(text);
} catch (e) {
return null;
}
}
// Socrata dates look like "2000-12-13T00:00:00.000" (create_dt: "2026-12-01 00:15:45.2400000").
// Only the date is kept.
function formatDate(value) {
const text = clean(value);
return text && /^\d{4}-\d{2}-\d{2}/.test(text) ? text.substring(0, 10) : null;
}
// Joins address parts on one line, for example "151 Farmington Avenue, Hartford, CT 06156, United States".
function formatAddress(street, unit, city, state, zip, country) {
const stateZip = [cleanPart(state), cleanPart(zip)].filter((x) => x).join(" ");
const parts = [cleanPart(street), cleanPart(unit), cleanPart(city), stateZip, cleanPart(country)].filter((x) => x);
return parts.length > 0 ? parts.join(", ") : null;
}
// mailing_address is already on one line, but with empty parts: "151 Farmington Avenue , ,Hartford ,CT ,United States ,06156".
function formatMailingAddress(value) {
const text = clean(value);
if (!text) {
return null;
}
const parts = text.split(",").map(cleanPart).filter((x) => x);
return parts.length > 0 ? parts.join(", ") : null;
}
// naics_code looks like "Offices of Other Holding Companies (551112)".
function naicsCode(row) {
const match = /\((\d{2,6})\)\s*$/.exec(clean(row.naics_code) || "");
return clean(row.naics_sub_code) || (match ? match[1] : null);
}
function naicsDescription(row) {
const text = clean(row.naics_code);
return text ? clean(text.replace(/\(\d{2,6}\)\s*$/, "")) : null;
}
// Calls the API. Returns the rows for the business ID (possibly none), or null when the API can't
// answer.
function lookUp(businessId) {
const headers = [{ Key: "Accept", Value: "application/json" }];
if (clean(APP_TOKEN)) {
headers.push({ Key: "X-App-Token", Value: APP_TOKEN.trim() });
}
const apiResponse = http.send({
url: `${CONNECTICUT_URL}?accountnumber=${businessId}`,
method: "GET",
headers: headers,
});
const status = String(apiResponse.HttpStatus || "");
const body = parseJson(apiResponse.Content);
if (status === "TooManyRequests") {
throw new Error("TooManyRequests - data.ct.gov is throttling requests, the record will be retried");
}
if ((status === "Forbidden" || status === "Unauthorized") && clean(APP_TOKEN)) {
throw new Error(`data.ct.gov rejected the app token in the API Key field (HTTP ${status}). ${body && body.message ? body.message : ""}`);
}
if (status === "OK" && Array.isArray(body)) {
return body;
}
log(`Connecticut Business Registry could not look up business ID ${businessId}. HTTP ${status}. ${String(apiResponse.Content || "").substring(0, 200)}`);
return null;
}
function run() {
const businessId = parseBusinessId(getValue(BUSINESS_ID_KEY));
if (!businessId) {
// No valid business ID on this record (this is also what Test connection hits, because it
// passes placeholder values instead of real ones).
return [];
}
const cacheKey = `connecticut:${businessId}`;
const cached = CACHE_MILLISECONDS > 0 ? cache.get(cacheKey) : null;
let row = cached ? parseJson(String(cached)) : null;
if (!row) {
const rows = lookUp(businessId);
if (!rows) {
return [];
}
// The business ID is unique in the dataset, so there is at most one row.
row = rows.length > 0 && rows[0] && clean(rows[0].accountnumber) === businessId ? rows[0] : null;
if (!row) {
log(`Connecticut Business Registry has no business with ID ${businessId}.`);
return [];
}
if (CACHE_MILLISECONDS > 0) {
cache.set(cacheKey, JSON.stringify(row), CACHE_MILLISECONDS);
}
}
const data = {
"connecticut.businessId": businessId,
"connecticut.recordId": clean(row.id),
"connecticut.name": clean(row.name),
"connecticut.businessType": clean(row.business_type),
"connecticut.status": clean(row.status),
"connecticut.subStatus": clean(row.sub_status),
"connecticut.citizenship": clean(row.citizenship),
"connecticut.formationPlace": cleanPart(row.state_or_territory_formation) || cleanPart(row.formation_place),
"connecticut.formationCountry": cleanPart(row.country_formation),
"connecticut.nameInFormationJurisdiction": clean(row.business_name_in_state_country),
"connecticut.registrationDate": formatDate(row.date_registration),
"connecticut.beganTransactingDate": formatDate(row.began_transacting_in_ct),
"connecticut.dissolutionDate": formatDate(row.dissolution_date),
"connecticut.dissolutionReason": clean(row.reason_for_administrative),
"connecticut.annualReportDueDate": formatDate(row.annual_report_due_date),
"connecticut.address": formatAddress(row.billingstreet, row.billing_unit, row.billingcity, row.billingstate,
row.billingpostalcode, row.billingcountry),
"connecticut.city": cleanPart(row.billingcity),
"connecticut.state": cleanPart(row.billingstate),
"connecticut.postalCode": cleanPart(row.billingpostalcode),
"connecticut.country": cleanPart(row.billingcountry),
"connecticut.mailingAddress": formatMailingAddress(row.mailing_address),
"connecticut.email": clean(row.business_email_address),
"connecticut.naicsCode": naicsCode(row),
"connecticut.naicsDescription": naicsDescription(row),
"connecticut.totalAuthorizedShares": clean(row.total_authorized_shares),
"connecticut.updatedDate": formatDate(row.create_dt),
};
// 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());