> ## Documentation Index
> Fetch the complete documentation index at: https://docs.companyenrich.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Find companies by industry or NAICS code

> Find companies in an industry with the Company Search API, using NAICS codes, categories such as SaaS, or keywords such as fintech. Code lookups are free.

To find companies in an industry, filter the [Company Search API](https://docs.companyenrich.com/docs/company-search-api.md) by NAICS code, category, or keyword. `naicsCodes` takes a code or a prefix of 2 to 6 digits, `categories` takes a business model such as `saas`, and `keywords` takes topics such as `fintech`. A filter search costs 1 credit per company returned.

| Filter | Takes | An array matches | Best for |
| - | - | - | - |
| `naicsCodes` | NAICS codes or prefixes, as strings of 2 to 6 digits | Any code | Standard industry classification |
| `categories` | One of nine [company categories](https://docs.companyenrich.com/docs/field-values.md#company-categories), such as `saas` or `e-commerce` | Every category | Business model |
| `keywords` | Keywords that describe the company, such as `fintech` | Every keyword | Niches that have no industry code |

## Find companies by NAICS code

This search returns companies in the United States whose NAICS code starts with `5112`. A shorter prefix covers a broader industry group, and a full six-digit code covers one industry.

```bash cURL theme={null}
curl -X POST https://api.companyenrich.com/v2/companies/search \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "naicsCodes": ["5112"],
      "country": "US"
    },
    "pageSize": 25
  }'
```

```javascript JavaScript theme={null}
import { CompanyEnrich } from '@companyenrich/sdk';

const client = new CompanyEnrich(); // reads COMPANYENRICH_API_KEY

const page = await client.companies.search({
  filter: { naicsCodes: ['5112'], country: 'US' },
  pageSize: 25,
});

for (const company of page.items) {
  console.log(company.name, company.domain, company.industry);
}
```

```python Python theme={null}
from companyenrich import CompanyEnrich

client = CompanyEnrich()  # reads COMPANYENRICH_API_KEY

page = client.companies.search(
    filter={"naicsCodes": ["5112"], "country": "US"},
    page_size=25,
)

for company in page["items"]:
    print(company.get("name"), company["domain"], company.get("industry"))
```

```ruby Ruby theme={null}
require "companyenrich"

client = CompanyEnrich::Client.new # reads COMPANYENRICH_API_KEY

page = client.companies.search(
  filter: { naicsCodes: ["5112"], country: "US" },
  page_size: 25
)

page["items"].each do |company|
  puts "#{company['name']} #{company['domain']} #{company['industry']}"
end
```

```php PHP theme={null}
<?php

require 'vendor/autoload.php';

use CompanyEnrich\Client;

$client = new Client(); // reads COMPANYENRICH_API_KEY

$page = $client->companies->search(
    filter: ['naicsCodes' => ['5112'], 'country' => 'US'],
    pageSize: 25,
);

foreach ($page['items'] as $company) {
    echo $company['name'] ?? '', ' ', $company['domain'], ' ', $company['industry'] ?? '', PHP_EOL;
}
```

```bash CLI theme={null}
companyenrich company search --naics 5112 --country US --limit 25
```

Each item is a full [company record](https://docs.companyenrich.com/docs/company-schema.md), with the name of its primary industry in `industry`. This example is shortened and shows a fictional company.

```json theme={null}
{
  "items": [
    {
      "id": "3f2b8c1e-6a4d-4f7a-9b21-0c5d8e7f1a23",
      "name": "Acme Analytics",
      "domain": "acme-analytics.example",
      "employees": "201-500",
      "industry": "Software Publishers",
      "industries": ["Software Publishers"],
      "location": {
        "country": { "code": "US", "name": "United States" }
      },
      "updatedAt": "2026-10-01T12:00:00Z"
    }
  ],
  "nextCursor": "NEXT_CURSOR"
}
```

An array of codes matches companies that have any of them. To require every code, use `all`, as in `"naicsCodes": {"all": ["5112", "5182"]}`. Add `naicsCodes` to `expand` to return each company's own codes, for 1 extra credit per company. The later examples on this page reuse the `client` created here.

## Look up the code for an industry

The industries endpoint lists every industry name with its NAICS code prefixes, and it costs no credits. Codes differ between NAICS editions, so take them from this list instead of from memory.

```bash cURL theme={null}
curl https://api.companyenrich.com/v2/industries \
  -H "Authorization: Bearer YOUR_API_TOKEN"
```

```javascript JavaScript theme={null}
const { items } = await client.industries.list();

const matches = items.filter((industry) => industry.name.toLowerCase().includes('software'));

for (const industry of matches) {
  console.log(industry.name, industry.naicsCodes);
}
```

```python Python theme={null}
industries = client.industries.list()

matches = [i for i in industries["items"] if "software" in i["name"].lower()]

for industry in matches:
    print(industry["name"], industry["naicsCodes"])
```

```ruby Ruby theme={null}
industries = client.industries.list

matches = industries["items"].select { |industry| industry["name"].downcase.include?("software") }

matches.each do |industry|
  puts "#{industry['name']} #{industry['naicsCodes'].join(',')}"
end
```

```php PHP theme={null}
$industries = $client->industries->list();

foreach ($industries['items'] as $industry) {
    if (str_contains(strtolower($industry['name']), 'software')) {
        echo $industry['name'], ' ', implode(',', $industry['naicsCodes']), PHP_EOL;
    }
}
```

```bash CLI theme={null}
companyenrich industries software
```

Each item has an industry `name` and the `naicsCodes` to send in the filter. This example is shortened.

```json theme={null}
{
  "items": [
    { "name": "Software Publishers", "naicsCodes": ["5112"] }
  ]
}
```

## Find companies by category and keyword

Categories describe the business model, and keywords describe what the company does. This search returns SaaS companies that match the keyword `fintech` or the keyword `payments`.

```bash cURL theme={null}
curl -X POST https://api.companyenrich.com/v2/companies/search \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": {
      "categories": "saas",
      "keywords": {"in": ["fintech", "payments"]}
    },
    "pageSize": 25
  }'
```

```javascript JavaScript theme={null}
const page = await client.companies.search({
  filter: {
    categories: 'saas',
    keywords: { in: ['fintech', 'payments'] },
  },
  pageSize: 25,
});

for (const company of page.items) {
  console.log(company.name, company.domain, company.categories);
}
```

```python Python theme={null}
page = client.companies.search(
    filter={
        "categories": "saas",
        "keywords": {"in": ["fintech", "payments"]},
    },
    page_size=25,
)

for company in page["items"]:
    print(company.get("name"), company["domain"], company.get("categories"))
```

```ruby Ruby theme={null}
page = client.companies.search(
  filter: {
    categories: "saas",
    keywords: { in: ["fintech", "payments"] }
  },
  page_size: 25
)

page["items"].each do |company|
  puts "#{company['name']} #{company['domain']} #{(company['categories'] || []).join(',')}"
end
```

```php PHP theme={null}
$page = $client->companies->search(
    filter: [
        'categories' => 'saas',
        'keywords' => ['in' => ['fintech', 'payments']],
    ],
    pageSize: 25,
);

foreach ($page['items'] as $company) {
    echo $company['name'] ?? '', ' ', $company['domain'], ' ', implode(',', $company['categories'] ?? []), PHP_EOL;
}
```

```bash CLI theme={null}
companyenrich company search --category saas --any-keyword fintech,payments --limit 25
```

A plain array of keywords requires every keyword, so use `in` when any one of them is enough. Find the keywords CompanyEnrich uses with the free [keyword autocomplete](https://docs.companyenrich.com/api-reference/v2/get-keywords-autocomplete.md), or `companyenrich keywords fint` in the CLI.

## Exclude an industry

Use `notIn` to remove an industry from the results. This filter returns e-commerce companies that are not agencies:

```json theme={null}
{
  "filter": {
    "categories": "e-commerce",
    "keywords": { "notIn": ["agency"] }
  }
}
```

In the CLI, put `exclude-` in front of the flag: `--category e-commerce --exclude-keyword agency`.

## Common questions

### Which industry filter should I use?

Use `naicsCodes` when you work with standard industry codes. Use `categories` for the business model, such as SaaS or e-commerce. Use `keywords` for a niche that has no code of its own, such as fintech. You can combine all three, and a company must match every filter you send.

### Can I filter by industry name?

No. There is no filter for the `industry` name. Look up the NAICS codes for the industry with [`GET /v2/industries`](https://docs.companyenrich.com/api-reference/v2/get-industries) and send them in `naicsCodes`.

### How many companies are in an industry?

Send the same filter to the count endpoint, which is free. See [Count the companies that share a NAICS code](https://docs.companyenrich.com/docs/look-up-company-naics-codes.md#count-the-companies-that-share-a-naics-code).

### How do I get the NAICS codes of one company?

Enrich its domain with the `naicsCodes` expansion. See [Look up a company's NAICS codes](https://docs.companyenrich.com/docs/look-up-company-naics-codes.md).

### How do I find only young companies in an industry?

Add a founding year and a size limit to the industry filter. See [Find startups in an industry](https://docs.companyenrich.com/docs/find-startups-in-an-industry.md).

## Related pages

> [card] [Company Search API filters](https://docs.companyenrich.com/docs/company-search-api-filters.md)
>
> Every filter, with matching rules and accepted values.

> [card] [Look up a company's NAICS codes](https://docs.companyenrich.com/docs/look-up-company-naics-codes.md)
>
> Get the codes for one company or a list.

> [card] [Find startups in an industry](https://docs.companyenrich.com/docs/find-startups-in-an-industry.md)
>
> Narrow an industry to young, small companies.

> [card] [Build a list of companies that match your ICP](https://docs.companyenrich.com/docs/build-an-icp-company-list.md)
>
> Combine industry with size, location, and other criteria.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.