Loading documentation

Access required

Your account doesn't have access to the documentation. Contact your administrator.

Sign out
Skip to main content

NAICS Search

Status: stable Category: lookup Added: 2026-04-27 Last reviewed: 2026-10-14

Summary​

Type-ahead search across BLS industry safety benchmarks. Pass a short fragment of either the industry name or a numeric NAICS prefix and get back the matching codes ranked closest first. Designed to power UI autocomplete; safe to call on every keystroke once q is at least two characters.

The dataset is the BLS Survey of Occupational Injuries and Illnesses, reseeded annually. Lookups always read the latest published year for each (code, ownership) pair. Like every lookup resource, each hit carries code and label, so one picker component works against every lookup endpoint.

Endpoint​

FieldValue
MethodGET
Path/api/lookup/naics/search
Full URLhttps://engine.tripod-health.com/api/lookup/naics/search
AuthenticationAPI key (required)
Request bodynone
Response bodyapplication/json
IdempotentYes
Rate-limitedYes

Authentication​

Send a valid API key in the apikey header. See authentication.md.

Request​

Headers​

HeaderRequiredDescription
apikeyYesConsumer API key.

Path parameters​

None.

Query parameters​

ParameterTypeRequiredDefaultDescription
qstringYes—Search fragment. Minimum two characters. An all-digit value matches as a NAICS code prefix; anything else matches as a case-insensitive substring of the industry name.
ownershipstringNoprivateOne of private, state_government, local_government. Picks the BLS ownership cohort.
limitintNo10Maximum results to return. Range 1–50.

Body​

None.

Response​

Success — 200 OK​

The response to GET /api/lookup/naics/search?q=construction&limit=5:

{
"results": [
{
"code": "23",
"label": "Construction",
"ownership": "private",
"total_recordable_rate": 2.2
},
{
"code": "236",
"label": "Construction of buildings",
"ownership": "private",
"total_recordable_rate": 2.2
},
{
"code": "237",
"label": "Heavy and civil engineering construction",
"ownership": "private",
"total_recordable_rate": 1.8
},
{
"code": "2361",
"label": "Residential building construction",
"ownership": "private",
"total_recordable_rate": 2.5
},
{
"code": "2362",
"label": "Nonresidential building construction",
"ownership": "private",
"total_recordable_rate": 1.9
}
],
"request_id": "f1b3fca4-4613-47cc-8357-394982cb9d74",
"timestamp": "2026-10-14T00:16:15.127Z"
}

results is always present. An empty array is a normal response (the query matched nothing in the requested ownership cohort), not an error.

Response fields​

FieldTypeAlways presentDescription
resultsarrayYesZero or more match objects, ordered by code length (shortest first), then by code.
results[].codestringYesNAICS code, 2–6 digits. Treat as opaque text rather than parsing as a number. Pass it to /api/lookup/naics/get ?code= for the full benchmark row.
results[].labelstringYesIndustry name as published by BLS.
results[].ownershipstringYesEchoes the ?ownership= value.
results[].total_recordable_ratenumber | nullYesTotal recordable case rate per 100 FTE. null when BLS suppressed the cell for sample-size reasons.
request_idstringYesCorrelation ID. Quote in support tickets.
timestampstring (ISO 8601 UTC)YesServer time when the response was emitted.

Status codes​

CodeMeaningWhen
200OKSearch ran. results may be empty.
400ValidationErrorq missing or shorter than two characters, ownership not in the allowed set, or limit out of range. field names the offending parameter.
401UnauthenticatedMissing or invalid API key.
429RateLimitedPer-consumer rate limit exceeded.
500InternalErrorUnexpected failure. Quote request_id in the ticket.

Examples​

curl​

curl -sS "https://engine.tripod-health.com/api/lookup/naics/search?q=construction&limit=5" \
-H "apikey: $ENGINE_API_KEY"

Returns the 200 body shown in Success above.

Numeric prefix​

curl -sS "https://engine.tripod-health.com/api/lookup/naics/search?q=236" \
-H "apikey: $ENGINE_API_KEY"

Python (requests)​

# Uses the call() helper from quickstart.md.
result = call("GET", "/api/lookup/naics/search?q=hospital&limit=5")
for row in result["results"]:
print(f"{row['code']:6} {row['label']:60} TRR={row['total_recordable_rate']}")

Node.js (native fetch)​

// Uses the call() helper from quickstart.md.
const result = await call("GET", "/api/lookup/naics/search?q=hospital&limit=5");
for (const row of result.results) {
console.log(`${row.code.padEnd(6)} ${row.label} TRR=${row.total_recordable_rate}`);
}

TypeScript​

interface NaicsSearchResult {
code: string;
label: string;
ownership: "private" | "state_government" | "local_government";
total_recordable_rate: number | null;
}

interface NaicsSearchResponse {
results: NaicsSearchResult[];
request_id: string;
timestamp: string;
}

const result = await call<NaicsSearchResponse>(
"GET",
"/api/lookup/naics/search?q=construction",
);

Error scenarios​

q too short​

Send:

curl -sS "https://engine.tripod-health.com/api/lookup/naics/search?q=h" \
-H "apikey: $ENGINE_API_KEY" \
-w "\nHTTP %{http_code}\n"

Receive (400):

{
"timestamp": "2026-10-14T00:16:15.411Z",
"error": "ValidationError",
"message": "Query parameter 'q' must be at least 2 characters",
"field": "q",
"request_id": "d943a85a-de9d-4dcb-8153-0d9e7520fbe7"
}

Invalid ownership​

Send:

curl -sS "https://engine.tripod-health.com/api/lookup/naics/search?q=hospital&ownership=federal" \
-H "apikey: $ENGINE_API_KEY" \
-w "\nHTTP %{http_code}\n"

Receive (400):

{
"timestamp": "2026-10-14T00:16:15.718Z",
"error": "ValidationError",
"message": "Query parameter 'ownership' must be one of private, state_government, local_government",
"field": "ownership",
"request_id": "34c37b2f-af69-4306-bea2-4354d19a6ee2"
}

Intended use​

  • Autocomplete UIs that let an employer find their industry by typing a few letters or digits.
  • Onboarding flows where the user has a NAICS code from another system and wants to confirm it lines up with the published industry name before submitting a calculation.
  • Building lookup tables when you need to display the industry name alongside a NAICS code your application stores.
  • One picker for every lookup resource. Each hit carries code and label, the same pair the ICD-10-CM, CPT, regulations, and fee schedule searches return.

Mistaken use​

  • Do not call search to fetch a single known code. Use /api/lookup/naics/get — one record, full benchmark fields, no ranking layer.
  • Do not interpret an empty results array as a failure. It means the query matched nothing in the requested ownership cohort. Try a shorter fragment or a different ?ownership=.
  • Do not pass a NAICS code to q and expect it to behave like get. Search returns multiple rows — for example q=23 matches every code beginning with 23. To resolve a single record, call /api/lookup/naics/get?code=23.

Debugging​

  1. Capture request_id from the response body (or, if the response has no body from the engine, the X-Request-ID response header).
  2. Empty results for a search you expected to match. Double-check ?ownership= — most BLS data ships only under private, and a request for state_government or local_government will be empty for industries the BLS does not publish under that cohort.
  3. 400 ValidationError with field: "q". The fragment was shorter than two characters. UI clients should not send the request until the user has typed at least two characters.
  4. null rate values in results. BLS suppresses cells when the survey sample is too small to publish a stable estimate. This is expected, especially on narrow 5- and 6-digit codes.

Rate limits​

See rate-limits.md for the current per-consumer limits.

Change history​

DateChange
2026-04-27Initial publication.
2026-10-14Moved from /api/naics/search to /api/lookup/naics/search. Result fields naics_code and industry_name renamed to code and label. Examples recaptured.
2026-10-14The X-Request-ID response header is the gateway's trace ID for the request and does not match request_id; quote request_id to support.