Sorry, you need to enable JavaScript to visit this website.

Routed Search


The routed search endpoint allows you to perform a free form search from any location with a given heading, results will contain information regarding the drive distance and drive time.

Request

Format

GET https://<baseURL>/search/<versionNumber>/routedSearch/<query>/<position>/<heading>.<ext>?key=<apiKey>[&typeahead=<typeahead>][&limit=<limit>][&multiplier=<multiplier>][&routingTimeout=<routingTimeout>][&language=<language>][&idxSet=<idxSet>][&extendedPostalCodesFor=<extendedPostalCodesFor>]

Parameters

The table below describes the parameters that can be used in a request. Required parameters must be used or the call will fail. Optional parameters, which are highlighted with [square brackets], may be used. If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table. The order of request parameters is not important.

Parameter Description Req'd? Type / Values Default value Max value
baseURL Base URL for calling the API.  Yes api.tomtom.com
versionNumber Service version number. The current value is 2. Yes 2
query
 
Query string. Must be properly URL encoded. Yes String
position
 
Lat./lon. Yes Position
heading
 
A person or vehicle is facing, usually similar to its course. Degrees measured clockwise from north. Yes Decimal
ext
 
Valid response formats are JSON, JSONP, JS or XML. Yes String
key
 
Your TomTom API key. Yes String
[typeahead]
 
If the "typeahead" flag is set, the query will be interpreted as a partial input and the search will enter predictive mode. No Boolean false
[limit]
 
Maximum number of responses that will be returned. No Integer 10 100
[multiplier]
 
Multiplies the limit by N to gather more candidate POIs, which will then be sorted by drive distance, returning only the top candidates according to the limit. No Integer 2
[routingTimeout]
 
Only return results that return from routing engine within this limit. No Integer (milliseconds) 4000
[language] Language in which search results should be returned. Should be one of supported IETF language tags, case insensitive. When data in specified language is not available for a specific field, default langauge is used. No String
[extendedPostalCodesFor] Indexes for which extended postal codes should be included in the results. Available indexes are:

  • Addr = Address ranges
  • Geo = Geographies
  • PAD = Point Addresses
  • POI = Points of Interest
  • Str = Streets
  • XStr = Cross Streets (intersections)

Value should be a comma separated list of index types (in any order) or "None" for no indexes.
By default extended postal codes are included for all indexes except Geo. Extended postal code lists for geographies can be quite long so they have to be explicitly requested when needed.

Usage examples:

  • extendedPostalCodesFor=POI
  • extendedPostalCodesFor=PAD,Addr,Geo
  • extendedPostalCodesFor=None

Extended postal code is returned as an 'extendedPostalCode' property of an address. Availability is region-dependent.

No String
[idxSet]
 
The "idxSet" parameter allows for fine tuning Search API by specifying which indexes to utilize for the search. The pre defined indexes are:

  • Addr = Address range interpolation (when there is no PAD)
  • Geo = Geographies
  • PAD = Point Addresses
  • POI = Points of interest
  • Str = Streets
  • Xstr = Cross Streets (intersections)

Usage examples:

  • idxSet=POI (search Points Of Interest only)
  • idxSet=PAD,Addr (search addresses only)
No String

Response

Format

For illustrative purposes the example below is neatly indented and includes all possible response fields. Actual responses are more compact and the fields present will vary based on the result type and the data available. See the response field documentation below for more information.

When requesting JSON output the response has the following structure:

    {
        "summary": {
            "query": "pizza",
            "queryType": "NON_NEAR",
            "queryTime": 1498,
            "numResults": 10,
            "offset": 0,
            "totalResults": 265482,
            "fuzzyLevel": 1,
            "geoBias": {
                "lat": 36.98844,
                "lon": -121.97483
            }
        },
        "results": []
    }
    

Each element of the results array is in the format:

    {
        "type": "POI",
        "id": "US/POI/p0/9033556",
        "score": 5,
        "dist": 0,
        "info": "search:ta:840061001865142-US",
        "entityType": "Municipality",
        "poi": {
            "name": "Upper Crust Pizza & Pasta",
            "phone": "+(1)-(831)-4762333",
            "url": "www.uppercrustsc.com/",
            "categories": [
                "pizza",
                "restaurant"
            ],
            "classifications": [
                {
                    "code": "RESTAURANT",
                    "names": [
                        {
                            "nameLocale": "en-US",
                            "name": "pizza"
                        },
                        {
                            "nameLocale": "en-US",
                            "name": "restaurant"
                        }
                    ]
                }
            ]
        },
        "address": {
            "streetNumber": "2501",
            "streetName": "Soquel Dr",
            "municipalitySubdivision": "Santa Cruz, Live Oak",
            "municipality": "Santa Cruz, Live Oak",
            "countrySecondarySubdivision": "Santa Cruz",
            "countryTertiarySubdivision": "Santa Cruz",
            "countrySubdivision": "CA",
            "postalCode": "95065",
            "extendedPostalCode": "950652023",
            "countryCode": "US",
            "country": "United States Of America",
            "countryCodeISO3": "USA",
            "freeformAddress": "2501 Soquel Dr, Santa Cruz, CA 95065",
            "countrySubdivisionName": "California"
        },
        "position": {
            "lat": 36.98844,
            "lon": -121.97483
        },
        "viewport": {
            "topLeftPoint": {
                "lat": 36.98934,
                "lon": -121.97596
            },
            "btmRightPoint": {
                "lat": 36.98754,
                "lon": -121.9737
            }
        },
        "entryPoints": [
            {
                "type": "main",
                "position": {
                    "lat": 36.98817,
                    "lon": -121.97487
                }
            }
        ],
        "addressRanges": {
            "rangeLeft": "1 - 3",
            "rangeRight": "2 - 12",
            "from": {
                "lat": 51.16561,
                "lon": 19.48489
            },
            "to": {
                "lat": 51.16545,
                "lon": 19.4863
            }
        },
        "dataSources": {
            "geometry": {
                "id": "00004e4c-3100-3c00-0000-0000685e23c7"
            }
        },
        "route": {
            "routeGeometry": [
                "36.98847, -121.97506"
            ],
            "routeInstructions": {
                "list": [
                    {
                        "Instruction": "Proceed North on Winkle Ave",
                        "Point": "36.98847,-121.97506",
                        "description": "route maneuver 1",
                        "distance": {
                            "value": 0,
                            "uom": "MI"
                        },
                        "duration": "P0DT0H0M0S",
                        "waitTime": "P0DT0H0M0S",
                        "turnAngle": 0,
                        "turn": "Proceed",
                        "tour": 0
                    },
                    {
                        "Instruction": "Arrive at destination",
                        "Point": "36.98847,-121.97506",
                        "description": "route maneuver 2",
                        "distance": {
                            "value": 0,
                            "uom": "MI"
                        },
                        "duration": "P0DT0H0M0S",
                        "waitTime": "P0DT0H0M0S",
                        "turnAngle": 0,
                        "tour": 0,
                        "sideOfStreet": "Unknown"
                    }
                ],
                "language": "english"
            },
            "routeSummary": {
                "boundingBox": {
                    "topLeftPoint": "36.98846999999999, -121.97505999999998",
                    "btmRightPoint": "36.98846999999999, -121.97505999999998"
                },
                "totalDistance": {
                    "value": 0,
                    "uom": "MI"
                },
                "totalTime": "P0DT0H0M0S",
                "totalTravelTime": "P0DT0H0M0S",
                "totalWaitTime": "P0DT0H0M0S"
            }
        }
    }
    

Response fields

Each element of the results array is in the format:

Field Description Type / Values
Response
summary Summary information about the search that was performed. Summary
results Result list, sorted in descending order by score. Result[]
Summary
query Query as interpreted by the search engine. String
queryType Response type. * see response types below. String
queryTime Time spent on resolving the query. Integer
numResults Number of Results in the response. Integer
offset Starting offset of the returned Results within the full Result set. Integer
totalResults Total number of Results found. Integer
fuzzyLevel Maximum fuzzy level required to provide Results. Integer
geoBias Position used to bias the Results. LatLon
Result
type Type of Result. One of:

  • POI
  • Street
  • Geography
  • Point Address
  • Address Range
  • Cross Street
id Non-stable id for this Result. String
score Score of the Result. Larger score means that probability that a Result meets query criteria is higher. Double
dist Unit: meters. Double
info Information about original data source of the Result. String
entityType Optional section. Only present if type == Geography. One of:

  • County
  • CountrySubdivision
  • CountrySecondarySubdivision
  • CountryTertiarySubdivision
  • Municipality
  • MunicipalitySubdivision
  • Neighbourhood
  • PostalCodeArea
poi Optional section. Only present if type == POI. Poi
address Structured address for the Result. Address
position Position of the Result. LatLon
viewport A viewport which can be used to display the Result on a map. Viewport
entrypoints List of entry points of the POI. Entrypoint[]
route A route from the query position and heading to this Result. Route
Poi
name Name of the POI. String
phone Telephone number. String
url Website URL. String
categories The list of POI categories.
DEPRECATED1: Use classifications instead.
Category[]
classifications The list of POI category classifications. Classification[]
Classification
code Fixed top level category code. Category Code
names List of category names with locale code. information. Currently only "en-US" locale is returned. Name[]
Name
nameLocale Locale code of this category name. String
name Category name in given locale. String
Address
streetNumber The building number on the street. String
streetName The street name. String
municipalitySubdivision Sub / Super City. String
municipality City / Town. String
countrySecondarySubdivision County. String
countryTertiarySubdivision Named Area. String
countrySubdivision State or Province. String
postalCode Postal Code / Zip Code. String
extendedPostalCode Extended postal code (availability dependent on region). String
countryCode Country. String
country Country name. String
countryCodeISO3 ISO alpha-3 country code. String
freeformAddress An address line formatted according to formatting rules of Result's country of origin or in case of countries it's full country name. String
countrySubdivisionName A full name of a first level of country administrative hierarchy. This field appears only in case countrySubdivision is presented in an abbreviated form. Supported only for USA, Canada and Great Britain. String
Viewport
topLeftPoint Top left corner of the rectangle. LatLon
btmRightPoint Bottom right corner of the rectangle. LatLon
Entrypoint
type Main entry point. One of:

  • main
  • minor
position Position of the entry point. LatLon
AddressRanges
rangeLeft An address range on the left side of a street segment (assuming looking from the "from" end toward the "to" end). String
rangeRight An address range on the right side of a street segment (assuming looking from the "from" end toward the "to" end). String
from A beginning point of a street segment. LatLon
to An end point of a street segment. LatLon
DataSources
geometry Information about the geometric shape of the result. Only present if type == Geography. Geometry
Route
routeGeometry An ordered list of strings each in the form "latitude, longitude", denoting points along the route. String[]
routeInstructions Human readable guidance on how to follow the route. RouteInstructions
routeSummary Summary information about the route as a whole. RouteSummary
RouteInstructions
list An ordered list of human readable guidance instructions. RouteInstruction[]
language The language that the human readable instructions are given in. english
RouteInstruction
Instruction A human readable instruction, e.g. Turn left onto ... String
Point The "latitude,longitude" location at which the instructions should be executed. String
description A string describing the instruction, currently in the form "route maneuver N" with N being the 1-based index into the list of instructions. String
distance Distance from preceding maneuver. MeasuredUnit
duration The expected time to complete this maneuver. String
waitTime Time spent waiting at intersections. String
turnAngle The angle of the turn in the maneuver. 0.0° is straight ahead. 90.0° is a right angle turn to the right. 270.0° is a right angle turn to the left, and so on. Double
turn The procedure to complete this maneuver. Typically this is an instruction such as "Turn right". String
tour The number of waypoints passed thus far. Integer
RouteSummary
boundingBox A box that minimally encloses the route. BoundingBox
totalDistance The sum of the RouteInstruction distances. MeasuredUnit
totalTime The sum of the RouteInstruction durations. String
totalTravelTime The sum of the RouteInstruction durations. String
totalWaitTime The sum of the RouteInstruction durations, excluding the waitTimes. String
BoundingBox
topLeftPoint Top-left "latitude, longitude" coordinate of the bounding box. String
btmRightPoint Bottom right "latitude, longitude" coordinate of the bounding box. String
LatLon
lat Latitude. Double
lon Longitude. Double
MeasuredUnit
value A distance in unit uom. Double
uom Indicates that value is expressed in miles. MI

Response codes

Code Meaning and possible causes
200 OK: the search successfully returned zero or more results.
400 Bad Request: one or more parameters were incorrectly specified.
403 Forbidden: possible causes include:

  • Service requires SSL
  • Not authorized
  • Rate or volume limit exceeded
  • Unknown referer
405 Method Not Allowed: the HTTP method (GET, POST, etc) is not supported for this request.
404/596 Not Found: the HTTP request method (GET, POST, etc) or path is incorrect.
5xx Server Error: the service was unable to process your request. Contact support to resolve the issue.

Response headers

Header Description Value
Access-Control-Allow-Origin Ensures that clients that implement the CORS security model are able to access the response from this service. *
Content-Type Indicates the format of the response, as chosen by the client. Format: type/subtype; charset=utf-8 type/subtype is one of:

  • application/json
  • text/javascript
  • text/xml

1May 1, 2018: The categories response field has been deprecated and will be withdrawn following a 12 month deprecation period. The planned withdrawal date is May 1, 2019.