Reverse Geocode

Service version: 2
Last edit: 2024.04.16

Purpose

The TomTom Reverse Geocoding API gives users a tool to translate a coordinate (for example: 37.786505, -122.3862) into a human-understandable street address, street element, or geography. Most often, this is needed in tracking applications where you receive a GPS feed from the device or asset and you want to know the address.

The type of response depends on the available data:

  • address: Returns the most detailed information.
  • street element: Less detailed returned when there is no address data.
  • geography: Returns the smallest available geographic data.
    • This is returned when there is no address or street element data.
    • You can specify the level of geography (see the entityType parameter in the request parameters section) to get a geometry.
    • The geometry data can be fetched using the Additional Data service.

Run this endpoint

You can easily run this and other endpoints. Go to the TomTom API Explorer page and follow the directions.

Request data

HTTPS Method: GET

For ease of viewing and identification:

  • Constants and parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.

URL request format

get
URL request format
https://{baseURL}/search/{versionNumber}/reverseGeocode/{position}.{ext}?key={Your_API_Key}&returnSpeedLimit={returnSpeedLimit}&heading={heading}&radius={radius}&number={number}&returnRoadClass={returnRoadClass}&returnRoadUse={returnRoadUse}&roadUse={roadUse}&entityType={entityType}&callback={callback}&language={language}&allowFreeformNewline={allowFreeformNewline}&returnMatchType={returnMatchType}&view={view}&mapcodes={mapcodes}&filter={filter}

URL request example

get
URL request example
https://api.tomtom.com/search/2/reverseGeocode/52.157831,5.223776.json?key={Your_API_Key}&radius=100

curl command request example

get
curl command request example
curl 'https://api.tomtom.com/search/2/reverseGeocode/52.157831,5.223776.xml?key={Your_API_Key}&radius=100'

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 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

Description

baseURL


string

Base URL for calling the API.


Values:

versionNumber


string

The service version.


Value: The current value is 2.

position


comma-separated string

This is specified as a comma-separated string composed by lat,lon.


Value: lat,lon


Example: 37.553,-122.453.

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 TomTom API Key. See: How do I get a TomTom API Key?

Optional parametersDescription

returnSpeedLimit
boolean

Enables the return of the posted speed limit (where available).
Default value: false

heading
float

The directional heading of the vehicle in degrees, for travel along a segment of roadway. 0 is North, 90 is East and so on. The precision can include up to one decimal place.
Values: Values range from -360 to 360.

radius
integer

The maximum distance in meters from the specified position for the reverseGeocode to consider.
Default value: 10000 meters (10 km).

number
string

If a house number is sent in along with the request, the response may include the side of the street (Left/Right), and also an offset position for that number.
Value: A number


Note

The number can include a character such as "94c".


Deprecated

Support for the number parameter will be removed.

returnRoadClass
comma-separated string

Enables the return of the roadClass array for reverseGeocodes at street level.
Value:

  • Functional
    Represents a classification of roads based on the importance that the constituting roads have in the total road network.


Note

Right now, the service supports only a single value, but in future, it may change.

returnRoadUse
boolean

Enables the return of the roadUse array for reverseGeocodes at street level.
Default value: false.


Deprecated

Support for the returnRoadUse parameter will be removed.

roadUse
array

Restricts reverseGeocodes to a certain type of road use.
Value: The roadUse JSON array for reverseGeocodes can be one or more of:

roadUse JSON array
["LimitedAccess", "Arterial", "Terminal", "Ramp", "Rotary", "LocalStreet"]

Deprecated

Support for the roadUse parameter will be removed.

entityType
comma-separated string

This parameter specifies the level of filtering performed on geographies. Providing this parameter narrows the search for specified geography entity types. The resulting response will contain the matched entity type. The following parameters are ignored when entityType is set:

  • heading
  • number
  • returnRoadClass
  • returnRoadUse
  • returnSpeedLimit
  • roadUse
  • returnMatchType

Values: One or more of:

  • Country
  • CountrySubdivision
  • CountrySecondarySubdivision
  • CountryTertiarySubdivision
  • Municipality
  • MunicipalitySubdivision
  • MunicipalitySecondarySubdivision
  • Neighbourhood
  • PostalCodeArea

callback
string

Specifies the callback method.
Default value: cb

language
string

The language in which the reverse geocode result should be returned. It should be one of the TomTom IETF Supported Languages tags, case insensitive. When data in a specified language is not available for a specific field, the default language is used.
Default value: NGT

allowFreeformNewline
boolean

The format of newlines in the formatted address. If true, the address will contain newlines. Otherwise, newlines will be converted to spaces.
Default value: false.

returnMatchType
boolean

This includes information on the type of match the geocoder achieved in the response.
Default value: false.

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, TR, and CN which are respectively tailored for Argentina, Israel, India, Morocco, Pakistan, Russia, Turkey, and China.
Default values:

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

mapcodes
comma-separated string

Enables the return of mapcodes. Can also filter the response to only show selected mapcode types. See mapcode in the response. A mapcode represents a specific location, to within a few meters. Every location on Earth can be represented by a mapcode. Mapcodes are designed to be short, easy to recognize, remember and communicate. Visit the Mapcode project website for more information.
Values: One or more of: Local, International, and Alternative.

filter
string

Excludes a certain group of inspected address-carrying elements in order to find the closest match to a requested point. Right now service supports only single value, but in future it may change.
Value : BackRoads
BackRoads : Roads that do not have an official name and any other kind of address information attached: unaddressable paths, forest paths, tracks, commercial driveways used as service roads, hiking paths, etc. Use of this filter is advised in cases where obtaining accurate address is top priority. It should not be used in a 'vehicle/asset tracking' use case or in road elements 'matching/focus' use case(s).

Request headers

The following table describes HTTP request headers.

Optional headers

Description

Accept-Encoding

Enables response compression.


Value: gzip

Tracking-ID

Specifies an identifier for the request.

  • It can be used to trace a call.
  • The value must match the regular expression '^[a-zA-Z0-9-]{1,100}$'.
  • An example of the format that matches this regular expression is UUID: (e.g., 9ac68072-c7a4-11e8-a8d5-f2801f1b9fd1).
  • For details check RFC 4122.
  • If specified, it is replicated in the Tracking-ID response header.
  • It is only meant to be used for support and does not involve tracking of you or your users in any form.

Value: An identifier for the request.

Response data

Response body

For illustrative purposes the examples below are neatly indented. Please note that actual responses will vary based on the result type and the data available. See the following response fields section for more information. When requesting JSON output, the response has the following structure:

Response structure - JSON
1{
2 "summary": {
3 "queryTime": 102,
4 "numResults": 1
5 },
6 "addresses": []
7}

Example response for the result of the Point Address type is in the following format:

Point Address type example response - JSON
1{
2 "summary": {
3 "queryTime": 8,
4 "numResults": 1
5 },
6 "addresses": [
7 {
8 "address": {
9 "buildingNumber": "4301",
10 "streetNumber": "4301",
11 "routeNumbers": [],
12 "street": "Payne Avenue",
13 "streetName": "Payne Avenue",
14 "streetNameAndNumber": "4301 Payne Avenue",
15 "countryCode": "US",
16 "countrySubdivision": "OH",
17 "countrySecondarySubdivision": "Cuyahoga",
18 "municipality": "Cleveland",
19 "postalCode": "44103",
20 "neighbourhood": "Goodrich Park",
21 "country": "United States",
22 "countryCodeISO3": "USA",
23 "freeformAddress": "4301 Payne Avenue, Cleveland, OH 44103",
24 "boundingBox": {
25 "northEast": "41.511555,-81.655712",
26 "southWest": "41.511237,-81.656859",
27 "entity": "position"
28 },
29 "extendedPostalCode": "44103-2328",
30 "countrySubdivisionName": "Ohio",
31 "countrySubdivisionCode": "OH",
32 "localName": "Cleveland"
33 },
34 "position": "41.511265,-81.656761",
35 "matchType": "AddressPoint",
36 "mapcodes": [
37 {
38 "type": "Local",
39 "fullMapcode": "US-OH RL.BPD",
40 "territory": "US-OH",
41 "code": "RL.BPD"
42 },
43 {
44 "type": "International",
45 "fullMapcode": "T8GNX.DMVD"
46 },
47 {
48 "type": "Alternative",
49 "fullMapcode": "US-OH 63Y.LMT",
50 "territory": "US-OH",
51 "code": "63Y.LMT"
52 },
53 {
54 "type": "Alternative",
55 "fullMapcode": "US-OH FDPJ.HPV",
56 "territory": "US-OH",
57 "code": "FDPJ.HPV"
58 },
59 {
60 "type": "Alternative",
61 "fullMapcode": "US-OH VPLJ.0MCB",
62 "territory": "US-OH",
63 "code": "VPLJ.0MCB"
64 },
65 {
66 "type": "Alternative",
67 "fullMapcode": "USA VPLJ.0MCB",
68 "territory": "USA",
69 "code": "VPLJ.0MCB"
70 }
71 ],
72 "id": "kpHmjwCbhx3w42-YsJf_7w"
73 }
74 ]
75}

Example response for the Geography result with entityType=PostalCodeArea filtering:

Geography example response - JSON
1{
2 "summary": {
3 "queryTime": 10,
4 "numResults": 1
5 },
6 "addresses": [
7 {
8 "address": {
9 "routeNumbers": [],
10 "countryCode": "US",
11 "countrySubdivision": "CA",
12 "countrySecondarySubdivision": "Santa Cruz",
13 "municipality": "Santa Cruz",
14 "postalName": "Santa Cruz",
15 "postalCode": "95065",
16 "country": "United States",
17 "countryCodeISO3": "USA",
18 "freeformAddress": "Santa Cruz, CA 95065",
19 "boundingBox": {
20 "northEast": "37.085762,-121.949375",
21 "southWest": "36.983408,-122.013236",
22 "entity": "position"
23 },
24 "countrySubdivisionName": "California"
25 },
26 "position": "36.988171,-121.974876",
27 "dataSources": {
28 "geometry": {
29 "id": "00005543-3300-3c00-0000-00004dc8b8e5"
30 }
31 },
32 "entityType": "PostalCodeArea",
33 "mapcodes": [
34 {
35 "type": "Local",
36 "fullMapcode": "US-CA FS.WRG0",
37 "territory": "US-CA",
38 "code": "FS.WRG0"
39 },
40 {
41 "type": "International",
42 "fullMapcode": "S4ZW4.89XV"
43 },
44 {
45 "type": "Alternative",
46 "fullMapcode": "US-CA 4349.S7L",
47 "territory": "US-CA",
48 "code": "4349.S7L"
49 },
50 {
51 "type": "Alternative",
52 "fullMapcode": "US-CA JJCH.H9CF",
53 "territory": "US-CA",
54 "code": "JJCH.H9CF"
55 },
56 {
57 "type": "Alternative",
58 "fullMapcode": "USA JJCH.H9CF",
59 "territory": "USA",
60 "code": "JJCH.H9CF"
61 }
62 ],
63 "id": "00005543-3300-3c00-0000-00004dc8b8e5"
64 }
65 ]
66}

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

addresses


array

The result list containing a single record.


addresses array

summary object

FieldDescription

queryTime


integer

The time spent on resolving the query (in milliseconds).

numResults


integer

The number of results in the response. The current version of the API returns a maximum of 1 result.

addresses array

FieldDescription

address


object

The structured address for the result.


address object

position


double (LatLon)

Position of the result in the form of "latitude,longitude" coordinates. Position of the entry point. Position on the street where you can enter the location.


Example: 37.553,-122.453

roadClass


array

Optional field. It can be returned only if the 'returnRoadClass' input parameter is used.


Road classes at the address.


roadclass object

roadUse


array

Optional field. It can be returned only if the 'returnRoadUse' input parameter is used.


List of road usage types at the address.


Zero or more of:

  • LimitedAccess

  • Arterial

  • LocalStreet

  • Terminal

  • Rotary

  • Ramp

  • Publicly Accessible

  • Not Publicly Accessible

  • Pedestrian Mall

  • Service Vehicles Only

  • Walkway

  • POI Entry Point

  • Car-Park

  • Unidentified

  • Slip-Road

  • Frontage Road

  • Special Traffic Figure

  • Entrance Ramp

  • Exit Ramp

  • Entrace & Exit Ramp

  • Highway Interchange

  • Parallel Ramp


Deprecated

Support for roadUse will be removed.

matchType


string

Information on the type of match. One of:

  • AddressPoint

  • HouseNumberRange

  • Street

dataSources


object

Optional section.


Reference ids for use with the Additional Data service.


dataSources object


geometry object

mapcodes


array

Optional section. It can be returned only if the 'mapcodes' input parameter is used.


List of mapcode objects.


mapcode object

id


string

A stable, unique id for a given entity.

address object

FieldDescription

buildingNumber


string


Deprecated

The building number on the street.


Deprecated

Use streetNumber instead.

building


string

The building name or code of the address. This can be a descriptive name, an alphanumeric string, or even a single alphabetic character or numerical digit.

streetNumber


string

The building number on the street.

routeNumbers


array

The codes used to unambiguously identify the street.

street


string


Deprecated

The street name.


Deprecated

Use streetName instead.

streetName


string

The street name.

streetNameAndNumber


string

The street name and number.

speedLimit


string

The speed limit for the street in the form (D)(D)D.DDUUU, For example:

  • 30.00KPH
  • (D)(D)D.DD is a number with two decimal places (for example: 5.00, 30.00 or 120.00).

  • UUU is either KPH or MPH (whichever is correct for the address).

countryCode


string

Country


Note

This is a two-letter code, not a country name.

countrySubdivision


string

State or Province

countrySecondarySubdivision


string

County

countryTertiarySubdivision


string

Named Area

municipality


string

City / Town

postalName


string

An address component which represents the name for a postal code that is related to a single administrative area, city, town, or other populated place. Only present when the parameter entityType == PostalCodeArea.

postalCode


string

Postal Code / Zip Code

municipalitySubdivision


string

Sub City

municipalitySecondarySubdivision


string

Sub Sub City

neighbourhood


string

Neighbourhood

sideOfStreet


string

The left or right side of the street location. This can be returned only when the number parameter was defined.


Deprecated

Support for sideOfStreet will be removed.

offsetPosition


string

The location of the building for the given number. This can be returned only when the number parameter was defined.


Example: 37.553,-122.453


Deprecated

Support for offsetPosition will be removed.

country


string

Country name

countryCodeISO3


string

ISO 3166-1 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 a country, its full country name.

boundingBox


object

The bounding box of the location.


boundingBox object

countrySubdivisionName


string

The full name of a first level of country administrative hierarchy.

countrySubdivisionCode


string

countrySubdivisionCode prefixed by countryCode and the hyphen ( countryCode-countrySubdivisionCode ) forms the ISO 3166-2 code. countrySubdivisionCode examples: TX for Texas, SCT for Scotland, ON for Ontario, ZE for Zeeland and BB for Brandenburg.

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.

extendedPostalCode


string

Extended postal code (availability is dependent on the region).

boundingBox object

FieldDescription

northEast


comma-separated floats

North-east (top-left) latitude, longitude coordinate of the bounding box.

southWest


comma-separated floats

South-west (bottom-right) latitude, longitude coordinate of the bounding box.

entity


string

Entity type source of the bounding box.


Note

For reverse-geocoding this is always equal to string: 'position'.

roadClass object

FieldDescription

type


string

Possible values:

  • Functional
    Represents a classification of roads based on the importance that the constituting roads have in the total road network.

values


array

Possible values:

  • for type Functional

    • Motorway
      Includes all roads officially designated as members of an internationally, nationally, and/or regionally important network of limited-access highways.

    • Trunk
      Includes all roads of high importance (but not officially assigned as motorways) that are part of a connection for international and national traffic and transport.

    • Primary
      Includes all roads used to travel between neighboring regions of a country.

    • Secondary
      Includes all roads used to travel between different parts of the same region.

    • Tertiary
      Includes:

      • All roads that make each settlement or parts (north, south, east, west and central) of a settlement accessible.
      • All roads on the local level are the main connections in a settlement or represent frequently used rural connections. These are roads where important through traffic is possible.
      • All roads used to travel within a part of a settlement or roads of minor connecting importance in a rural area.
    • Street
      Includes all roads that only have a destination function. Such roads reach a particular address or destination (e.g., dead-end streets, roads inside a living area, alleys [narrow roads between buildings], or roads found in a park or garden).

    • Ferry
      Includes all ferry routes.

    • Other
      Includes all other roads that are less important for the navigation system.

Note

For the Functional type, the service always returns a single element from possible values.

dataSources object

FieldDescription

geometry


object

Information about the geometric shape of the result. Only present if type == Geography.
geometry object

geometry object

FieldDescription

id


string

Pass this as geometryId to the Additional Data service to fetch geometry information for this result.

mapcode object

FieldDescription

type


string

Type of mapcode. Possible values:


Local :
The shortest possible (and easiest to remember) mapcode. Local mapcodes are especially useful when the user knows what territory the mapcode is in (for example, when an application is designed to be used inside just one European country or US state).
Note that the code element of a Local mapcode is ambiguous when used without the territory element - e.g.,: the "4J.P2" mapcode can mean the Eiffel Tower location (48.858380, 2.294440) (with the territory set to FRA ), but also some place in Amsterdam-Noord, Netherlands (52.382184, 4.911021) (with the territory set to NLD ).


International :
This mapcode is unambiguous. It is also the longest.


Alternative :
Alternatives to Local mapcodes. Each Alternative mapcode points to slightly different coordinates due to the way mapcodes are computed (see the mapcode documentation ). For example: the position from a response can be encoded as "5DM.WC" (51.759244, 19.448316) and the "VHJ.036" (51.759245, 19.448264), which are close to each other, but not exactly the same place.

fullMapcode


string

The full form of a mapcode ( territory + code ). It is always unambiguous. The territory element is always in the Latin alphabet. In an International mapcode, the territory part is empty.

territory


string

The territory element of the mapcode. The territory element is always in the Latin alphabet. Usually, the territory is the ISO 3166-1 alpha 3 abbreviation for the country name. However in these eight very large countries:

  • USA,
  • Canada,
  • Mexico,
  • Brazil,
  • India,
  • Australia,
  • Russia,
  • China

an address has little meaning unless the user also knows what state it's in (just as, elsewhere, an address has little meaning if the user doesn’t know what country it’s in). More information about territory codes is available at Territories for mapcodes. This field is not returned for an International mapcode.

code


string

The mapcode without the territory element. It consists of two groups of letters and digits separated by a dot. The code is using the same language and alphabet as the response. The language parameter may be used to modify the language and alphabet of both the response and the code (for example: Cyrillic for the language 'ru-RU'). This field is not returned for the International mapcodes - use fullMapcode instead.

Default view mapping

Default view is recognized based on the country the request came from.

Country

Default view

Other available views

Argentina

AR

Unified, IL, IN, MA, PK, RU, TR, CN

India

IN

-

Morocco

MA

Unified, AR, IL, IN, PK, RU, TR, CN

Pakistan

PK

Unified, AR, IL, IN, MA, RU, TR, CN

Russia

RU

Unified, AR, IL, IN, MA, PK, TR, CN

Turkey

TR

Unified, AR, IL, IN, MA, PK, RU, CN

China

CN

Unified, AR, IL, IN, MA, PK, RU, TR

Others

Unified

AR, IL, IN, MA, PK, RU, TR, CN

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
  • Over QPS (Queries per second), or over QPD (Queries per day)
  • 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.

429

Too Many requests : The API Key is over QPS (Queries per second).

5xx

Server Error : The service was unable to process your request. Contact support to resolve the issue.

Response headers

The following data 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


Values: type/subtype is one of: application/json, text/javascript, or text/xml.

Content-Encoding

The Reverse Geocode service applies gzip compression to the responses if requested by the client with the Accept-Encoding header.


Value: gzip

Tracking-ID

An identifier for the request. If the Tracking-ID header was specified, it is replicated in the response. Otherwise, it is generated automatically by the service. It is only meant to be used for support and does not involve tracking of you or your users in any form.


Value: An identifier for the request.

Error response

The content type of an error response depends on the requested output format (.json or .xml).

Error response example (JSON)
1{
2 "error": "Invalid request: invalid position: latitude/longitude out of range.",
3 "httpStatusCode": 400,
4 "detailedError": {
5 "code": "BadRequest",
6 "message": "Invalid request: invalid position: latitude/longitude out of range.",
7 "target": "position"
8 }
9}
Error response example (XML)
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<response>
3 <error>Invalid request: invalid position: latitude/longitude out of range.</error>
4 <httpStatusCode>400</httpStatusCode>
5 <detailedError>
6 <code>BadRequest</code>
7 <message>Invalid request: invalid position: latitude/longitude out of range.</message>
8 <target>position</target>
9 </detailedError>
10</response>

Error response fields

Primary fields

Description

error


string

A human-readable description of the error code. It is intended as an aid to developers and is not suitable for exposure to end users.

httpStatusCode


integer

HTTP error code.

detailedError


object

Detailed information about the error.


detailedError object

detailedError object

FieldDescription

code


string

One of the defined error codes.

message


string

A human-readable representation of the error code. It is intended as an aid to developers and is not suitable for exposure to end users.

target


string

Optional. Target of the particular error.


Value: The name of the request parameter.

Error code hierarchy

A list of predefined, hierarchical, human-readable error codes. The httpStatusCode relates to HTTP error codes. An error code in detailedError can redefine httpStatusCode to one of the codes described in this section. In the future, the list may be extended with additional codes.

Error code

Description

BadRequest

The code for requests which ended with HTTP 400 Bad Request.

Forbidden

The code for requests which ended with HTTP 403 Forbidden.

InternalServerError

The code for requests which ended with HTTP 500 Internal Server Error. The service cannot handle the request right now, an unexpected condition was encountered.

ServerTimeout

The code for requests which ended with HTTP 504 Gateway Timeout. The service cannot handle the request right now, this is certainly a temporary state.