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

# Company Autocomplete examples

> Autocomplete examples: company names, most common values, filtered suggestions, and the Autocomplete → Search workflow.

This page collects examples for [Company Autocomplete](/company-docs/autocomplete/introduction).
Each example is a full working request you can copy, paste, and adapt.

For the core walkthrough (first request, response shape, request fields), see
[Company Autocomplete](/company-docs/autocomplete/introduction). For supported fields,
operators, and errors, see
[Autocomplete reference](/company-docs/autocomplete/reference).

<Note>
  Replace `YOUR_API_KEY` in each example with your actual API key. All
  requests require the `x-api-version: 2025-11-01` header.
</Note>

***

## Autocomplete company names

Use `basic_info.name` to surface company names matching a partial string.

<CodeGroup>
  ```bash Request theme={"theme":"vitesse-black"}
  curl --request POST \
  	--url https://api.crustdata.com/company/search/autocomplete \
  	--header 'authorization: Bearer YOUR_API_KEY' \
  	--header 'content-type: application/json' \
  	--header 'x-api-version: 2025-11-01' \
  	--data '{
  		"field": "basic_info.name",
  		"query": "hub",
  		"limit": 5
  	}'
  ```

  ```json Response theme={"theme":"vitesse-black"}
  {
      "suggestions": [
          { "value": "HubSpot" },
          { "value": "HUB International" },
          { "value": "HubSpot Academy" },
          { "value": "Hublot" },
          { "value": "Hubbell Incorporated" }
      ]
  }
  ```
</CodeGroup>

***

## Get the most common values for a field

Use an empty string for `query` when you want the most frequent values
instead of a text match. This is useful when you are exploring a field for
the first time.

<CodeGroup>
  ```bash Request theme={"theme":"vitesse-black"}
  curl --request POST \
  	--url https://api.crustdata.com/company/search/autocomplete \
  	--header 'authorization: Bearer YOUR_API_KEY' \
  	--header 'content-type: application/json' \
  	--header 'x-api-version: 2025-11-01' \
  	--data '{
  		"field": "locations.country",
  		"query": "",
  		"limit": 10
  	}'
  ```

  ```json Response theme={"theme":"vitesse-black"}
  {
      "suggestions": [
          { "value": "United States of America" },
          { "value": "France" },
          { "value": "Germany" },
          { "value": "United Kingdom" },
          { "value": "Italy" },
          { "value": "Australia" },
          { "value": "United States" },
          { "value": "India" },
          { "value": "Spain" },
          { "value": "Brazil" }
      ]
  }
  ```
</CodeGroup>

Suggestions are ranked by frequency, so you can quickly see the most common
values in the dataset.

***

## Narrow suggestions with filters

Autocomplete can scope results to a subset of companies. The `filters` field
accepts either:

* a single condition with `field`, `type`, and `value`
* a logical group with `op` and `conditions`

This example returns industry suggestions only for US-based companies.

<CodeGroup>
  ```bash Request theme={"theme":"vitesse-black"}
  curl --request POST \
  	--url https://api.crustdata.com/company/search/autocomplete \
  	--header 'authorization: Bearer YOUR_API_KEY' \
  	--header 'content-type: application/json' \
  	--header 'x-api-version: 2025-11-01' \
  	--data '{
  		"field": "basic_info.industries",
  		"query": "",
  		"limit": 5,
  		"filters": {
  			"field": "locations.country",
  			"type": "=",
  			"value": "USA"
  		}
  	}'
  ```

  ```json Response theme={"theme":"vitesse-black"}
  {
      "suggestions": [
          { "value": "Professional Services" },
          { "value": "" },
          { "value": "Manufacturing" },
          { "value": "Technology, Information and Media" },
          { "value": "Hospitals and Health Care" }
      ]
  }
  ```
</CodeGroup>

<Tip>
  Use indexed values in `filters`. Run autocomplete on a field first if you
  are not sure of the exact value the dataset uses.
</Tip>

You can also use nested `and`/`or` groups. Filter values can be strings,
numbers, or booleans, and array values can contain strings or numbers — pass
numeric values as numbers rather than strings where the underlying field is
numeric.

```bash theme={"theme":"vitesse-black"}
curl --request POST \
  --url https://api.crustdata.com/company/search/autocomplete \
  --header 'authorization: Bearer YOUR_API_KEY' \
  --header 'content-type: application/json' \
  --header 'x-api-version: 2025-11-01' \
  --data '{
    "field": "taxonomy.professional_network_industry",
    "query": "",
    "limit": 5,
    "filters": {
      "op": "and",
      "conditions": [
        { "field": "locations.country", "type": "=", "value": "USA" },
        { "field": "headcount.latest_count", "type": ">", "value": 100 }
      ]
    }
  }'
```

For the full list of supported operators, see
[Autocomplete reference](/company-docs/autocomplete/reference#supported-filter-operators).

***

## Full workflow: Autocomplete → Search → Enrich

This is the canonical end-to-end Company API workflow. You do not know the
exact industry value the Search API expects. Autocomplete discovers it,
Search finds matching companies, and Enrich fills in the details.

### Step 1: Discover valid industry values

<CodeGroup>
  ```bash Request theme={"theme":"vitesse-black"}
  curl --request POST \
    --url https://api.crustdata.com/company/search/autocomplete \
    --header 'authorization: Bearer YOUR_API_KEY' \
    --header 'content-type: application/json' \
    --header 'x-api-version: 2025-11-01' \
    --data '{"field": "basic_info.industries", "query": "software", "limit": 3}'
  ```

  ```json Response theme={"theme":"vitesse-black"}
  {
      "suggestions": [
          { "value": "Software Development" },
          { "value": "IT System Custom Software Development" },
          { "value": "Mobile Computing Software Products" }
      ]
  }
  ```
</CodeGroup>

**Extract:** Take `suggestions[0].value` → `"Software Development"`. Use this
exact string in your Search filter.

**If empty:** If `suggestions` is `[]`, your query did not match any indexed
values. Try a broader term (for example, `"tech"` instead of
`"software engineering"`).

### Step 2: Search for matching companies

<CodeGroup>
  ```bash Request theme={"theme":"vitesse-black"}
  curl --request POST \
    --url https://api.crustdata.com/company/search \
    --header 'authorization: Bearer YOUR_API_KEY' \
    --header 'content-type: application/json' \
    --header 'x-api-version: 2025-11-01' \
    --data '{
      "filters": {
        "op": "and",
        "conditions": [
          {"field": "basic_info.industries", "type": "in", "value": ["Software Development"]},
          {"field": "locations.country", "type": "=", "value": "USA"}
        ]
      },
      "sorts": [{"field": "headcount.total", "order": "desc"}],
      "limit": 3,
      "fields": ["crustdata_company_id", "basic_info.name", "basic_info.primary_domain", "headcount.total"]
    }'
  ```

  ```json Response theme={"theme":"vitesse-black"}
  {
      "companies": [
          {
              "crustdata_company_id": 12345,
              "basic_info": { "name": "Acme Corp", "primary_domain": "acme.com" },
              "headcount": { "total": 8500 }
          },
          {
              "crustdata_company_id": 67890,
              "basic_info": { "name": "Retool", "primary_domain": "retool.com" },
              "headcount": { "total": 450 }
          },
          {
              "crustdata_company_id": 628895,
              "basic_info": {
                  "name": "Serve Robotics",
                  "primary_domain": "serverobotics.com"
              },
              "headcount": { "total": 120 }
          }
      ],
      "next_cursor": "H4sIAJj5zGkC...",
      "total_count": 217318
  }
  ```
</CodeGroup>

**Extract:** Take `companies[].crustdata_company_id` values →
`[12345, 67890, 628895]`. Pass these to Enrich.

**If empty:** If `companies` is `[]`, no companies matched your filters.
Broaden your conditions or re-run autocomplete to verify filter values.

**To get more results:** Pass `next_cursor` as `cursor` in the next request.
Stop paginating when `next_cursor` is `null`. See
[Pagination & sorting](/company-docs/search/reference#paginate-through-results).

### Step 3: Enrich the top matches

<CodeGroup>
  ```bash Request theme={"theme":"vitesse-black"}
  curl --request POST \
    --url https://api.crustdata.com/company/enrich \
    --header 'authorization: Bearer YOUR_API_KEY' \
    --header 'content-type: application/json' \
    --header 'x-api-version: 2025-11-01' \
    --data '{
      "crustdata_company_ids": [12345, 67890, 628895],
      "fields": ["basic_info", "headcount", "funding", "hiring"]
    }'
  ```

  ```json Response theme={"theme":"vitesse-black"}
  [
      {
          "matched_on": "12345",
          "match_type": "crustdata_company_id",
          "matches": [
              {
                  "confidence_score": 1.0,
                  "company_data": {
                      "basic_info": {
                          "name": "Acme Corp",
                          "primary_domain": "acme.com",
                          "company_type": "Privately Held",
                          "year_founded": 2015,
                          "industries": ["Software Development"]
                      },
                      "headcount": { "total": 8500 },
                      "funding": {
                          "total_investment_usd": 250000000,
                          "last_round_type": "series_d"
                      },
                      "hiring": { "openings_count": 42 }
                  }
              }
          ]
      }
  ]
  ```
</CodeGroup>

**Extract:** Each item in the top-level array corresponds to one input ID.
Access the profile via `response[i].matches[0].company_data`.

**If a match is empty:** If `matches` is `[]` for an identifier, that company
was not found. The request still succeeds (`200 OK`) for the other
identifiers. See
[Partial batch failure](/company-docs/enrichment/reference#partial-batch-failure).

***

## Next steps

* [Autocomplete reference](/company-docs/autocomplete/reference) — supported fields, operators, errors, API summary.
* [Company Search](/company-docs/search/introduction) — use the discovered value in a structured company search.
* [Company Enrich](/company-docs/enrichment/introduction) — enrich a company after you find it.
