Structured Geocode
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. 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
https://{baseURL}/search/{versionNumber}/structuredGeocode.{ext}?key={Your_API_Key}&countryCode={countryCode}&limit={limit}&ofss={ofss}&streetNumber={streetNumber}&streetName={streetName}&crossStreet={crossStreet}&municipality={municipality}&municipalitySubdivision={municipalitySubdivision}&countryTertiarySubdivision={countryTertiarySubdivision}&countrySecondarySubdivision={countrySecondarySubdivision}&countrySubdivision={countrySubdivision}&postalCode={postalCode}&language={language}&extendedPostalCodesFor={extendedPostalCodesFor}&view={view}&mapcodes={mapcodes}&entityTypeSet={entityTypeSet}
URL request example
https://api.tomtom.com/search/2/structuredGeocode.json?key={Your_API_Key}&streetName=De%20Ruijterkade&streetNumber=154&postalCode=1011%20AC&municipality=Amsterdam&countryCode=NL
curl command request example
curl 'https://api.tomtom.com/search/2/structuredGeocode.json?key={Your_API_Key}&streetName=De%20Ruijterkade&streetNumber=154&postalCode=1011%20AC&municipality=Amsterdam&countryCode=NL'
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.
- The order of request parameters is not important.
Required parameters | Description |
---|---|
| Base URL for calling the API. Values:
|
| Service version number.
Value: The current value is |
| Endpoint name.
Value: |
| A valid response format:
Values: |
| An API Key valid for the requested service.
Value: Your valid |
| The code of the country being targeted. Value: A country code (Note: This is a two-letter code, not a country name.) |
Optional parameters | Description |
---|---|
| The maximum number of responses that will be returned.
Default value: |
| The starting offset of the returned results within the full result set.
Default value: |
| The street number for the structured address. Value: A street number. |
| The street name for the structured address. Value: A street name. |
| The cross street name for the structured address. Value: A cross street name. |
| The municipality (city/town) for the structured address. Value: A municipality. |
| The municipality subdivision (sub/super city) for the structured address. Value: A municipality subdivision. |
| The named area for the structured address. Value: A country tertiary subdivision. |
| The county for the structured address. Value: A country name. |
| The state or province for the structured address. Value: A country subdivision. |
| The zip code or postal code for the structured address. Value: A zip or postal code. |
| Language in which search results should be returned. It should be one of the TomTom IETF Supported Language Tags , case insensitive. When data in the specified language is not available for a specific field or the language is not specified, the language best matched with your query is used. Value: A TomTom IETF Supported Language Tag. |
| Indexes for which extended postal codes should be included in the
results. Available values are described in the additional information
indexes Indexes abbreviated 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. Extended postal code is
returned as an
|
| Geopolitical View. The context used to resolve the handling of disputed
territories. Views include
|
| A comma-separated list of entity types which can be used to restrict the
result to the Geography result of a specific entity type. If
Usage examples:
|
Request headers
Optional headers | Description |
---|---|
Accept-Encoding | Enables response compression.
Value: |
Tracking-ID | Specifies an identifier for the request.
Value: An |
Default view mapping
Default view is recognized based on the country the request came from.
Country | Default and available views |
---|---|
Argentina | Default view: |
India | Default view: |
Morocco | Default view: |
Pakistan | Default view: |
Russia | Default view: |
Turkey | Default view: |
Others | Default view: |
| Enables the return of a comma-separated mapcodes list. It can also filter the response to only show selected mapcode types. See mapcodes in the response. Values: One or more of:
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. Usage examples:
|
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:
1{2 "summary": {3 "query": "2501 soquel dr",4 "queryType": "NON_NEAR",5 "queryTime": 21,6 "numResults": 1,7 "offset": 0,8 "totalResults": 1,9 "fuzzyLevel": 110 },11 "results": []12}
Each element of the results
array is in the following format:
1{2 "type": "Point Address",3 "id": "SQF91UuzwGuL5IYUJ80ycA",4 "score": 7.675,5 "matchConfidence": {6 "score": 17 },8 "address": {9 "streetNumber": "2501",10 "streetName": "Soquel Dr",11 "municipalitySubdivision": "Santa Cruz, Live Oak",12 "municipality": "Santa Cruz, Live Oak",13 "countrySecondarySubdivision": "Santa Cruz",14 "countryTertiarySubdivision": "Santa Cruz",15 "countrySubdivision": "CA",16 "postalCode": "95065",17 "extendedPostalCode": "950652023",18 "countryCode": "US",19 "country": "United States Of America",20 "countryCodeISO3": "USA",21 "freeformAddress": "2501 Soquel Dr, Santa Cruz, CA 95065",22 "countrySubdivisionName": "California",23 "localName": "Santa Cruz"24 },25 "position": {26 "lat": 36.98844,27 "lon": -121.9748228 },29 "mapcodes": [30 {31 "type": "Local",32 "fullMapcode": "US-CA FS.WRH3",33 "territory": "US-CA",34 "code": "FS.WRH3"35 },36 {37 "type": "International",38 "fullMapcode": "S4ZW4.990V"39 },40 {41 "type": "Alternative",42 "fullMapcode": "US-CA 4349.S8W",43 "territory": "US-CA",44 "code": "4349.S8W"45 },46 {47 "type": "Alternative",48 "fullMapcode": "US-CA JJCH.H9DF",49 "territory": "US-CA",50 "code": "JJCH.H9DF"51 },52 {53 "type": "Alternative",54 "fullMapcode": "USA JJCH.H9DF",55 "territory": "USA",56 "code": "JJCH.H9DF"57 }58 ],59 "viewport": {60 "topLeftPoint": {61 "lat": 36.98934,62 "lon": -121.9759563 },64 "btmRightPoint": {65 "lat": 36.98754,66 "lon": -121.9736967 }68 },69 "entryPoints": [70 {71 "type": "main",72 "position": {73 "lat": 36.98817,74 "lon": -121.9748775 }76 }77 ],78 "addressRanges": {79 "rangeLeft": "1 - 99",80 "rangeRight": "2 - 130",81 "from": {82 "lat": 37.33666,83 "lon": -121.8895184 },85 "to": {86 "lat": 37.338,87 "lon": -121.8904988 }89 },90 "dataSources": {91 "geometry": {92 "id": "0000504c-3200-4600-0000-0000478d98c6"93 }94 }95}
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 information about the search that was performed. summary object |
| The result list, sorted in descending order by score. results array |
summary object | |
Field | Description |
| Query as interpreted by the search engine. |
| Response type. Can be
|
| Time spent on resolving the query. |
| The number of results in the response. |
| The starting offset of the returned results within the full result set. |
| The total number of results found. |
| The maximum fuzzy level required to provide results. |
| The position used to bias the results: Latitude,Longitude LatLon |
results array | |
Field | Description |
| Type of result. Value: One of:
|
| The non-stable unique id for this result. |
| The score of the result. A larger score means there is a probability that a result meeting the query criteria is higher.
|
object | The confidence of the result's textual match with the query. matchConfidence object |
| Unit: meters. This is the distance to an object if |
| The structured address for the result. |
| The position of the result: Latitude,Longitude. LatLon |
| List of |
| A viewport which can be used to display the result on a map. viewport object |
| Optional section. Only present if type == Geography. A bounding box which can be used to display the result on a map defined by minimum and maximum longitudes and latitudes. boundingBox object |
| The list of entry points of the POI. entryPoints array |
| Address ranges on a street segment. Available only for results where the result type is equal to "Address Range". addressRanges object |
| Optional section. Reference unique ids for use with the Additional Data service. dataSources object |
address object | |
Field | Description |
| The building number on the street. |
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. |
| The street name. |
| Sub / Super City |
| City / Town |
| County |
| Named Area |
| State or Province |
| Postal Code / Zip Code |
| 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. Note: This field only appears for geographies having |
| Extended postal code (availability dependent on region). |
| Country |
| Country name |
| ISO alpha-3 country code |
| An address line formatted according to the formatting rules of the
result's country of origin. In the case of countries, its full
country name. For the USA, in the case of geographies with |
| The full name of the first level of a country administrative hierarchy.
This field appears only in case |
|
|
| 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. |
matchConfidence object | |
Field | Description |
double | Represents the overall textual match score, in the range of [0..1], where 1 means a perfect match and 0 - no match. Example:
|
mapcodes object | |
Field | Description |
| Type of mapcode:
|
| The full form of a mapcode ( |
| The
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 |
| The mapcode without the |
viewport object | |
Field | Description |
| Top-left corner of the rectangle: LatLon |
| Bottom-right corner of the rectangle: LatLon |
boundingBox object | |
Field | Description |
| Top-left position of the bounding box: LatLon |
| Bottom-right position of the bounding box: LatLon |
entryPoints array | |
Field | Description |
| The main entry point. One of:
|
| If present, represents the type of access for the POI.
Example: |
| Position of the entry point: LatLon |
addressRanges object | |
Field | Description |
| An address range on the left side of a street segment (assuming looking from the "from" end toward the "to" end). |
| An address range on the right side of a street segment (assuming looking from the "from" end toward the "to" end). |
| The beginning point of a street segment: Latitude, Longitude: LatLon |
| An end point of a street segment: Latitude, Longitude LatLon |
dataSources object | |
Field | Description |
| Information about the geometric shape of the result. Only present if |
geometry object | |
Field | Description |
| Pass this as |
LatLon float | |
Field | Description |
| Latitude. min/max: -90 to +90 Reference: Latitude, Longitude, and Coordinate System Grids |
| Longitude. min/max: -180 to +180 Reference: Latitude, Longitude, and Coordinate System Grids |
Response codes
The following table contains response codes signifying successful and failed requests to an API server.
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:
|
405 | Method Not Allowed: The HTTP method ( |
404/596 | Not Found: The HTTP request method ( |
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 table contains response headers sent back from the 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 |
Content-Type | Indicates the format of the response as chosen by the client.
Format: |
Content-Encoding | If requested by the client, the Search service applies gzip compression
to the responses with the Accept-Encoding header.
Value: |
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 |
Error response
The error response content type depends on the <ext>
parameter.
1{2 "errorText": "Error parsing 'language': Language tag 'en-ES' not supported",3 "detailedError": {4 "code": "BadRequest",5 "message": "Error parsing 'language': Language tag 'en-ES' not supported",6 "target": "language"7 },8 "httpStatusCode": "400"9}
1<?xml version="1.0" encoding="UTF-8"?>2<response>3 <errorText>Error parsing 'language': Language tag 'en-ES' not supported</errorText>4 <detailedError>5 <code>BadRequest</code>6 <message>Error parsing 'language': Language tag 'en-ES' not supported</message>7 <target>language</target>8 </detailedError>9 <httpStatusCode>400</httpStatusCode>10</response>
Error response fields
Primary fields | |
---|---|
Field | Description |
| A human-readable description of the error. |
| Detailed information about the error. detailedError object |
| HTTP response codes signifying failed requests to an API server. |
detailedError object | |
Field | Description |
| One of a server-defined set of error codes. |
| 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. |
| Optional. Target of the particular error. Value: The name of the request parameter causing the error. |
Additional information
Indexes abbreviation values
In some cases a list of indexes can be passed as a parameter to a query, which should be listed with their abbreviations. Available values are:
- Geo: Geographies - areas on map which represent administrative division of a land i.e., country, state, city.
- PAD: Point Addresses - points on map where specific address with street name and number can be found in index, i.e., 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.