Search - Get Search Fuzzy

Free Form Search

Applies to: S0 and S1 pricing tiers.

The basic default API is Free Form Search which handles the most fuzzy of inputs handling any combination of address or POI tokens. This search API is the canonical 'single line search'. The Free Form Search API is a seamless combination of POI search and geocoding. The API can also be weighted with a contextual position (lat./lon. pair), or fully constrained by a coordinate and radius, or it can be executed more generally without any geo biasing anchor point.

We strongly advise you to use the 'countrySet' parameter to specify only the countries for which your application needs coverage, as the default behavior will be to search the entire world, potentially returning unnecessary results.

E.g.: countrySet=US,FR

Please see Search Coverage for a complete list of all the supported countries.

Most Search queries default to maxFuzzyLevel=2 to gain performance and also reduce unusual results. This new default can be overridden as needed per request by passing in the query param maxFuzzyLevel=3 or 4.

GET https://atlas.microsoft.com/search/fuzzy/{format}?api-version=1.0&query={query}
GET https://atlas.microsoft.com/search/fuzzy/{format}?subscription-key={subscription-key}&api-version=1.0&query={query}&typeahead={typeahead}&limit={limit}&ofs={ofs}&countrySet={countrySet}&lat={lat}&lon={lon}&radius={radius}&topLeft={topLeft}&btmRight={btmRight}&language={language}&extendedPostalCodesFor={extendedPostalCodesFor}&minFuzzyLevel={minFuzzyLevel}&maxFuzzyLevel={maxFuzzyLevel}&idxSet={idxSet}

URI Parameters

Name In Required Type Description
format
path True

Desired format of the response. Value can be either json or xml.

minFuzzyLevel
query
  • integer

Maximum fuzzyness level to be used. Default: 2, minimum: 1 and maximum: 4

  • Level 1 has no spell checking.

  • Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to "restaurant."

  • Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" to "mountain view" matching.

  • Level 4 doesn’t add any more spell checking functions.

The search engine will start looking for a match on the level defined by minFuzzyLevel, and will stop searching at the level specified by maxFuzzyLevel.

extendedPostalCodesFor
query
  • string

Indexes for which extended postal codes should be included in the results.

Available indexes are:

Addr = Address ranges

Geo = Geographies

PAD = Point Addresses

POI = Points of Interest

Str = Streets

XStr = Cross Streets (intersections)

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 an extendedPostalCode property of an address. Availability is region-dependent.

language
query
  • string

Language in which search results should be returned. Should be one of supported IETF language tags, case insensitive. When data in specified language is not available for a specific field, default language is used.

Please refer to Supported Languages for details.

btmRight
query
  • string

Bottom right position of the bounding box. E.g. 37.553,-122.453

topLeft
query
  • string

Top left position of the bounding box. E.g. 37.553,-122.453

radius
query
  • number

The radius in meters to for the results to be constrained to the defined area

lon
query
  • number

Longitude where results should be biased. E.g. -121.89

lat
query
  • number

Latitude where results should be biased. E.g. 37.337

countrySet
query
  • array

Comma separated string of country codes, e.g. FR, ES. This will limit the search to the specified countries

ofs
query
  • integer

Starting offset of the returned results within the full result set. Default: 0, minimum: 0 and maximum: 1900

limit
query
  • integer

Maximum number of responses that will be returned. Default: 10, minimum: 1 and maximum: 100

typeahead
query
  • boolean

Boolean. If the typeahead flag is set, the query will be interpreted as a partial input and the search will enter predictive mode

query
query True
  • string

The applicable query string (e.g., "seattle", "pizza"). Can also be specified as a comma separated string composed by latitude followed by longitude (e.g., "47.641268, -122.125679"). Must be properly URL encoded.

api-version
query True
  • string

Version number of Azure Maps API. Current version is 1.0

subscription-key
query
  • string

One of the Azure Maps keys provided from an Azure Map Account. Refer to the subscription-key security definition.

maxFuzzyLevel
query
  • integer

Maximum fuzzyness level to be used. Default: 2, minimum: 1 and maximum: 4

  • Level 1 has no spell checking.

  • Level 2 uses normal n-gram spell checking. For example, query "restrant" can be matched to "restaurant."

  • Level 3 uses sound-like spell checking, and shingle spell checking. Sound-like spell checking is for "rstrnt" to "restaurant" matching. Shingle spell checking is for "mountainview" to "mountain view" matching.

  • Level 4 doesn’t add any more spell checking functions.

The search engine will start looking for a match on the level defined by minFuzzyLevel, and will stop searching at the level specified by maxFuzzyLevel.

idxSet
query
  • array

A comma separated list of indexes which should be utilized for the search. Item order does not matter. Available indexes are: Addr = Address range interpolation, Geo = Geographies, PAD = Point Addresses, POI = Points of interest, Str = Streets, Xstr = Cross Streets (intersections)

Request Header

Name Required Type Description
x-ms-client-id
  • string

Specifies which account is intended for usage in conjunction with the Azure AD security model. It represents a unique ID for the Azure Maps account and can be retrieved from Azure Maps management plane Account API. To use Azure AD security in Azure Maps see the following articles for guidance.

Responses

Name Type Description
200 OK

OK

Media Types: "application/json", "application/xml"

400 Bad Request

Bad request: one or more parameters were incorrectly specified or are mutually exclusive.

Media Types: "application/json", "application/xml"

401 Unauthorized

Access denied due to invalid subscription key or invalid Azure Active Directory bearer token. Make sure to provide a valid key for an active Azure subscription and Maps resource. Otherwise, verify the WWW-Authenticate header for error code and description of the provided AAD bearer token.

Media Types: "application/json", "application/xml"

Headers

  • WWW-Authenticate: string
403 Forbidden

Permission, capacity, or authentication issues.

Media Types: "application/json", "application/xml"

404 Not Found

Not Found: the requested resource could not be found, but it may be available again in the future.

Media Types: "application/json", "application/xml"

500 Internal Server Error

An error occurred while processing the request. Please try again later.

Media Types: "application/json", "application/xml"

Security

azure_auth

These are the Azure Active Directory OAuth2 Flows. When paired with Azure Role Based Access control it can be used to control access to Azure Maps REST APIs. Azure Role based access controls are used to designate access to one or more Azure Maps resource account or sub-resources. Any user, group, or service principal can be granted access via a built in role or a custom role composed of one or more permissions to Azure Maps REST APIs.

To implement scenarios we recommend viewing authentication concepts. In summary, this security definition provides a solution for modeling application(s) via objects capable of access control on specific APIs and scopes.

Note

  • This security definition requires the use of the x-ms-client-id header to indicate which Azure Maps resource the application is requesting access to. This can be acquired from the Maps management API.
  • The Authorization URL is specific to the Azure public cloud instance. Sovereign clouds have unique Authorization URLs and Azure Active directory configurations.
  • The Azure role based access control is configured from the Azure management plane via Azure portal, Powershell, CLI, Azure SDKs, or REST APIs.
  • Usage of the Azure Maps Web SDK allows for configuration based setup of an application for multiple use cases.
  • Currently Azure Active Directory v1.0 tokens are supported.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

subscription-key

This is a shared key which is provisioned when creating an Azure Maps resource through the Azure management plane via Azure portal, Powershell, CLI, Azure SDKs, or REST APIs. With this key, any application is authorized to access all REST APIs. In other words, these can currently be treated as master keys to the account which they are issued for. For publicly exposed applications our recommendation is to use server to server access of Azure Maps REST APIs where this key can be securely stored.

Type: apiKey
In: query

Examples

Search City Seattle

Sample Request

GET https://atlas.microsoft.com/search/fuzzy/json?subscription-key=[subscription-key]&api-version=1.0&query=seattle

Sample Response

{
  "summary": {
    "query": "seattle",
    "queryType": "NON_NEAR",
    "queryTime": 9,
    "numResults": 5,
    "offset": 0,
    "totalResults": 5414,
    "fuzzyLevel": 1
  },
  "results": [
    {
      "type": "Geography",
      "id": "US/GEO/p0/77536",
      "score": 6.135,
      "info": "search:ta:840533000005461-US",
      "entityType": "Municipality",
      "address": {
        "municipality": "Seattle",
        "countrySecondarySubdivision": "King",
        "countrySubdivision": "WA",
        "countryCode": "US",
        "country": "United States Of America",
        "countryCodeISO3": "USA",
        "freeformAddress": "Seattle, WA",
        "countrySubdivisionName": "Washington"
      },
      "position": {
        "lat": 47.60323,
        "lon": -122.33028
      },
      "viewport": {
        "topLeftPoint": {
          "lat": 47.80472,
          "lon": -122.60233
        },
        "btmRightPoint": {
          "lat": 47.30606,
          "lon": -122.12291
        }
      },
      "dataSources": {
        "geometry": {
          "id": "00005557-4100-3c00-0000-0000596ae44e"
        }
      }
    },
    {
      "type": "Geography",
      "id": "MX/GEO/p0/60718",
      "score": 4.5,
      "info": "search:ta:00004d30-3300-2800-0000-0000502b582a-MX",
      "entityType": "MunicipalitySubdivision",
      "address": {
        "municipalitySubdivision": "Seattle",
        "municipality": "Zapopan, Guadalajara",
        "countrySubdivision": "Jalisco",
        "countryCode": "MX",
        "country": "Mexico",
        "countryCodeISO3": "MEX",
        "freeformAddress": "Zapopan"
      },
      "position": {
        "lat": 20.72069,
        "lon": -103.37434
      },
      "viewport": {
        "topLeftPoint": {
          "lat": 20.72301,
          "lon": -103.37591
        },
        "btmRightPoint": {
          "lat": 20.71684,
          "lon": -103.36897
        }
      },
      "dataSources": {
        "geometry": {
          "id": "00004d30-3300-3c00-0000-00002672312a"
        }
      }
    },
    {
      "type": "POI",
      "id": "US/POI/p0/8359211",
      "score": 4.457,
      "info": "search:ta:840539000615260-US",
      "poi": {
        "name": "Seattle Great Wheel",
        "phone": "+(1)-(206)-6238607",
        "url": "seattlegreatwheel.com",
        "categories": [
          "important tourist attraction"
        ],
        "classifications": [
          {
            "code": "IMPORTANT_TOURIST_ATTRACTION",
            "names": [
              {
                "nameLocale": "en-US",
                "name": "important tourist attraction"
              }
            ]
          }
        ]
      },
      "address": {
        "streetNumber": "1301",
        "streetName": "Alaskan Way",
        "municipalitySubdivision": "Seattle, Central Business District",
        "municipality": "Seattle, Times Square",
        "countrySecondarySubdivision": "King",
        "countryTertiarySubdivision": "Seattle",
        "countrySubdivision": "WA",
        "postalCode": "98101",
        "extendedPostalCode": "981012057",
        "countryCode": "US",
        "country": "United States Of America",
        "countryCodeISO3": "USA",
        "freeformAddress": "1301 Alaskan Way, Seattle, WA 98101",
        "countrySubdivisionName": "Washington"
      },
      "position": {
        "lat": 47.60606,
        "lon": -122.34102
      },
      "viewport": {
        "topLeftPoint": {
          "lat": 47.60696,
          "lon": -122.34235
        },
        "btmRightPoint": {
          "lat": 47.60516,
          "lon": -122.33969
        }
      },
      "entryPoints": [
        {
          "type": "main",
          "position": {
            "lat": 47.60622,
            "lon": -122.34066
          }
        }
      ]
    },
    {
      "type": "Geography",
      "id": "US/GEO/p0/77544",
      "score": 4.267,
      "info": "search:ta:840533000005440-US",
      "entityType": "MunicipalitySubdivision",
      "address": {
        "municipalitySubdivision": "South Seattle",
        "municipality": "Seattle, Tukwila",
        "countrySecondarySubdivision": "King",
        "countryTertiarySubdivision": "Seattle",
        "countrySubdivision": "WA",
        "countryCode": "US",
        "country": "United States Of America",
        "countryCodeISO3": "USA",
        "freeformAddress": "Seattle, WA",
        "countrySubdivisionName": "Washington"
      },
      "position": {
        "lat": 47.56352,
        "lon": -122.31351
      },
      "viewport": {
        "topLeftPoint": {
          "lat": 47.56534,
          "lon": -122.31487
        },
        "btmRightPoint": {
          "lat": 47.56168,
          "lon": -122.31341
        }
      },
      "dataSources": {
        "geometry": {
          "id": "00005557-4100-4600-0000-00004788ab58"
        }
      }
    },
    {
      "type": "Geography",
      "id": "US/GEO/p0/78678",
      "score": 4.267,
      "info": "search:ta:840533000011722-US",
      "entityType": "MunicipalitySubdivision",
      "address": {
        "municipalitySubdivision": "Seattle Heights",
        "municipality": "Lynnwood, Brier",
        "countrySecondarySubdivision": "Snohomish",
        "countryTertiarySubdivision": "Edmonds",
        "countrySubdivision": "WA",
        "countryCode": "US",
        "country": "United States Of America",
        "countryCodeISO3": "USA",
        "freeformAddress": "Lynnwood, WA",
        "countrySubdivisionName": "Washington"
      },
      "position": {
        "lat": 47.80679,
        "lon": -122.32191
      },
      "viewport": {
        "topLeftPoint": {
          "lat": 47.80861,
          "lon": -122.3233
        },
        "btmRightPoint": {
          "lat": 47.80497,
          "lon": -122.32191
        }
      },
      "dataSources": {
        "geometry": {
          "id": "00005557-4100-4600-0000-00004788ab2c"
        }
      }
    }
  ]
}
{
  "error": {
    "code": "400 BadRequest",
    "message": "Bad request: one or more parameters were incorrectly specified or are mutually exclusive."
  }
}
{
  "error": {
    "code": "401 Unauthorized",
    "message": "Access denied due to invalid subscription key. Make sure to provide a valid key for an active subscription."
  }
}
{
  "error": {
    "code": "403 Forbidden",
    "message": "Permission, capacity, or authentication issues."
  }
}
{
  "error": {
    "code": "404 NotFound",
    "message": "Not Found: the requested resource could not be found, but it may be available again in the future."
  }
}
{
  "error": {
    "code": "500 InternalServerError",
    "message": "An error occurred while processing the request. Please try again later."
  }
}

Definitions

CoordinateAbbreviated

A location represented as a latitude and longitude.

DataSources

Optional section. Reference ids for use with the Get Search Polygon API.

DataSourcesGeometry

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

EntityType

Defines geography entity types.

Error

This object is returned when an error occurs in the Maps API

ErrorResponse

This response object is returned when an error occurs in the Maps API

SearchFuzzyResponse

This object is returned from a successful Search Fuzzy call

SearchFuzzyResult
SearchFuzzySummary

Summary object for a Search Fuzzy response

SearchResultAddress

The address of the result

SearchResultAddressRanges

Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included.

SearchResultEntryPoint

The entry point for the POI being returned.

SearchResultPoi

Details of the poi including the name, phone, url, and categories.

SearchResultPoiClassification

The classification for the POI being returned

SearchResultPoiClassificationName

Name for the classification

SearchResultViewport

The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport.

TextFormat

Desired format of the response. Value can be either json or xml.

CoordinateAbbreviated

A location represented as a latitude and longitude.

Name Type Description
lat
  • number

Latitude property

lon
  • number

Longitude property

DataSources

Optional section. Reference ids for use with the Get Search Polygon API.

Name Type Description
geometry

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

DataSourcesGeometry

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

Name Type Description
id
  • string

Pass this as geometryId to the Get Search Polygon API to fetch geometry information for this result.

EntityType

Defines geography entity types.

Name Type Description
Country
  • string

Country name

CountrySecondarySubdivision
  • string

County

CountrySubdivision
  • string

State or Province

CountryTertiarySubdivision
  • string

Named Area

Municipality
  • string

City / Town

MunicipalitySubdivision
  • string

Sub / Super City

Neighbourhood
  • string

Neighbourhood

PostalCodeArea
  • string

Postal Code / Zip Code

Error

This object is returned when an error occurs in the Maps API

Name Type Description
code
  • string

The HTTP status code.

message
  • string

If available, a human readable description of the error.

ErrorResponse

This response object is returned when an error occurs in the Maps API

Name Type Description
error

This object is returned when an error occurs in the Maps API

SearchFuzzyResponse

This object is returned from a successful Search Fuzzy call

Name Type Description
results

Results array

summary

Summary object for a Search Fuzzy response

SearchFuzzyResult

Name Type Description
address

The address of the result

addressRanges

Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included.

dataSources

Optional section. Reference ids for use with the Get Search Polygon API.

entityType

Defines geography entity types.

entryPoints

Entry Points array

id
  • string

Id property

info
  • string

Info property

poi

Details of the poi including the name, phone, url, and categories.

position

A location represented as a latitude and longitude.

score
  • number

The value within a result set to indicate the relative matching score between results. You can use this to determine that result x is twice as likely to be as relevant as result y if the value of x is 2x the value of y. The values vary between queries and is only meant as a relative value for one result set.

type
  • string

One of:

  • POI
  • Street
  • Geography
  • Point Address
  • Address Range
  • Cross Street
viewport

The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport.

SearchFuzzySummary

Summary object for a Search Fuzzy response

Name Type Description
fuzzyLevel
  • integer

FuzzyLevel property

numResults
  • integer

NumResults property

offset
  • integer

Offset property

query
  • string

Query property

queryTime
  • integer

QueryTime property

queryType
  • string

QueryType property

totalResults
  • integer

TotalResults property

SearchResultAddress

The address of the result

Name Type Description
buildingNumber
  • string

Building Number property

country
  • string

Country property

countryCode
  • string

Country Code property

countryCodeISO3
  • string

Country Code ISO3 property

countrySecondarySubdivision
  • string

Country Secondary Subdivision property

countrySubdivision
  • string

Country Subdivision property

countrySubdivisionName
  • string

Country Subdividion Name property

countryTertiarySubdivision
  • string

Country Tertiary Subdivision property

crossStreet
  • string

Cross Street property

extendedPostalCode
  • string

Extended Postal Code property

freeformAddress
  • string

Free form Address property

municipality
  • string

Municipality property

municipalitySubdivision
  • string

Municipality Subdivision property

postalCode
  • string

Postal Code property

routeNumbers
  • integer[]

number of routes

street
  • string

Street property

streetName
  • string

Street Name property

streetNameAndNumber
  • string

Street Name and Number property

streetNumber
  • string

Street Number property

SearchResultAddressRanges

Describes the address range on both sides of the street for a search result. Coordinates for the start and end locations of the address range are included.

Name Type Description
from

A location represented as a latitude and longitude.

rangeLeft
  • string
rangeRight
  • string
to

A location represented as a latitude and longitude.

SearchResultEntryPoint

The entry point for the POI being returned.

Name Type Description
position

A location represented as a latitude and longitude.

type enum:
  • main
  • minor

The type of entry point. Value can be either main or minor.

SearchResultPoi

Details of the poi including the name, phone, url, and categories.

Name Type Description
categories
  • string[]

[Deprecated] Use classifications instead. Categories array

classifications

Classification array

name
  • string

Name property

phone
  • string

Phone property

url
  • string

URL property

SearchResultPoiClassification

The classification for the POI being returned

Name Type Description
code
  • string

Code property

names

Names array

SearchResultPoiClassificationName

Name for the classification

Name Type Description
name
  • string

Name property

nameLocale
  • string

Name Locale property

SearchResultViewport

The viewport that covers the result represented by the top-left and bottom-right coordinates of the viewport.

Name Type Description
btmRightPoint

A location represented as a latitude and longitude.

topLeftPoint

A location represented as a latitude and longitude.

TextFormat

Desired format of the response. Value can be either json or xml.

Name Type Description
json
  • string

The JavaScript Object Notation Data Interchange Format

xml
  • string

The Extensible Markup Language