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

# Retrieve NAICS industry codes

> Return 2022 NAICS codes from a domain or company name and decide how to use confidence in your workflow.

Use `GET /web/naics` when your system requires 2022 North American Industry Classification System codes. The endpoint accepts a domain or company title and returns one or more code candidates.

## Classify a company

```bash theme={null}
export CONTEXT_DEV_API_KEY="ctxt_secret_..."
```

<CodeGroup>
  ```bash cURL theme={null}
  curl --get https://api.context.dev/v1/web/naics \
    --header "Authorization: Bearer $CONTEXT_DEV_API_KEY" \
    --data-urlencode "input=stripe.com" \
    --data-urlencode "minResults=1" \
    --data-urlencode "maxResults=3"
  ```

  ```typescript TypeScript theme={null}
  import ContextDev from "context.dev";

  const client = new ContextDev({
    apiKey: process.env.CONTEXT_DEV_API_KEY,
  });

  const result = await client.industry.retrieveNaics({
    input: "stripe.com",
    minResults: 1,
    maxResults: 3,
  });

  console.log(result.domain, result.codes);
  ```

  ```python Python theme={null}
  import os
  from context.dev import ContextDev

  client = ContextDev(api_key=os.environ["CONTEXT_DEV_API_KEY"])

  result = client.industry.retrieve_naics(
      input="stripe.com",
      min_results=1,
      max_results=3,
  )

  print(result.domain, result.codes)
  ```

  ```ruby Ruby theme={null}
  require "cgi/core"
  require "context_dev"

  client = ContextDev::Client.new(
    api_key: ENV.fetch("CONTEXT_DEV_API_KEY")
  )

  response = client.industry.retrieve_naics(
    input: "stripe.com",
    min_results: 1,
    max_results: 3
  )

  puts response.domain
  puts response.codes.inspect
  ```

  ```go Go theme={null}
  package main

  import (
      "context"
      "fmt"
      "os"

      contextdev "github.com/context-dot-dev/context-go-sdk/v2"
      "github.com/context-dot-dev/context-go-sdk/v2/option"
  )

  func main() {
      client := contextdev.NewClient(
          option.WithAPIKey(os.Getenv("CONTEXT_DEV_API_KEY")),
      )

      response, err := client.Industry.GetNaics(
          context.Background(),
          contextdev.IndustryGetNaicsParams{
              Input: "stripe.com",
              MinResults: contextdev.Int(1),
              MaxResults: contextdev.Int(3),
          },
      )
      if err != nil {
          panic(err)
      }

      fmt.Println(response.Domain, response.Codes)
  }
  ```

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

  require __DIR__.'/vendor/autoload.php';

  use ContextDev\Client;

  $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY'));

  $response = $client->industry->retrieveNaics(
      input: 'stripe.com',
      minResults: 1,
      maxResults: 3,
  );

  var_dump($response->domain, $response->codes);
  ```
</CodeGroup>

The endpoint costs 10 credits.

## Read the candidates

```json theme={null}
{
  "status": "ok",
  "domain": "stripe.com",
  "type": "naics",
  "codes": [
    {
      "code": "522320",
      "name": "Financial Transactions Processing, Reserve, and Clearinghouse Activities",
      "confidence": "high"
    }
  ]
}
```

Keep `code` as a string. Store `name`, `confidence`, and the resolved `domain` with it so a future reviewer can understand what was classified.

## Control result count

| Parameter    | Contract                                                                                                                      |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `input`      | Required domain or company title, at least 4 characters. A valid domain is used directly; other input is resolved as a title. |
| `minResults` | Minimum result count, 1 to 10; defaults to 1.                                                                                 |
| `maxResults` | Maximum result count, 1 to 10; defaults to 5.                                                                                 |
| `timeoutMS`  | Hard request timeout, up to five minutes.                                                                                     |

Result count is not a confidence threshold. If your workflow should accept only strong matches, filter the returned candidates by `confidence` and allow an empty result after filtering.

## Production behavior

* Prefer a domain over a company name when both are available.
* Do not treat a model-selected code as proof of an official registration.
* Keep the taxonomy version in your data model if records must remain auditable over time.
* Treat `404` as a normal no-match and `408` or `429` as retryable with a bounded policy.

The API returns code candidates, not a copy of the full taxonomy.

## Next steps

<CardGroup cols={2}>
  <Card title="NAICS API reference" icon="code" href="/api-reference/web-extraction/naics">
    Review the complete classification request and response contract.
  </Card>

  <Card title="U.S. Census NAICS reference" icon="book-open" href="https://www.census.gov/naics/">
    Read authoritative taxonomy definitions and download classification files.
  </Card>
</CardGroup>
