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

# Typeahead Nonprofits

> Search-as-you-type nonprofit suggestions matched by name or EIN

Search-as-you-type nonprofit lookup. Prefix-matches active 501(c)(3) legal names and IRS Business Master File alternate names using a weighted completion suggester, tolerating a single typo. Input that looks like an EIN—with or without dashes—returns that nonprofit directly.

## Authorizations

**X-API-Key** `string` *required*

API key authentication. Required for all endpoints.

## Query Parameters

**q** `string` *required*

What the user typed (2–100 characters): a nonprofit name prefix, or an EIN with or without dashes (e.g. `12-3456789` or `123456789`).

**limit** `integer` (default: 10)

Maximum number of suggestions to return (1–25).

**state** `string`

2-letter state code. Accepted for forward-compatibility but **currently ignored**—results are not state-filtered yet.

## Response

**query** `string` *required*

The query string that was matched, echoed back.

**count** `integer` *required*

Number of suggestions returned.

**results** `object[]` *required*

Ranked nonprofit suggestions, best match first.

**properties**

**ein** `string` *required*

The organization's 9-digit EIN as a string, with leading zeros preserved (e.g. `"030179419"`). Never coerce to an integer.

**name** `string` *required*

Display-ready, title-cased organization name.

**city** `string | null`

Organization city, when available.

**state** `string | null`

2-letter state code, when available.

**score** `number` *required*

Completion-suggester ranking weight, exposed for ranking and debugging only—don't surface it to end users.

Requests that fail validation (e.g. `q` shorter than 2 characters, `limit` outside 1–25) return a `422` validation error.

```bash cURL theme={null}
curl --request GET \
  --url 'https://api.givingcompass.org/insights/typeahead/nonprofits?q=red%20cro&limit=5' \
  --header 'X-API-Key: <api-key>'
```

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

response = requests.get(
    "https://api.givingcompass.org/insights/typeahead/nonprofits",
    params={"q": "red cro", "limit": 5},
    headers={"X-API-Key": "<api-key>"},
)
print(response.json())
```

```javascript JavaScript theme={null}
const response = await fetch(
  "https://api.givingcompass.org/insights/typeahead/nonprofits?" +
    new URLSearchParams({ q: "red cro", limit: "5" }),
  { headers: { "X-API-Key": "<api-key>" } }
);
const data = await response.json();
```

```json 200 theme={null}
{
  "query": "red cro",
  "count": 2,
  "results": [
    {
      "ein": "530196605",
      "name": "American National Red Cross",
      "city": "Washington",
      "state": "DC",
      "score": 42.0
    },
    {
      "ein": "030179419",
      "name": "Red Crow Foundation",
      "city": "Burlington",
      "state": "VT",
      "score": 18.5
    }
  ]
}
```

```json 422 theme={null}
{
  "detail": [
    {
      "loc": ["query", "q"],
      "msg": "String should have at least 2 characters",
      "type": "string_too_short"
    }
  ]
}
```


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