# GET /v1/autocomplete Suggestions for a search box: places, ZIP codes, addresses and MLS numbers. | Access | | | --- | --- | | Keys | publishable or secret | | Plan | every plan | | Environment | live and sandbox | | Acts for | the account | | While the account is suspended | refused | | During a data stop | refused when it asks for listing content | ## Query | Name | Type | Description | | --- | --- | --- | | `q` | string | **Required.** What the visitor typed: 2 to 100 characters. Matching is by prefix and ignores case; % and _ are ordinary characters. | | `types` | string | The groups you want, separated by commas: places, schoolDistricts, postalCodes, addresses, mlsNumbers. Left out: every group the key's plan has (schoolDistricts is Premium). Asking for addresses or mlsNumbers makes the request listing content, which the 12-hour stop refuses. | | `near` | string | A point as "lng,lat": each group is ordered by distance from it. | ## Answers ### 200: The suggestions, at most ten a group. Only the groups that were asked for are present The answer is `{ data, meta }`; `meta` holds `requestId` and `environment`. `data`: | Field | Type | Description | | --- | --- | --- | | `places` | list of object | (not always present) Towns, counties, townships, communities and subdivisions by name. Search one with location.placeIds. | | `places[].placeId` | string | | | `places[].kind` | `state`, `county`, `city`, `municipality`, `cdp`, `community`, `zcta`, `postal_city`, `subdivision`, `school_district` | | | `places[].displayName` | string | Show it as it is: it tells look-alikes apart. | | `places[].state` | string or null | | | `places[].center` | object or null | | | `places[].center.lat` | number | | | `places[].center.lng` | number | | | `schoolDistricts` | list of object | (not always present) Premium only. School districts by name. Search one with location.placeIds. | | `schoolDistricts[].placeId` | string | | | `schoolDistricts[].displayName` | string | | | `schoolDistricts[].districtType` | string or null | unified, elementary or secondary. | | `schoolDistricts[].grades` | string or null | Such as "KG-12". | | `postalCodes` | list of object | (not always present) ZIP code areas by prefix. | | `postalCodes[].postalCode` | string | | | `postalCodes[].state` | string or null | | | `postalCodes[].placeId` | string | | | `postalCodes[].displayName` | string | | | `addresses` | list of object | (not always present) Listings by their address, on-market ones first. A listing whose address is withheld never matches here. | | `addresses[].listingKey` | string | | | `addresses[].mlsNumber` | string or null | | | `addresses[].status` | `active`, `active_under_contract`, `coming_soon`, `pending`, `closed` | | | `addresses[].address` | object | | | `addresses[].address.line1` | string or null | | | `addresses[].address.unit` | string or null | | | `addresses[].address.city` | string or null | | | `addresses[].address.state` | string or null | | | `addresses[].address.postalCode` | string or null | | | `mlsNumbers` | list of object | (not always present) Listings by a current or past MLS number. | | `mlsNumbers[].listingKey` | string | | | `mlsNumbers[].mlsNumber` | string | The number that matched: the current one, or a past one. | | `mlsNumbers[].current` | boolean | True when the number is the listing's current one. | | `mlsNumbers[].status` | `active`, `active_under_contract`, `coming_soon`, `pending`, `closed` | | | `mlsNumbers[].address` | object or null | Null when the address is withheld. | | `mlsNumbers[].address.line1` | string or null | | | `mlsNumbers[].address.city` | string or null | | | `mlsNumbers[].address.state` | string or null | | | `mlsNumbers[].address.postalCode` | string or null | | | `mlsNumbers[].addressDisplay` | `full`, `withheld` | | ## Errors | Status | Codes | | --- | --- | | 400 | [`client_id_must_be_opaque`](../../errors/client_id_must_be_opaque.md), [`validation_failed`](../../errors/validation_failed.md) | | 401 | [`client_token_account_mismatch`](../../errors/client_token_account_mismatch.md), [`client_token_expired`](../../errors/client_token_expired.md), [`client_token_invalid`](../../errors/client_token_invalid.md), [`invalid_api_key`](../../errors/invalid_api_key.md), [`key_revoked`](../../errors/key_revoked.md), [`missing_api_key`](../../errors/missing_api_key.md) | | 403 | [`account_pending`](../../errors/account_pending.md), [`account_suspended`](../../errors/account_suspended.md), [`origin_not_allowed`](../../errors/origin_not_allowed.md), [`secret_key_in_browser`](../../errors/secret_key_in_browser.md), [`tier_insufficient`](../../errors/tier_insufficient.md) | | 429 | [`rate_limited`](../../errors/rate_limited.md) | | 500 | [`data_stale`](../../errors/data_stale.md), [`internal_error`](../../errors/internal_error.md), [`temporarily_unavailable`](../../errors/temporarily_unavailable.md) | Every error has the same body, and says how to fix it ([responses and errors](../../concepts/responses-and-errors.md)). ## More Suggestions for a search box, from two characters: `?q=ardm` plus an optional `types` list and an optional `near=lng,lat` that orders each group by distance from that point. ```json { "data": { "places": [ { "placeId": "pl_…", "kind": "community", "displayName": "Ardmore Park, PA", "state": "PA", "center": { "lat": 40.01, "lng": -75.3 } } ], "schoolDistricts": [ { "placeId": "pl_…", "displayName": "Lower Merion School District, PA", "districtType": "unified", "grades": "KG-12" } ], "postalCodes": [ { "postalCode": "19003", "state": "PA", "placeId": "pl_…", "displayName": "19003 (Ardmore, PA)" } ], "addresses": [ { "listingKey": "…", "mlsNumber": "…", "status": "active", "address": { "line1": "101 MAIN ST", "unit": null, "city": "Ardmore", "state": "PA", "postalCode": "19003" } } ], "mlsNumbers": [ { "listingKey": "…", "mlsNumber": "PAMC2141234", "current": true, "status": "active", "address": { "…": "…" }, "addressDisplay": "full" } ] }, "meta": { "requestId": "req_…", "environment": "live" } } ``` | Group | What it searches | | ------------- | ---------------------------------------------------------------------------------------------------- | | `places` | live places by name (cities, counties, townships, communities, subdivisions); never a retired place, never a school district (those are `schoolDistricts`); ZIP areas are in `postalCodes` | | `schoolDistricts` | **Premium only.** School districts by name. `districtType` is `unified`, `elementary` or `secondary`; `grades` is the lowest and highest grade served, such as `KG-12` or `09-12` (`PK`, `KG`, `01` to `12`), or null. Search a district with its `placeId` in `location.placeIds` | | `postalCodes` | ZIP code areas by prefix (digits only) | | `addresses` | listing addresses only, and only shown ones: a listing whose address is withheld never matches an address. On-market listings first, then closed | | `mlsNumbers` | current and past MLS numbers (letters, digits and hyphens). A withheld listing may match here and is shown with `address: null` and `addressDisplay: "withheld"` | Each group returns at most ten items. `types` names the groups wanted; an unknown group is `400 validation_failed`. With `types` left out a Premium key gets all five groups and a Basic key the other four. A Basic key that asks for `schoolDistricts` in `types` gets `403 tier_insufficient` with `capability: "schools"`. Matching is case-insensitive and by prefix of what was typed (a place also matches when its display name contains the text), and the typed text is taken literally: `%` and `_` are characters, not wildcards. **The 12-hour stop.** `addresses` and `mlsNumbers` are listing content, so a request that asks for them (or leaves `types` out) is `500 data_stale` as a whole while the stop is on. `places`, `schoolDistricts` and `postalCodes`, alone or together, keep working during the stop. _This page is made from the route's own declaration by `npm run openapi`. To change it, change the declaration or its explanation, never this file._