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

# Typeahead

> Unified autocomplete endpoint for all search filter values

## Overview

A single endpoint that powers autocomplete for every kind of value used in the
people and company search filters — companies, industries, categories,
locations, schools, job titles, skills, investors, and more.

Pass `type=<category>` to control what is searched. Results come back ordered
by popularity, with prefix matches promoted to the top.

***

## Query Parameters

<ParamField query="type" type="string" required>
  The category to autocomplete. One of:

  * `company` — company names (returns `org_id`, name, logo)
  * `people_industry` — industries on profiles (capitalized, e.g. "Computer Software")
  * `company_industry` — industries on companies (lowercase, e.g. "software development")
  * `category` — business categories (lowercase, e.g. "software", "fintech")
  * `location` — full location strings on profiles (e.g. "San Francisco Bay Area")
  * `city` — cities on companies
  * `region` — regions/states on companies
  * `school` — schools and universities from education history
  * `title` — job titles
  * `skill` — profile skills
  * `investor` — investor names from company funding rounds
</ParamField>

<ParamField query="q" type="string" required>
  Search query. Must be 1-100 characters.
</ParamField>

<ParamField query="limit" type="integer" default="20">
  Max results, between 1 and 20.
</ParamField>

***

## Pricing

Each returned result costs **0.01 credit**, i.e. 0.1 credit per 10 results.
Requests that return zero results are free. The amount debited for the call is
returned in the response as `credits_used`.

<Note>
  Typeahead can be made **free** for your account on a per-company basis. Reach
  out to [dev@dataforb2b.ai](mailto:dev@dataforb2b.ai) if you want it enabled
  for your organization.
</Note>

***

## Response

<ResponseField name="type" type="string">
  Echoes back the `type` parameter.
</ResponseField>

<ResponseField name="count" type="integer">
  Number of results returned.
</ResponseField>

<ResponseField name="credits_used" type="float">
  Credits debited for this request (`count` × 0.01).
</ResponseField>

<ResponseField name="results" type="array">
  Matching values, ordered with prefix matches first.

  <Expandable title="result item properties">
    <ResponseField name="value" type="string">
      The canonical value to use directly as a filter input on `/search/people`
      or `/search/companies`.
    </ResponseField>

    <ResponseField name="popularity" type="string | null">
      Relative popularity bucket: `<1k`, `1k-10k`, `10k-100k`, or `100k+`.
      Null for `type=company`.
    </ResponseField>

    <ResponseField name="metadata" type="object | null">
      Extra fields for some types. Currently only populated for `type=company`:

      * `org_id` — encoded company id (`org_xxx`)
      * `logo_url` — company logo URL (may be null)
    </ResponseField>
  </Expandable>
</ResponseField>

***

<RequestExample>
  ```bash cURL theme={null}
  curl -G "https://api.dataforb2b.ai/typeahead" \
    -H "api_key: YOUR_API_KEY" \
    --data-urlencode "type=skill" \
    --data-urlencode "q=python" \
    --data-urlencode "limit=5"
  ```

  ```python Python theme={null}
  import requests

  resp = requests.get(
      "https://api.dataforb2b.ai/typeahead",
      headers={"api_key": "YOUR_API_KEY"},
      params={"type": "skill", "q": "python", "limit": 5},
  )
  print(resp.json())
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({ type: "skill", q: "python", limit: 5 });
  const resp = await fetch(`https://api.dataforb2b.ai/typeahead?${params}`, {
    headers: { api_key: "YOUR_API_KEY" },
  });
  console.log(await resp.json());
  ```
</RequestExample>

<ResponseExample>
  ```json type=company theme={null}
  {
    "type": "company",
    "count": 2,
    "credits_used": 0.02,
    "results": [
      {
        "value": "Stripe",
        "popularity": null,
        "metadata": {
          "org_id": "org_0lox54iG5IEZSb71mZWLR8z9CVPs8v1Lj8oQ",
          "logo_url": "https://media.licdn.com/dms/image/..."
        }
      },
      {
        "value": "Recko | A Stripe company",
        "popularity": null,
        "metadata": {
          "org_id": "org_0lox54iG5IEZSb71mZWLR8z9CVKfPiCAFeQc",
          "logo_url": null
        }
      }
    ]
  }
  ```

  ```json type=skill theme={null}
  {
    "type": "skill",
    "count": 3,
    "credits_used": 0.03,
    "results": [
      { "value": "Python",                        "popularity": "100k+",   "metadata": null },
      { "value": "Python (Programming Language)", "popularity": "100k+",   "metadata": null },
      { "value": "Python Scripting",              "popularity": "1k-10k",  "metadata": null }
    ]
  }
  ```

  ```json type=city theme={null}
  {
    "type": "city",
    "count": 3,
    "credits_used": 0.03,
    "results": [
      { "value": "London",                "popularity": "100k+",   "metadata": null },
      { "value": "Londonderry",           "popularity": "<1k",     "metadata": null },
      { "value": "London, United Kingdom","popularity": "<1k",     "metadata": null }
    ]
  }
  ```

  ```json type=people_industry theme={null}
  {
    "type": "people_industry",
    "count": 1,
    "credits_used": 0.01,
    "results": [
      { "value": "Computer Software", "popularity": "100k+", "metadata": null }
    ]
  }
  ```

  ```json type=investor theme={null}
  {
    "type": "investor",
    "count": 2,
    "credits_used": 0.02,
    "results": [
      { "value": "y combinator",                "popularity": "1k-10k", "metadata": null },
      { "value": "y combinator continuity fund","popularity": "<1k",    "metadata": null }
    ]
  }
  ```
</ResponseExample>
