Reverse Geocode

Service version: 2
Last edit: 2022.09.07

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}&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/37.553,-122.453.json?key={Your_API_Key}

curl command request example

GET
curl command request example
curl 'https://api.tomtom.com/search/2/reverseGeocode/37.553,-122.453.json?key={Your_API_Key}'

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 parametersDescription
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.
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 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. Note: The number can include a character such as "94c".
Value: A number.
returnRoadUse
boolean
Enables the return of the roadUse array for reverseGeocodes at street level.
Default value: false.
roadUse
array
Restricts reverseGeocodes to a certain type of road use.
Value: The roadUse JSON array for reverseGeocodes can be one or more of:

GET
roadUse JSON array
1[
2 "LimitedAccess",
3 "Arterial",
4 "Terminal",
5 "Ramp",
6 "Rotary",
7 "LocalStreet"
8]
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
  • returnRoadUse
  • returnSpeedLimit
  • roadUse
  • returnMatchType

Values: One or more of:
  • Country
  • CountrySubdivision
  • CountrySecondarySubdivision
  • CountryTertiarySubdivision
  • Municipality
  • MunicipalitySubdivision
  • 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
Deprecation notice: Support for no-NO will be removed in favour of no-NB.
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, available views: Unified, IL, IN,MA, PK, RU, TR, CN
  • India, default view: IN, available views: -
  • Morocco, default view: MA, available views: Unified, AR, IL, IN, PK, RU, TR, CN
  • Pakistan, default view: PK, available views: Unified, AR, IL, IN, MA, RU, TR, CN
  • Russia, default view: RU, available views: Unified, AR, IL, IN, MA, PK, TR, CN
  • Turkey, default view: TR, available views: Unified, AR, IL, IN, MA, PK, RU, CN
  • China, default view: CN, available views: Unified, AR, IL, IN, MA, PK, RU, TR
  • Others, default view: Unified, 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
comma-separated string
Excludes a certain group of inspected address-carrying elements in order to find the closest match to a requested point.
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 headersDescription
Accept-EncodingEnables response compression.
Value: gzip
Tracking-IDSpecifies 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": 17,
4 "numResults": 1
5 },
6 "addresses": [
7 {
8 "address": {
9 "buildingNumber": "2501",
10 "streetNumber": "2501",
11 "routeNumbers": [],
12 "street": "Soquel Drive",
13 "streetName": "Soquel Drive",
14 "streetNameAndNumber": "2501 Soquel Drive",
15 "speedLimit": "35.00MPH",
16 "countryCode": "US",
17 "countrySubdivision": "CA",
18 "countrySecondarySubdivision": "Santa Cruz",
19 "municipality": "Santa Cruz",
20 "postalCode": "95065",
21 "municipalitySubdivision": "Santa Cruz, Live Oak",
22 "sideOfStreet": "L",
23 "offsetPosition": "36.988430,-121.974731",
24 "country": "United States",
25 "countryCodeISO3": "USA",
26 "freeformAddress": "2501 Soquel Drive, Santa Cruz, CA 95065",
27 "boundingBox": {
28 "northEast": "36.988197,-121.974752",
29 "southWest": "36.988156,-121.975108",
30 "entity": "position"
31 },
32 "extendedPostalCode": "950651900",
33 "countrySubdivisionName": "California",
34 "localName": "Santa Cruz"
35 },
36 "position": "36.988159,-121.974762",
37 "roadUse": [
38 "Arterial"
39 ],
40 "matchType": "AddressPoint",
41 "mapcodes":[
42 {
43 "type":"Local",
44 "fullMapcode":"US-CA FS.WRH3",
45 "territory":"US-CA",
46 "code":"FS.WRH3"
47 },
48 {
49 "type":"International",
50 "fullMapcode":"S4ZW4.990V"
51 },
52 {
53 "type":"Alternative",
54 "fullMapcode":"US-CA 4349.S8W",
55 "territory":"US-CA",
56 "code":"4349.S8W"
57 },
58 {
59 "type":"Alternative",
60 "fullMapcode":"US-CA JJCH.H9DF",
61 "territory":"US-CA",
62 "code":"JJCH.H9DF"
63 },
64 {
65 "type":"Alternative",
66 "fullMapcode":"USA JJCH.H9DF",
67 "territory":"USA",
68 "code":"JJCH.H9DF"
69 }
70 ]
71 }
72 ]
73}

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 }
64 ]
65}

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
FieldDescription
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.
addresses array
FieldDescription
address
object
The structured address for the result.
address object
position
double (LatLon)
Position of the result in a form of "latitude,longitude" coordinates.
Example: 37.553,-122.453
roadUse
array
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
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.
List of mapcode objects.
mapcode object
address object
FieldDescription
buildingNumber
string
Deprecated
The building number on the street.
Deprecated

Use streetNumber instead.

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 DD.DDUUU, For example:
  • 30.00KPH
  • D is a digit (for example, 30.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 / Super City
sideOfStreet
string
The left or right side of the street location. This is returned only when the number parameter was defined.
offsetPosition
string
The offset position coordinates of the location.
Example: 37.553,-122.453
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. This field appears only in case countrySubdivision is presented in an abbreviated form. Only supported for the USA, Canada, and Great Britain.
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. Only present if the returned entityType == CountrySubdivision.
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 position.
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:
  • The 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 here. 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.

CountryDefault viewOther available views
ArgentinaARUnified, IL, IN, MA, PK, RU, TR, CN
IndiaIN-
MoroccoMAUnified, AR, IL, IN, PK, RU, TR, CN
PakistanPKUnified, AR, IL, IN, MA, RU, TR, CN
RussiaRUUnified, AR, IL, IN, MA, PK, TR, CN
TurkeyTRUnified, AR, IL, IN, MA, PK, RU, CN
ChinaCNUnified, AR, IL, IN, MA, PK, RU, TR
OthersUnifiedAR, 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.

CodeMeaning & possible causes
200OK The search successfully returned zero or more results.
400Bad request: One or more parameters were incorrectly specified.
403Forbidden: Possible causes include,
  • Service requires SSL
  • Not authorized
  • Over QPS (Queries per second), or over QPD (Queries per day)
  • Unknown referer
405Method Not Allowed: The HTTP method (GET, POST, etc.) is not supported for this request.
404/596Not Found: The HTTP request method (GET, POST, etc.) or path is incorrect.
429Too Many requests: The API Key is over QPS (Queries per second).
5xxServer 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.

HeaderDescription
Access-Control-Allow-OriginEnsures 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-TypeIndicates 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-EncodingThe Reverse Geocode service applies gzip compression to the responses if requested by the client with the Accept-Encoding header.
Value: gzip
Tracking-IDAn 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 fieldsDescription
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 codeDescription
BadRequest

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

Forbidden

The code for requests which ended with HTTP 403 Forbidden.

InternalServerErrorThe code for requests which ended with HTTP 500 Internal Server Error. The service cannot handle the request right now, an unexpected condition was encountered.
ServerTimeoutThe code for requests which ended with HTTP 504 Gateway Timeout. The service cannot handle the request right now, this is certainly a temporary state.