Suggest Address

This endpoint returns suggestions of addresses in a specific country given certain search parameters - usually used for "autocomplete" purposes to help a user type a valid address into a form/input field.

Endpoint URL

GET https://app-api.geposit.se/v2.0/suggest/address/{COUNTRY_CODE}

{COUNTRY_CODE} is se, no, dk, fi or ax. Authentication, response status and permissions are described in Valid Intro. Full reference: Suggest Address.

Parameters

Query parameterDescription
queryRequired (unless group_path is used). What the user has typed so far. Example: query=Drottninggatan 4
max_rowsMaximum number of suggestions, 1 to 100. Default 20. A higher value returns "status": 400.
response_formatjson (default), xml or text.
postcodeOnly addresses in this postcode. A trailing * matches the start: postcode=114*.
localityOnly addresses in this locality. A trailing * matches the start: locality=Fal*.
street_numberOnly this street number. Example: query=Storgatan&street_number=12
street_number_prefixtrue also returns street numbers that start with street_number: 1 then matches 1, 10, 11, 100 … Default false.
letterOnly this letter. Example: query=Storgatan&street_number=12&letter=A
extra_numberOnly this secondary street number.
grouptrue returns one suggestion per street and postcode, with a group_path and a group_count, instead of one per address. See Grouping.
group_pathWith group=true: the group_path of a group, to list the addresses in it.
administrativetrue adds administrative divisions. Needs a permission.
coordinatetrue adds latitude and longitude. Needs a permission.
property_designationtrue adds the property designation, Sweden. Needs a permission.
uuidtrue adds the address's unique id, Sweden only. Needs a permission.
desotrue adds deso_code, Sweden. Needs a permission.
regsotrue adds regso_code and regso_name, Sweden. Needs a permission.
neighborhoodtrue adds neighborhood_1_name and neighborhood_2_name. Needs a permission.

A request without query (and without group_path) is answered with HTTP 400 and "status": 400.

Response

KeyTypeDescription
versionStringAPI version
response_timeFloatProcessing time in seconds
queryObjectThe parameters as received
interpretationObjectHow query was parsed: street, street_number, letter, postcode, locality
statusInteger302 one suggestion, 300 several, 404 none, 400 bad request (with status_text)
suggestionsArrayThe suggested addresses

Suggestion object

Empty fields are left out.

KeyTypeDescription
address_typeStringSee Address types
streetStringStreet name
street_numberStringStreet number
letterStringLetter of the street number
extra_numberStringSecondary street number
postcodeStringPostcode
localityStringLocality
group_path, group_countString, IntegerWith group=true: the group's id and the number of addresses in it
adm1_code … adm5_code, adm1_name … adm5_nameStringWith administrative=true
latitude, longitudeFloatWith coordinate=true
property_designation, uuid, deso_code, regso_code, regso_name, neighborhood_1_name, neighborhood_2_nameStringWith the matching parameter

With response_format=text each suggestion is one line: street;street_number;extra_number;letter;postcode;locality.

Finland

Suggest Address finds Finnish addresses by their Finnish and their Swedish names: query=Mannerheimvägen 1 returns Mannerheimvägen … Helsingfors. Note that Validate Address only accepts the Finnish names.

Examples

Autocomplete

curl -G https://app-api.geposit.se/v2.0/suggest/address/se \
  -H "x-api-key: {API_KEY}" \
  --data-urlencode "query=Drottninggatan 4" \
  --data-urlencode "locality=Stockholm"
{
  "version": "2.0",
  "response_time": 0.0037,
  "query": {
    "query": "Drottninggatan 4",
    "locality": "Stockholm"
  },
  "interpretation": {
    "street": "Drottninggatan",
    "street_number": "4",
    "locality": "Stockholm"
  },
  "status": 302,
  "suggestions": [
    {
      "address_type": "NB",
      "street": "Drottninggatan",
      "street_number": "4",
      "postcode": "11151",
      "locality": "Stockholm"
    }
  ]
}

Text format

curl -G https://app-api.geposit.se/v2.0/suggest/address/se \
  -H "x-api-key: {API_KEY}" \
  --data-urlencode "query=Drottningg" \
  --data-urlencode "max_rows=3" \
  --data-urlencode "response_format=text"
Drottninggatan;45;;;11121;Stockholm
Drottninggatan;45;;T;11121;Stockholm
Drottninggatan;50;;;11121;Stockholm

Grouping

For rural areas with many addresses on one street, grouping lets the user pick the street first. Ask for groups:

curl -G https://app-api.geposit.se/v2.0/suggest/address/se \
  -H "x-api-key: {API_KEY}" \
  --data-urlencode "query=Aa" \
  --data-urlencode "group=true"
{
  "status": 300,
  "suggestions": [
    {
      "address_type": "NC",
      "street": "Aapuajoki",
      "postcode": "95794",
      "locality": "Övertorneå",
      "group_path": "lps|Övertorneå|95794|Aapuajoki",
      "group_count": 110
    },
    {
      "address_type": "NC",
      "street": "Aareavaara",
      "postcode": "98491",
      "locality": "Pajala",
      "group_path": "lps|Pajala|98491|Aareavaara",
      "group_count": 70
    }
  ]
}

Then list the addresses in the group the user picked. Send group=true together with its group_path:

curl -G https://app-api.geposit.se/v2.0/suggest/address/se \
  -H "x-api-key: {API_KEY}" \
  --data-urlencode "query=Aa" \
  --data-urlencode "group=true" \
  --data-urlencode "group_path=lps|Pajala|98491|Aareavaara"
{
  "status": 300,
  "suggestions": [
    {
      "address_type": "NC",
      "street": "Aareavaara",
      "street_number": "3",
      "postcode": "98491",
      "locality": "Pajala",
      "group_path": "lpsn|Pajala|98491|Aareavaara|3|"
    },
    {
      "address_type": "NC",
      "street": "Aareavaara",
      "street_number": "6",
      "postcode": "98491",
      "locality": "Pajala",
      "group_path": "lpsn|Pajala|98491|Aareavaara|6|"
    }
  ]
}

(version, response_time, query and interpretation left out, and the lists shortened.)


Did this page help you?