Oregon Secretary of State (United States)

reference Facts, options, APIs

On this page

This example looks up an organization’s Oregon registry number in the business registry of the Oregon Secretary of State (Corporation Division). It uses the extract of active businesses that the Corporation Division publishes on Oregon’s open data portal (dataset tckn-sxa6, Active Businesses - ALL), which covers corporations, LLCs, partnerships, nonprofits, business trusts and assumed business names. For each golden record it stores the business name, entity type, registry date, jurisdiction, principal place of business, mailing address, registered agent, authorized representative, and a link to the business on the Secretary of State’s Business Registry site. No API key is needed.

Enricher version: V2
API key: not needed (an optional data.oregon.gov app token raises the rate limit)

Open data, not the live register

The dataset is a copy of the business registry that the portal refreshes weekly (its metadata says Data Publishing Frequency: Weekly). It isn’t a live query of the registry, so a recent filing may take up to a week to appear. For the current state of a business, use the Secretary of State’s business registry search.

Active businesses only

The dataset lists only active businesses. A business that is inactive (for example dissolved or administratively dissolved) isn’t in it, so it gets no result.

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.oregon.gov app token. Without a token, data.oregon.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.oregon.gov and create an app token in your developer settings (see Socrata app tokens). The script sends it in the X-App-Token header.

  • Filters – we recommend a rule that only accepts golden records where organization.oregonRegistryNumber has a value. Otherwise, every record without a registry number is listed on the enricher’s Logs tab as having returned no results.

Vocabulary and Properties

organization.oregonRegistryNumber

organization.oregonRegistryNumber holds the registry number that the Corporation Division assigns to each business, for example 8739914. If your data uses another vocabulary key, change this field and the REGISTRY_NUMBER_KEY value at the top of the script.

Request and response

Base URL: https://data.oregon.gov/resource
Endpoint: GET /tckn-sxa6.json?registry_number={registryNumber}&$order=:id&$limit=50
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 usually takes about 1 second; the first request after a while can take over 10 seconds.

The script sends one request per golden record:

GET https://data.oregon.gov/resource/tckn-sxa6.json?registry_number=8739914&$order=:id&$limit=50
Accept: application/json

The dataset has one row for each address or associated name of a business: its principal place of business, mailing address, registered agent and, for assumed business names, authorized representative. The business’s own details are repeated on each row. Response:

[
  {
    "registry_number": "8739914",
    "business_name": "NIKE, INC.",
    "entity_type": "DOMESTIC BUSINESS CORPORATION",
    "registry_date": "1969-09-08T00:00:00.000",
    "associated_name_type": "PRINCIPAL PLACE OF BUSINESS",
    "address": "ONE BOWERMAN DRIVE",
    "city": "BEAVERTON",
    "state": "OR",
    "zip": "97005",
    "jurisdiction": "OR",
    "business_details": {
      "url": "http://egov.sos.state.or.us/br/pkg_web_name_srch_inq.do_name_srch?p_name=&p_regist_nbr=8739914&p_srch=PHASE1&p_print=FALSE&p_entity_status=ACTINA"
    }
  },
  {
    "registry_number": "8739914",
    "business_name": "NIKE, INC.",
    "entity_type": "DOMESTIC BUSINESS CORPORATION",
    "registry_date": "1969-09-08T00:00:00.000",
    "associated_name_type": "MAILING ADDRESS",
    "address": "ONE BOWERMAN DRIVE",
    "city": "BEAVERTON",
    "state": "OR",
    "zip": "97005",
    "jurisdiction": "OR",
    "business_details": { "url": "http://egov.sos.state.or.us/br/pkg_web_name_srch_inq.do_name_srch?p_name=&p_regist_nbr=8739914&p_srch=PHASE1&p_print=FALSE&p_entity_status=ACTINA" }
  },
  {
    "registry_number": "8739914",
    "business_name": "NIKE, INC.",
    "entity_type": "DOMESTIC BUSINESS CORPORATION",
    "registry_date": "1969-09-08T00:00:00.000",
    "associated_name_type": "REGISTERED AGENT",
    "entity_of_record_reg_number": "119890796",
    "entity_of_record_name": "UNITED AGENT GROUP INC.",
    "address": "7185 SW SANDBURG ST STE 110",
    "city": "PORTLAND",
    "state": "OR",
    "zip": "97223",
    "jurisdiction": "OR",
    "business_details": { "url": "http://egov.sos.state.or.us/br/pkg_web_name_srch_inq.do_name_srch?p_name=&p_regist_nbr=8739914&p_srch=PHASE1&p_print=FALSE&p_entity_status=ACTINA" }
  }
]

An empty array ([]) means that the registry number isn’t in the dataset: the business is inactive or the number doesn’t exist. Fields without a value are left out of the row.

Properties added by the enricher

Property Response field Example
oregon.registryNumber registry_number 8739914
oregon.name business_name NIKE, INC.
oregon.entityType entity_type DOMESTIC BUSINESS CORPORATION
oregon.registryDate registry_date, as YYYY-MM-DD 1969-09-08
oregon.jurisdiction jurisdiction OR
oregon.principalAddress address, address_continued, city, state, zip of the PRINCIPAL PLACE OF BUSINESS row, on one line ONE BOWERMAN DRIVE, BEAVERTON, OR 97005
oregon.principalCity city of that row BEAVERTON
oregon.principalState state of that row OR
oregon.principalPostalCode zip of that row 97005
oregon.mailingAddress the address of the MAILING ADDRESS row, on one line ONE BOWERMAN DRIVE, BEAVERTON, OR 97005
oregon.registeredAgent entity_of_record_name, not_of_record_entity, or first_name, middle_name, last_name, suffix of the REGISTERED AGENT row UNITED AGENT GROUP INC.
oregon.registeredAgentAddress the address of that row, on one line 7185 SW SANDBURG ST STE 110, PORTLAND, OR 97223
oregon.authorizedRepresentative the name of the AUTHORIZED REPRESENTATIVE row, read the same way as the registered agent KKR CC, LLC
oregon.detailsUrl business_details.url http://egov.sos.state.or.us/br/pkg_web_name_srch_inq.do_name_srch?p_name=&p_regist_nbr=8739914&...

A property is added only when the dataset has 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 Oregon with the key prefix oregon, 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, dashes and leading zeros are removed, so 873991-4 is looked up as 8739914. The number must then have 5 to 9 digits. Golden records without a valid number are skipped without calling the API.

  • The script merges a business’s rows into one result. For each kind of row (principal place of business, mailing address, registered agent, authorized representative) it uses the first row in the dataset’s order. Some assumed business names list the same representative several times with different spellings; only the first is used. At most 50 rows are read.

  • If the registry number isn’t in the dataset (because the business is inactive or the number doesn’t exist), 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.oregon.gov rejects it, the script throws an error that says so, and the golden record fails.

  • If data.oregon.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 registry number. Only the merged properties are cached, not the rows. To change this, edit CACHE_MILLISECONDS in 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.oregonRegistryNumber set to 8739914 (Nike, Inc.) or 299818 (United Methodist Church, Oregon City, Oregon).

Limitations

  • Only active businesses are in the dataset (see Active businesses only), so there is no status property.

  • The dataset is refreshed weekly, not a live query of the registry (see Open data, not the live register).

  • Lookups by name aren’t supported.

  • Assumed business names (ASSUMED BUSINESS NAME) have their own registry numbers and are returned like other businesses; the business that uses the name is in oregon.authorizedRepresentative.

  • Officers, such as the president and secretary, aren’t in the dataset. Values are in capital letters, as they are in the dataset.

  • The dataset has no data dictionary; the column meanings above are taken from the column names and the data.

Process script

// REST API enricher (V2) - Oregon business lookup
//
// Looks up a golden record's Oregon registry number in the business registry of the Oregon
// Secretary of State (Corporation Division), using the extract of active businesses that is
// published on Oregon's open data portal (https://data.oregon.gov/, dataset tckn-sxa6, "Active
// Businesses - ALL"), and adds the result to the golden record as oregon.* properties:
//
//   oregon.registryNumber           registry number that was looked up
//   oregon.name                     business name
//   oregon.entityType               entity type, for example DOMESTIC BUSINESS CORPORATION or ASSUMED BUSINESS NAME
//   oregon.registryDate             date the business was registered (YYYY-MM-DD)
//   oregon.jurisdiction             jurisdiction of formation, for example OR or DE
//   oregon.principalAddress         principal place of business, on one line
//   oregon.principalCity            principal place of business city
//   oregon.principalState           principal place of business state
//   oregon.principalPostalCode      principal place of business ZIP code
//   oregon.mailingAddress           mailing address, on one line
//   oregon.registeredAgent          name of the registered agent
//   oregon.registeredAgentAddress   registered agent's address, on one line
//   oregon.authorizedRepresentative name of the authorized representative (assumed business names)
//   oregon.detailsUrl               link to the business on the Secretary of State's Business Registry site
//
// The dataset has one row for each address or associated name of a business (principal place of
// business, mailing address, registered agent, authorized representative). The script uses the
// first row of each kind. The dataset lists active businesses only; an inactive business is not in
// it and gets no result.
//
// 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 registry number, when the
// registry number 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 REGISTRY_NUMBER_KEY = "organization.oregonRegistryNumber";

// The enricher replaces {APIKey} with the API Key field value: an optional data.oregon.gov
// (Socrata) app token. Leave the field empty to call the API without one.
const APP_TOKEN = "{APIKey}";

const OREGON_URL = "https://data.oregon.gov/resource/tckn-sxa6.json";

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

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

// A business has a handful of rows; this caps the response in case of bad data.
const MAX_ROWS = 50;

const PRINCIPAL = "PRINCIPAL PLACE OF BUSINESS";
const MAILING = "MAILING ADDRESS";
const AGENT = "REGISTERED AGENT";
const REPRESENTATIVE = "AUTHORIZED REPRESENTATIVE";

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 "";
}

// Oregon registry numbers are 5 to 9 digits, for example 8739914 or 226205391. Spaces, dashes and
// dots are removed. Returns the number or null.
function parseRegistryNumber(raw) {
  const text = raw.replace(/[\s.\-]/g, "").replace(/^0+/, "");
  return /^\d{5,9}$/.test(text) ? text : 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;
  }
}

// Socrata dates look like "1969-09-08T00:00:00.000". 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 the address of a row on one line, for example "ONE BOWERMAN DRIVE, BEAVERTON, OR 97005".
function formatAddress(row) {
  if (!row) {
    return null;
  }
  const stateZip = [clean(row.state), clean(row.zip)].filter((x) => x).join(" ");
  const parts = [clean(row.address), clean(row.address_continued), clean(row.city), stateZip].filter((x) => x);
  return parts.length > 0 ? parts.join(", ") : null;
}

// The associated name is an organization on record, an organization not on record, or a person.
function associatedName(row) {
  if (!row) {
    return null;
  }
  const person = [clean(row.first_name), clean(row.middle_name), clean(row.last_name), clean(row.suffix)]
    .filter((x) => x).join(" ");
  return clean(row.entity_of_record_name) || clean(row.not_of_record_entity) || clean(person);
}

// Keeps the first row of each kind of address or associated name, and only the fields the script
// uses, so that is all that is cached.
function merge(rows, registryNumber) {
  const byType = {};
  let first = null;
  for (let i = 0; i < rows.length; i++) {
    const row = rows[i];
    if (!row || clean(row.registry_number) !== registryNumber) {
      continue;
    }
    first = first || row;
    const type = clean(row.associated_name_type) || "";
    if (!byType[type]) {
      byType[type] = row;
    }
  }
  if (!first) {
    return null;
  }

  const principal = byType[PRINCIPAL] || null;
  return {
    name: clean(first.business_name),
    entityType: clean(first.entity_type),
    registryDate: formatDate(first.registry_date),
    jurisdiction: clean(first.jurisdiction),
    principalAddress: formatAddress(principal),
    principalCity: principal ? clean(principal.city) : null,
    principalState: principal ? clean(principal.state) : null,
    principalPostalCode: principal ? clean(principal.zip) : null,
    mailingAddress: formatAddress(byType[MAILING]),
    registeredAgent: associatedName(byType[AGENT]),
    registeredAgentAddress: formatAddress(byType[AGENT]),
    authorizedRepresentative: associatedName(byType[REPRESENTATIVE]),
    detailsUrl: first.business_details && clean(first.business_details.url) ? clean(first.business_details.url) : null,
  };
}

// Calls the API. Returns the rows for the registry number (possibly none), or null when the API
// can't answer.
function lookUp(registryNumber) {
  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: `${OREGON_URL}?registry_number=${registryNumber}&$order=:id&$limit=${MAX_ROWS}`,
    method: "GET",
    headers: headers,
  });

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

  if (status === "TooManyRequests") {
    throw new Error("TooManyRequests - data.oregon.gov is throttling requests, the record will be retried");
  }

  if ((status === "Forbidden" || status === "Unauthorized") && clean(APP_TOKEN)) {
    throw new Error(`data.oregon.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(`Oregon active businesses could not look up registry number ${registryNumber}. HTTP ${status}. ${String(apiResponse.Content || "").substring(0, 200)}`);
  return null;
}

function run() {
  const registryNumber = parseRegistryNumber(getValue(REGISTRY_NUMBER_KEY));
  if (!registryNumber) {
    // No valid registry number on this record (this is also what Test connection hits, because
    // it passes placeholder values instead of real ones).
    return [];
  }

  const cacheKey = `oregon:${registryNumber}`;
  const cached = CACHE_MILLISECONDS > 0 ? cache.get(cacheKey) : null;
  let business = cached ? parseJson(String(cached)) : null;

  if (!business) {
    const rows = lookUp(registryNumber);
    if (!rows) {
      return [];
    }
    business = merge(rows, registryNumber);
    if (!business) {
      log(`Oregon active businesses has no business with registry number ${registryNumber}. It may be inactive or not exist.`);
      return [];
    }
    if (CACHE_MILLISECONDS > 0) {
      cache.set(cacheKey, JSON.stringify(business), CACHE_MILLISECONDS);
    }
  }

  const data = {
    "oregon.registryNumber": registryNumber,
    "oregon.name": business.name,
    "oregon.entityType": business.entityType,
    "oregon.registryDate": business.registryDate,
    "oregon.jurisdiction": business.jurisdiction,
    "oregon.principalAddress": business.principalAddress,
    "oregon.principalCity": business.principalCity,
    "oregon.principalState": business.principalState,
    "oregon.principalPostalCode": business.principalPostalCode,
    "oregon.mailingAddress": business.mailingAddress,
    "oregon.registeredAgent": business.registeredAgent,
    "oregon.registeredAgentAddress": business.registeredAgentAddress,
    "oregon.authorizedRepresentative": business.authorizedRepresentative,
    "oregon.detailsUrl": business.detailsUrl,
  };

  // 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 || data[key] === undefined) {
      delete data[key];
    }
  });

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

response = JSON.stringify(run());