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

Structured Geocode

 

Service version: 2.0
Last edit: 2019.02.01

On this page

Purpose

Search can also be exclusively accessed for structured address look up.

  • 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, street, or intersections, and 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

For identification purposes:

  • Required constants and parameters are shown in bold text.
  • Optional parameters are shown in plain text.
https://api.tomtom.com/search/2/structuredGeocode.json?key=*****&countryCode=US &limit=10&ofs=1000&streetNumber=303&streetName=Bryant%20Street&crossStreet=California%20Street &municipality=Mountain%20View&municipalitySubdivision=Lower%20Mountain%20View &countryTertiarySubdivision=Silicon%20Valley&countrySecondarySubdivision=Santa%20Clara &countrySubdivision=California&postalCode=94679&language=en-us&extendedPostalCodesFor=POI

curl command

curl -X GET "https://api.tomtom.com/search/2/structuredGeocode.json?key=*****
  &countryCode=US
  &limit=10
  &ofs=1000
  &streetNumber=303
  &streetName=Bryant%20Street
  &crossStreet=California%20Street
  &municipality=Mountain%20View
  &municipalitySubdivision=Lower%20Mountain%20View
  &countryTertiarySubdivision=Silicon%20Valley
  &countrySecondarySubdivision=Santa%20Clara
  &countrySubdivision=California
  &postalCode=94679
  &language=en-us
  &extendedPostalCodesFor=POI"
-H "accept: */*"

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.
  • A parameter's data type is beneath its name.
  • 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 parameters is not important.
Required
Parameter Description
baseURL
string
The base URL for calling the API.
Value: api.tomtom.com
versionNumber
integer
Service version number.
Value: The current value is 2.
structuredGeocode
string
The query string.
Value: A query string.
ext
string
Valid response formats.
Value: JSON, JSONP, JS, or XML.
key
string
An API Key valid for the requested service.
Value: Your valid API Key.
countryCode
string
The code of the country being targeted.
Value: A country code.
Optional parameters
Parameter Description
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
streetNumber
string
The street number for the structured address.
Value: A street number.
streetName
string
The street name for the structured address.
Value: A street name.
crossStreet
string
The cross street name for the structured address.
Value: A cross street name.
municipality
string
The municipality (city/town) for the structured address.
Value: A municipality.
municipalitySubdivision
string
The municipality subdivision (sub/super city) for the structured address.
Value: A municipality subdivision.
countryTertiarySubdivision
string
The named area for the structured address.
Value: A country tertiary subdivision.
countrySecondarySubdivision
string
The county for the structured address.
Value: A country name.
countrySubdivision
string
The state or province for the structured address.
Value: A country subdivision.
postalCode
string
The zip code or postal code for the structured address.
Value: A zip or postal code.
language
string
Language in which search results should be returned.

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

Value: One of the supported IETF language tags.

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.
  • 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.
  • Extended postal code is returned as an extendedPostalCode property of an address.
  • Availability is region-dependent.

Usage examples:

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

Value: A comma-separated list of index types.

▲ Return to Top

Response data

Response body

For illustrative purposes, the following code examples are 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 section for more information.

When requesting JSON output the Response has the following structure:

{
    "summary": {
        "query": "2501 soquel dr",
        "queryType": "NON_NEAR",
        "queryTime": 21,
        "numResults": 1,
        "offset": 0,
        "totalResults": 1,
        "fuzzyLevel": 1
    },
    "results": []
}

Each element of the results array is in the following format:

{
    "type": "Point Address",
    "id": "US/PAD/p0/45619296",
    "score": 7.675,
    "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.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 - 99",
        "rangeRight": "2 - 130",
        "from": {
            "lat": 37.33666,
            "lon": -121.88951
        },
        "to": {
            "lat": 37.338,
            "lon": -121.89049
        }
    },
    "dataSources": {
        "geometry": {
            "id": "0000504c-3200-4600-0000-0000478d98c6"
        }
    }
}

▲ 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.
  • In the order that they appear in the Response.
Primary fields
Field Description
summary{}
object
Summary information about the search that was performed.
results[]
array
The Result list, sorted in descending order by score.
summary{} object
Field Description
query
string
Query as interpreted by the search engine.
queryType
string
The Response type. See the following response types.
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
results[] array
Field Description
type
string
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.
address
object
The structured address for the Result.
position
object
The position of the Result:
Latitude, Longitude
viewport
object
A viewport which can be used to display the Result on a map.
entrypoints
array
The list of entry points of the POI.
addressRanges
object
Address ranges on a street segment. Available only for Results where the Result type is equal to "Address Range".
dataSources
object
Optional section. Reference unique ids for use with the Additional Data service.
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
Country
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 a country administrative hierarchy.

  • This field appears only in case countrySubdivision is presented in an abbreviated form.
  • Supported only for USA, Canada, and Great Britain.
viewport{} object
Field Description
topLeftPoint
string
Top-left corner of the rectangle: LatLon
btmRightPoint
string
Bottom-right corner of the rectangle: LatLon
entryPoints[] array
Field Description
type
string
Main entry point: One of:

  • main
  • minor
position
string
The position of the entry point: Latitude, Longitude  
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
to
string
An end point of a street segment: Latitude, Longitude
dataSources{} object
Field Description
geometry
object
Information about the geometric shape of the result. Only present if type = = Geography or POI.
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
double
Latitude
lon
double
Longitude

▲ Return to Top

HTTP Response codes

The following 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 the API server.

Response headers
Header Description
Access-Control-Allow-Origin Ensures that clients implementing the CORS security model are able to access the response from this service.
Value: *
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

▲ Return to Top