Skip to content

Search Ahead API V5 beta ​

GET Prediction ​

This endpoint returns a list of suggestions, or predictions, based on two or more characters provided with the request. V5 supports international search capabilities.

Resource URL ​

https://mapquestapi.com/search/v5/prediction

Resource Information ​

Response FormatsJSON
AuthenticationYes (Requires Key)
Rate LimitedYes

Request Parameters ​

Request ParameterDescriptionRequired
keyThe API Key, which is needed to make requests to MapQuest services.yes
qA query phrase. The phrase can be incomplete, in which case its last term is treated as a prefix during matching. Address queries must begin with a street number.

Minimum Length: 2 characters.

Maximum Length: 100 characters.
yes
limitThe maximum number of results to return. Must lie in the range [1, 15].no, default is 10
locationThe geographic context used for searching, ranking, and ordering results. Supports a point defining the geographic "center" of the query. Must consist of two comma-separated floating-point values: the longitude, latitude; the first coordinate must lie in the range [-180, 180], and the second must lie in the range [-90, 90]. While this parameter is not required, it is highly recommended that it be provided in order to improve relevance of results.no
countryCodeThe countries to search over. Can contain any valid ISO 3166-1 Alpha-2 country codes. If provided, the search will only return results in the specified countries. Accepts multiple instances of the parameter and or a comma-delimited list.no
languageCodeThe language code for the response. Supports ISO 639-1 language codes.no, default is en

The GeoJSON specification is described here: https://geojson.org/

Response Object ​

requestA JSON object containing the parameters and values passed in with the request.

Results Object ​

displayStringA string that contains a summary of the result that is returned. Depending on the type of result returned, the displayString could include a name, street, city, state, and postal code.
nameA string that contains the name of the result that is returned without additional summary information included.
recordTypeA string that contains information about the type of result that is returned. Possible values are: address, airport, poi, postalCode, neighborhood, city, county, state, country, category, franchise.
idA string that includes the a MapQuest-specific unique identifier. Results from all collections include an ID.
languageA string that contains the ISO 639-1 language code of the result that is returned. Possible values include: en.

Place Object ​

typeA string that describes the type of GeoJSON object associated with the result that is returned. Possible values are: Feature.

Geometry Object ​

coordinatesA array of numbers that contains the longitude and latitude that describes the geographic location of the result that is returned.

Note: poi results contain a longitude and latitude pair intended to be used for display purposes only.
typeA string that represents the type of GeoJSON feature for the result that is returned. Possible values are: Point.

Properties Object ​

typeThe type of address entity relevant to this location. Possible values are: address, neighborhood, postalCode, city, county, state, country.
streetA string that contains the street address of this location, if applicable to the result returned.
cityA string that contains the enclosing city of this location, if applicable to the result returned.
stateA string that contains the enclosing state or province of this location, if applicable to the result returned.
stateCodeA string that contains the enclosing two-character state code of this location, if applicable to the result returned.
countyA string that contains the enclosing county of this location, if applicable to the result returned.
countryA string that contains the enclosing country of this location, if applicable to the result returned.
countryCodeA string that contains the enclosing ISO 3166-1 Alpha-2 country code of this location, if applicable to the result returned.
postalCodeA string that contains the coarsest enclosing postal code, if applicable to the result returned.

Example Request ​

GET https://mapquestapi.com/search/v5/prediction?key=KEY&limit=7&q=San Francisco&location=-96.73431873321533,33.12551193423172&languageCode=en

cURL Request ​

curl -X GET -H "Accept: application/json" "https://mapquestapi.com/search/v5/prediction?key=KEY&limit=7&q=San Francisco&location=-96.73431873321533,33.12551193423172&languageCode=en"

Example Response ​

JSON
{
  "request": {
    "q": "San Francisco",
    "limit": 7,
    "languageCode": "en",
    "location": {
      "long": "-96.73431873321533",
      "lat": "33.12551193423172"
    }
  },
  "results": [
    {
      "id": "Y206bmFtZWRwbGFjZToyMTAxMDIzMw==",
      "displayString": "San Francisco, CA, United States",
      "name": "San Francisco, CA, United States",
      "language": "en",
      "recordType": "city",
      "place": {
        "type": "Feature",
        "geometry": {
          "coordinates": [
            -122.41966,
            37.77712
          ],
          "type": "Point"
        },
        "properties": {
          "city": "San Francisco",
          "state": "California",
          "stateCode": "CA",
          "postalCode": "94102",
          "county": "San Francisco",
          "country": "United States",
          "countryCode": "USA",
          "type": "address"
        }
      }
    }
  ]
}