Typeahead
The typeahead endpoint powers location autocomplete inputs. Given a partial search string, it returns a list of matching cities, ZIP codes, neighborhoods, and specific addresses.
Endpoint
GET /api/v1/typeahead
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
q | string | Yes | Search string. Minimum 2 characters required. |
limit | integer | No | Maximum suggestions. Default 5, maximum 10. |
Response shape
The data field contains an array of suggestion objects:
{ "data": [
{ "id": "...", "label": "La Jolla, CA", "type": "city", "city": "La Jolla", "state": "CA" },
{ "id": "...", "label": "92037", "type": "zip", "zip": "92037" }
] }| Field | Type | Description |
|---|---|---|
label | string | Primary display text for the suggestion |
id | string | Stable suggestion identifier |
type | string | city, zip, neighborhood, address, or county |
city, state, zip | string | Optional normalized location fields |
Example request
Typeahead
curl -H "Authorization: Bearer eai_YOUR_KEY" \ -H "X-EAI-Site-ID: site_YOUR_SITE_ID" \ "https://app.easyagentidx.com/api/v1/typeahead?q=La+Jolla"
→ 200 OK { "data": [...suggestions] }
Usage guidance
Debounce calls to this endpoint by at least 300ms to avoid excessive requests while the user is typing. Cache responses for identical query strings within a session to reduce API usage.