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

Geocode

 

Service version: 2
Last edit: 2019.10.29

On this page

Purpose

In many cases, the complete Search service might be too much. For instance, if you are only interested in traditional Geocoding, Search can also be exclusively accessed for address look-up.

  • The Geocoding is performed by hitting the Geocode endpoint with just the address or partial address in question.
  • The Geocoding index will be queried for everything above the street level data.
  • No POIs (Points of Interest) will be returned.
  • Note that the geocoder is very tolerant of typos and incomplete addresses.

It will also handle everything from exact street addresses, streets, or intersections as well as higher-level geographies such as city centers, counties, states, etc.

Run this endpoint

You can easily run this and other endpoints.

  1. Go to the TomTom API Explorer page.
  2. Click an endpoint.

    1. Click Try it out.
    2. Enter/select all required parameter values and any optional parameter values.
    3. At the bottom of the form, click Execute.
  3. Review the Response.

Request data

HTTPS Method:GET

URL format

GET https://<baseURL>/search/<versionNumber>/geocode/<query>.<ext>?key=<Your_API_Key>[&storeResult=<storeResult>][&typeahead=<typeahead>][&limit=<limit>][&ofs=<ofs>][&lat=<lat>][&lon=<lon>][&countrySet=<countrySet>][&radius=<radius>][&topLeft=<topLeft>][&btmRight=<btmRight>][&language=<language>][&extendedPostalCodesFor=<extendedPostalCodesFor>][&view=<view>]

▲ Return to Top

Request parameters

The following table 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.
Required parameters
Parameter Description
baseURL
string
Base URL for calling the API:
Value: api.tomtom.com
versionNumber
string
Service version number.
Value: The current value is 2.
query
string
The query string.

Value: A properly URL encoded query string.

ext
string
A valid response format:
Values: JSON, JSONP, JS, or XML
key
string
An API Key valid for the requested service.
Value: Your valid API Key.
Optional headers
Header Description
[Accept-Encoding]
string
Enables response compression.
Value: gzip
Optional parameters
Parameter Description
[storeResult]
boolean
Deprecated
If the "storeResult" flag is set, the query will be interpreted as a stored geocode, and will be billed according to the terms of use.
Default value: false.
December 1, 2017:

  • The storeResult parameter has been deprecated and will be withdrawn following a 12 month deprecation period.
  • The planned withdrawal date is December 1, 2018.
  • Following withdrawal, API Requests that include the storeResult parameter will receive a HTTP 400 error in the Response.
[typeahead]
boolean
If the typeahead flag is set, the query will be interpreted as a partial input, and the search will enter predictive mode.
Default value: false
[limit]
integer
The maximum number of responses that will be returned.
Default value: 10
Maximum value: 100
[ofs]
integer
The starting offset of the returned results within the full result set.
Default value: 0
Maximum value: 1900
[lat]
float
Latitude, e.g., lat=37.337 lat,lon where results should be biased.
Note: supplying a lat/lon without a radius will bias the search results to that area.
Value: lat
[lon]
float
Longitude, e.g., lon=-121.89 lat,lon where results should be biased.
Note: supplying a lat/lon without a radius will bias the search results to that area.
Value: lon
[countrySet]
string
A comma-separated string of country codes (e.g., FR,ES).

  • This will limit the search to the specified countries.
  • The choice of view may restrict which countries are available.

Value: FR,ES,etc.

[radius]
integer
If radius and position are set, the results will be constrained to the defined area. The radius parameter is specified in meters.
Value: A radius.
[topLeft]
string
Top-left position of the bounding box.

  • This is specified as a comma-separated string composed by lat,lon (e.g., 37.553,-122.453).
  • Important note: Point-Radius parameters and Bounding Box parameters are mutually exclusive.
  • Point-Radius parameters take precenence when both are passed.

Value: A comma-separated string composed by lat,lon.
Example: 37.553,-122.453

[btmRight]
string
Bottom-right position of the bounding box.

  • This is specified as a comma-separated string composed by lat,lon (e.g., 37.553,-122.453).
  • Important note: Point-Radius parameters and Bounding Box parameters are mutually exclusive.
  • Point-Radius parameters take precenence when both are passed.

Value: A comma-separated string composed by lat,lon.
Example: 37.553,-122.453

[language]
string
Language in which search results should be returned.

  • Should be one of the TomTom supported IETF language tags, case insensitive.
  • When data in specified language is not available for a specific field, the default langauge is used.

Value: A TomTom supported IETF language tag.

[extendedPostalCodesFor]
string
Indexes for which extended postal codes should be included in the results.

  • Available values are described in Additional Information indexes abbreviation values section.
  • The 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,POI
  • extendedPostalCodesFor=None

Extended postal code is returned as the extendedPostalCode property of an address. Availability is region-dependent.
Value: A comma-separated list of index types.

[view]
string
Geopolitical View.

  • The context used to resolve the handling of disputed territories.
  • Views include Unified, along with AR, IL, IN, MA, PK, RU and TR which are respectively tailored for Argentina, Israel, India, Morocco, Pakistan, Russia and Turkey.

Default values:

  • Argentina, default view: AR, available views: Unified, IL, IN, MA, PK, RU, TR
  • India, default view: IN, available views: -
  • Morocco, default view: MA, available views: Unified, AR, IL, IN, PK, RU, TR
  • Pakistan, default view: PK, available views: Unified, AR, IL, IN, MA, RU, TR
  • Russia, default view: RU, available views: Unified, AR, IL, IN, MA, PK, TR
  • Turkey, default view: TR, available views: Unified, AR, IL, IN, MA, PK, RU
  • Others, default view: Unified, available views: AR, IL, IN, MA, PK, RU, TR

▲ Return to top

Response data

Response body

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 following Response field documentation for more information.

When requesting JSON output the Response has the following structure:

{
  "summary": {
    "query": "2501 soquel dr santa cruz ca 95065",
    "queryType": "NON_NEAR",
    "queryTime": 8,
    "numResults": 1,
    "offset": 0,
    "totalResults": 1,
    "fuzzyLevel": 1,
    "geoBias": {
      "lat": 36.98844,
      "lon": -121.97483
    }
  },
  "results": []
}

Where each element of the results array is in the following format:

{
  "type": "Point Address",
  "id": "US/PAD/p0/45619296",
  "score": 15.725,
  "dist": 0.8875712594288668,
  "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",
    "localName": "Santa Cruz"
  },
  "position": {
    "lat": 36.98844,
    "lon": -121.97482
  },
  "viewport": {
    "topLeftPoint": {
      "lat": 36.98934,
      "lon": -121.97595
    },
    "btmRightPoint": {
      "lat": 36.98754,
      "lon": -121.97369
    }
  },
  "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"
    }
  }
}

▲ Return to top

Response fields

The following tables describe all of the fields that can appear in a Response. Fields are listed by the Response section they belong to, and in the order that they appear in the Response.

Primary fields
Field Description
summary{}
object
Summary information about the search that was performed.
summary{} object
results[]
array
The result list, sorted in descending order by score.
results[] array
summary{} object
Field Description
query
string
The query as interpreted by the search engine.
queryType
string
Response type. Can be NEARBY or NON_NEAR.
queryTime
integer
Time spent on resolving the query.
numResults
integer
The number of Results in the response.
offset
integer
The starting offset of the returned Results within the full Result set.
totalResults
integer
The total number of Results found.
fuzzyLevel
integer
The maximum fuzzy level required to provide Results.
geoBias
string
The position used to bias the Results: Latitude, Longitude
LatLon double
Example: 37.553,-122.453
results[] array
Field Description
type
string
The type of Result. One of:

  • POI
  • Street
  • Geography
  • Point Address
  • Address Range
  • Cross Street
id
string
the non-stable unique id for this Result.
score
double
The score of the Result. A larger score means there is a probability that a Result meeting the query criteria is higher.
dist
double
Unit: meters. This is the distance to an object if geobias was provided.
address
object
The structured address for the Result.
address{} object
position
object
The position of the Result: Latitude, Longitude
LatLon double
Example: 37.553,-122.453
viewport
object
A viewport which can be used to display the Result on a map.
viewport{} object
entrypoints
array
A list of entry points of the POI (Points of Interest).
entryPoints[] array
addressRanges
object
The address ranges on a street segment. Available only for Results where the Result type is equal to Address Range.
addressRanges{} object
dataSources
object
An optional section. These are unique reference ids for use with the Additional Data service.
dataSources{} object
address{} object
Field Description
streetNumber
string
The building number on the street.
streetName
string
The street name.
municipalitySubdivision
string
Sub / Super City
municipality
string
City / Town
countrySecondarySubdivision
string
County
countryTertiarySubdivision
string
Named Area
countrySubdivision
string
State or Province
postalCode
string
Postal Code / Zip Code
extendedPostalCode
string
Extended postal code (availability dependent on region)
countryCode
string
A country's code (Note: This is a two-letter code, not a country name.)
country
string
Country name
countryCodeISO3
string
ISO alpha-3 country code
freeformAddress
string
An address line formatted according to the formatting rules of a Result's country of origin, or in the case of countries, its full country name.
countrySubdivisionName
string
The full name of the 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.
localName
string
An address component which represents the name of a geographic area or locality that groups a number of addressable objects for addressing purposes, without being an administrative unit.
viewport{} object
Field Description
topLeftPoint
string
The top-left corner of the rectangle.
LatLon double
btmRightPoint
string
The bottom-right corner of the rectangle.
LatLon double
entryPoints[] array
Field Description
type
string
The main entry point. One of:

  • main
  • minor
position
string
The position of the entry point: Latitude, Longitude
LatLon double
Example: 37.553,-122.453
addressRanges{} object
Field Description
rangeLeft
string
An address range on the left side of a street segment (assuming looking from the "from" end toward the "to" end).
rangeRight
string
An address range on the right side of a street segment (assuming looking from the "from" end toward the "to" end).
from
string
The beginning point of a street segment: Latitude, Longitude
LatLon double
to
string
The end point of a street segment: Latitude, Longitude
LatLon double
dataSources{} object
Field Description
geometry
object
Information about the geometric shape of the result. Only present if type == Geography or POI.
geometry{} object
geometry
Field Description
id
string
Pass this as geometryId to the Additional Data service to fetch geometry information for this result.
LatLon
Field Description
lat
float
Latitude
lon
float
Longitude

▲ Return to top

HTTP Response codes

The following data table contains Response codes signifying successful and failed Requests to an API server.

Code Meaning & 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.

▲ Return to top

Response headers

The following table contains Response headers sent back from an API server.

Header Description
Access-Control-Allow-Origin Ensures that clients implementing the CORS security model are able to access the response from this service.
Value: An asterisk "*" that signifies access to the TomTom API using the Access-Control-Allow-Origin (ACAO) header in its Response indicating which origin sites are allowed.
Content-Type Indicates the format of the response, as chosen by the client.
Format: type/subtype; charset=utf-8
Value: type/subtype is one of:

  • application/json
  • text/javascript
  • text/xml
Content-Encoding If requested by the client, the Search service applies gzip compression to the Responses with the Accept-Encoding header.
Value: gzip

Additional information

Indexes abbreviation values

In some cases, list of indexes can be passed as a parameter to query, which should be listed with their abbreviations, available values are:

  • Geo = Geographies - areas on map which represent administrative divison of a land ie. country, state, city.
  • PAD = Point Addresses - points on map where specific address with street name and number can be found in index, ie. Soquel Dr 2501.
  • Addr = Address ranges - for some streets there are address points that are interpolated from the beginning and end of the street, those points are represented as address ranges.
  • Str = Streets - representation of streets on the map.
  • XStr = Cross Streets (intersections) - representations of junctions; places where two streets intersect.

▲ Return to Top

You are here