Geocoding

Autocomplete

Returns address and place suggestions for partially typed text, limited to the US and Canada.

Signed in? Open this endpoint in the dashboard playground, which uses your organization automatically. Signed out, use Try in Playground below with your API key.

GET
/geocode/autocomplete

Authorization

queryapiKey<token>

Your API key from the dashboard, sent as ?apiKey=<key>.

Query Parameters

text*string

Partial address or place name to autocomplete.

Length1 <= length <= 1024
type?string

Requested location type. Values country, state, city and street also constrain the Photon layer; postcode and amenity filter results after the search.

Not supported: locality (accepted by Geoapify) is rejected with 400.

Value in"country""state""city""postcode""street""amenity"
lang?string

Result language (ISO 639-1; case-insensitive). Default en.

Deviation (approximated): only en, de, fr and it change the result language (Photon); every other accepted value is treated as the default.

Default"en"
Value in"ab""aa""af""ak""sq""am""ar""an""hy""as""av""ae""ay""az""bm""ba""eu""be""bn""bh""bi""bs""br""bg""my""ca""ch""ce""ny""zh""cv""kw""co""cr""hr""cs""da""dv""nl""en""eo""et""ee""fo""fj""fi""fr""ff""gl""ka""de""el""gn""gu""ht""ha""he""hz""hi""ho""hu""ia""id""ie""ga""ig""ik""io""is""it""iu""ja""jv""kl""kn""kr""ks""kk""km""ki""rw""ky""kv""kg""ko""ku""kj""la""lb""lg""li""ln""lo""lt""lu""lv""gv""mk""mg""ms""ml""mt""mi""mr""mh""mn""na""nv""nb""nd""ne""ng""nn""no""ii""nr""oc""oj""cu""om""or""os""pa""pi""fa""pl""ps""pt""qu""rm""rn""ro""ru""sa""sc""sd""se""sm""sg""sr""gd""sn""si""sk""sl""so""st""es""su""sw""ss""sv""ta""te""tg""th""ti""bo""tk""tl""tn""to""tr""ts""tt""tw""ty""ug""uk""ur""uz""ve""vi""vo""wa""cy""wo""fy""xh""yi""yo""za"
limit?integer

Maximum number of results (1 to 100). Default 5.

Range1 <= value <= 100
Default5
countrycodes?array<>

ISO 3166-1 alpha-2 country filter (lower-case, up to 10; repeat the parameter or comma-separate).

Deviation (approximated): the service holds only US and Canada data, so other codes return no results. Default is us,ca.

Items0 <= items <= 10
filter?array<>

Hard result filters, kind:value joined with | or repeated. Kinds: rect:lon1,lat1,lon2,lat2, circle:lon,lat,radiusMeters, countrycode:us,ca (or none/auto), place:<gp:osm Place ID>.

Deviation (extra): place: takes a gp:osm:<n|w|r><id> Place ID and uses its bounding box.

bias?array<>

Ranking bias, kind:value joined with | or repeated. Kinds: proximity:lon,lat, rect:..., circle:lon,lat,radiusMeters, countrycode:us. Proximity and circle centre are also passed to Photon.

format?string

Response serialization: geojson (application/geo+json), json (application/json) or xml (application/xml).

Default"geojson"
Value in"json""geojson""xml"

Response Body

Autocomplete suggestions, in the format requested by format. An empty list is returned when nothing matches.

  1. response
type*unknown
features*array<>
query?

Echo of the request. Autocomplete returns only text (no parsed block).

Example Request
curl -X GET 'https://api.data.graphitelab.ai/v1/geocode/autocomplete?text=350+5th+ave+new+y&type=city&lang=fr&limit=5&countrycodes=us&countrycodes=ca&filter=countrycode%3Aca&bias=proximity%3A-73.99%2C40.75&format=json'
Example Response
{  "results": [    {      "name": "string",      "country": "United States",      "country_code": "us",      "state": "New York",      "state_code": "NY",      "county": "string",      "city": "string",      "postcode": "string",      "street": "string",      "housenumber": "string",      "formatted": "string",      "address_line1": "string",      "address_line2": "string",      "lon": -180,      "lat": -90,      "result_type": "unknown",      "datasource": {        "sourcename": "openstreetmap",        "attribution": "© OpenStreetMap contributors",        "license": "Open Database License",        "url": "https://www.openstreetmap.org/copyright",        "sources": [          {            "sourcename": "string",            "attribution": "string",            "license": "string",            "url": "http://example.com"          }        ]      },      "rank": {        "confidence": 0.95,        "confidence_city_level": 0,        "confidence_street_level": 0,        "confidence_building_level": 0,        "match_type": "full_match"      },      "place_id": "gp:osm:n1234",      "bbox": {        "lon1": 0,        "lat1": 0,        "lon2": 0,        "lat2": 0      }    }  ],  "query": {    "text": "string"  }}

GET /v1/geocode/autocomplete returns ranked suggestions for a partial address or place name. Use it behind a search box while the user is still typing; use forward geocoding once you have a complete address and want the best single match.

How it works

One Engine answers: Photon, the fuzzy prefix-search engine, imported from our Nominatim database. There is no Geocoding Waterfall here.

  1. The gateway sends your text to Photon, asking for up to three times limit candidates (capped at 100). lang (en, de, fr, it only), type (as a Photon layer), bias proximity and the filter bounding box are passed along.
  2. Candidates are filtered to the requested countries (default us,ca), then by type, filter and duplicates.
  3. Each result gets a rank.confidence: the share of the typed text covered by the result's address line. If you pass bias, results are re-sorted by confidence plus a bias bonus.
  4. The list is cut to limit, and each result gets its datasource (see below).

Address Points (house-level addresses from NAD, StatCan NAR and Overture) are injected into the Photon index. Those results have result_type: building and gp:addr:canonical:<id> Place IDs. Everything else comes from OpenStreetMap and has gp:osm:... Place IDs.

Quick start

curl -s "https://api.data.graphitelab.ai/v1/geocode/autocomplete?text=350+5th+ave+new+y&limit=3&apiKey=$GRAPHITE_API_KEY"

Trimmed response (GeoJSON, the default):

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "WSKQ-FM (New York)",
        "country_code": "us",
        "state_code": "NY",
        "city": "New York",
        "postcode": "10118",
        "street": "5th Avenue",
        "housenumber": "350",
        "lon": -73.9856942,
        "lat": 40.7484273,
        "formatted": "350 5th Avenue, New York, NY 10118, United States",
        "result_type": "building",
        "datasource": {
          "sourcename": "openstreetmap",
          "attribution": "© OpenStreetMap contributors",
          "license": "Open Database License"
        },
        "rank": { "confidence": 0.85, "match_type": "full_match" },
        "place_id": "gp:osm:n357606907"
      },
      "geometry": { "type": "Point", "coordinates": [-73.9856942, 40.7484273] }
    }
  ],
  "query": { "text": "350 5th ave new y" }
}

Parameters

NameTypeRequiredWhat it does
textstring (1 to 1024 chars)yesPartial address or place name to autocomplete.
typeenum: country, state, city, postcode, street, amenitynoRequested location type. country, state, city and street also constrain the Photon layer; postcode and amenity filter after the search.
langISO 639-1 code, default ennoResult language. Only en, de, fr and it change the result; other values act as the default.
limitinteger 1 to 100, default 5noMaximum number of results.
countrycodesarray of ISO 3166-1 alpha-2 codes (up to 10)noCountry filter. Default us,ca; other codes return no results.
filterarray of stringsnoHard filters as kind:value, joined with | or repeated. Kinds: rect:lon1,lat1,lon2,lat2, circle:lon,lat,radiusMeters, countrycode:us,ca (or none/auto), place:<gp:osm Place ID>.
biasarray of stringsnoRanking bias without excluding matches. Kinds: proximity:lon,lat, rect:..., circle:lon,lat,radiusMeters, countrycode:us.
formatjson, geojson or xml, default geojsonnoResponse serialization.

Full parameter reference

Response

Each result is a GeoJSON Feature (or an entry in results with format=json). The fields that matter most:

FieldMeaning
place_idGateway Place ID. gp:osm:<n|w|r><id> for OpenStreetMap objects, gp:addr:canonical:<id> for Address Points. Stable across Data Releases while the thing exists.
result_typebuilding, street, city, and so on. House-level hits are building.
datasourceWhere the result came from. OSM results carry "© OpenStreetMap contributors" and the ODbL license. Address Point results list their sources (NAD, NAR, Overture) and each license's attribution.
rank.confidence (and the _city_level, _street_level, _building_level variants)Share of the typed text covered by the result, 0 to 1. The building-level value is 0 for non-building results.
rank.match_typeFor example full_match (a building covering at least 80% of the text), match_by_street, match_by_city_or_disrict (spelled as in Geoapify).
bboxPresent on streets, cities and other area results.
query.textEcho of your text.

rank.importance and rank.popularity are not returned. Fields beyond the response schema (timezone, plus codes, categories) are not returned either.

Differences from Geoapify

  • approximated: rank.confidence* is the share of the typed text covered by the result. importance and popularity are not returned.

  • approximated: lang only changes results for en, de, fr and it; other accepted values behave as the default.

  • approximated: countrycodes only has data for us and ca; other codes return empty results.

  • extra: filter=place:<id> takes a gateway Place ID (gp:osm:<n|w|r><id>, per ADR 0006), not a Geoapify place id, and filters to that OSM object's bounding box.

  • unsupported: type=locality is rejected with 400.

US and Canada notes

  • Results are limited to the United States and Canada. The default countrycodes is us,ca.

  • Canadian results include province names and codes (state, state_code) and full six-character postal codes where the source has them. Use lang=fr for French street and place names, for example "Rue Sainte-Catherine Est" in Montréal.

  • House-level suggestions come from Address Points: NAD in the US, StatCan NAR in Canada, plus Overture. Without a matching Address Point, a house number can still come from OpenStreetMap, as in the quick start.

  • Address Point casing is echoed from the source, so you may see all-caps street names such as PENNSYLVANIA Avenue Northwest.

More examples

French street prefix in Montréal with lang=fr.

curl -s "https://api.data.graphitelab.ai/v1/geocode/autocomplete?text=rue+sainte-catherine+montr&lang=fr&limit=3&apiKey=$GRAPHITE_API_KEY"

Errors and limits

StatusMeaning
400Missing or invalid parameters (no text, text over 1024 characters, type=locality, malformed filter or bias, a place: ID that is not gp:osm:... or not found).
401Missing or invalid API key.
500Unexpected gateway error.
503The Autocomplete Engine (Photon) is unavailable.

Limits: text up to 1024 characters, limit 1 to 100 (default 5), countrycodes up to 10 values. The gateway waits up to 8 seconds for Photon.

Known issues from the Phase 18 live checks: Address Point casing is echoed from the source (for example PENNSYLVANIA Avenue Northwest), and cold Engines right after a deploy can show latency outliers of 6 to 13 seconds. The gp:addr:canonical Place ID path for autocomplete is documented from the code; it was not hit live.

Try in Playground (signed in to your Graphite Lab organization). Signed out, use the paste-your-key widget on the reference page.