oslew docs
Console
Menu

GeocodingsearchoperationId autocomplete

GET/v1/autocomplete

Complete text being typed: the last token is a prefix, prominence ranks before name length, and no confidence is claimed.

Send Authorization: Bearer sk_live_…. The key's plan must include thesearch product; which plans do.

Explained in Autocomplete and An address form.

Example

A name being typed, near the user.

curl
curl -G "https://api.oslew.com/v1/autocomplete" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'q=Museo Sou' \
  --data-urlencode 'near=19.4406,-99.2047' \
  --data-urlencode 'limit=5'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.autocomplete("Museo Sou", near="19.4406,-99.2047", limit=5)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.autocomplete("Museo Sou", { near: "19.4406,-99.2047", limit: 5 });
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1

{
  "query": "Museo Sou",
  "name": "Museo Sou",
  "context": null,
  "near": [
    19.4406,
    -99.2047
  ],
  "results": [
    {
      "doc": 348329,
      "name": "Museo Soumaya",
      "lat": 19.44062110346353,
      "lon": -99.20465953606559,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Miguel Hidalgo",
        "region": "CMX",
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 2,
      "extra": 0,
      "prominence": 5,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 348400,
      "name": "Museo Jumex",
      "lat": 19.440393312940376,
      "lon": -99.20370756260536,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Miguel Hidalgo",
        "region": "CMX",
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 1,
      "prominence": 2,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 365706,
      "name": "Soundspeedmx",
      "lat": 19.493992651778623,
      "lon": -99.24491233766965,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Naucalpan de Juárez",
        "region": null,
        "country": "MX",
        "category": "storage_facility",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 0,
      "prominence": 0,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 1930310,
      "name": "CALLE SOL",
      "lat": 19.451611114473653,
      "lon": -99.24551844723197,
      "precision": "street",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "México",
        "region": null,
        "country": "MX",
        "category": null,
        "postcode": "53570",
        "street": "CALLE SOL"
      },
      "matched": 1,
      "extra": 1,
      "prominence": 0,
      "provenance": {
        "name": "overture-addresses",
        "release": "2026-08-19.0",
        "license": "permissive (per-source, see record)"
      }
    },
    {
      "doc": 1930317,
      "name": "CALLE SOL",
      "lat": 19.45169432510208,
      "lon": -99.2456916222276,
      "precision": "street",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "México",
        "region": null,
        "country": "MX",
        "category": null,
        "postcode": "53570",
        "street": "CALLE SOL"
      },
      "matched": 1,
      "extra": 1,
      "prominence": 0,
      "provenance": {
        "name": "overture-addresses",
        "release": "2026-08-19.0",
        "license": "permissive (per-source, see record)"
      }
    }
  ],
  "mode": "all",
  "examined": 316,
  "postings": 42,
  "segments": 2,
  "took_us": 1399
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Query

NameTypeDescription
q
queryrequired
string
Text being typed; everything after the last comma is administrative context. A trailing space marks the last token finished.
near
query
string
lat,lon; constrains to roughly a city around it.
stream
query
boolean
Emit application/x-ndjson one completion per line; also triggered by Accept: application/x-ndjson.
limit
query
integer
≥ 1, ≤ 50
default 5

Responses

200 — Best first.

  • contextstring | nullrequired
  • examinedintegerrequired
  • modeMatchModerequired
    fuzzy is an edit-distance or split salvage and never all.
    all | partial | fuzzy | none
  • namestringrequired
  • nearnumber[] | nullrequired
  • postingsintegerrequired
  • querystringrequired
  • resultsCompletion[]required
    • docintegerrequired
    • extraintegerrequired
    • hierarchyContextrequired
      • categorystring | null
      • countrystring | null
      • localitystring | null
      • postcodestring | null
      • regionstring | null
      • streetstring | null
    • latnumberrequired
    • lonnumberrequired
    • matchedintegerrequired
      Query tokens the name matched, the typed prefix counting as one.
    • namestringrequired
    • precisionPrecisionrequired
      What the position locates, finest first. rooftop is an address point with a house number, as its source recorded it — never a building footprint we snapped to, which would contaminate the permissive bundle. interpolated is a point placed between the two recorded numbers that bracket the one asked for, which is what Google calls RANGE_INTERPOLATED. street is an address row with no number to place along it. precision_m carries the honest radius alongside: the label says what was matched, the metres say how wrong it can be.
      rooftop | interpolated | address | street | postcode | locality | region | country | poi
    • precision_mnumberrequired
    • prominenceintegerrequired≥ 0, ≤ 15
      Ranked before extra tokens for a completion.
    • provenanceSourcerequired
      • licensestringrequired
      • namestringrequired
      • releasestringrequired
  • segmentsintegerrequired
  • took_usintegerrequired

With RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset(and their X-RateLimit-* aliases); see rate limits.

Refusals

Every refusal is a JSON object with an error string, except where noted.

400Bad request.
401No key, or one that is unknown, revoked or suspended.
403The key's plan does not include this route's product, or the request is larger than the plan allows. The body names the plan that does.
429This product's bucket is empty: the key is going faster than its plan's sustained rate. Wait Retry-After seconds; nothing is used up. Carries Retry-After.
503The pod cannot reach the control plane and its entitlements are too old to trust. Retry.

A malformed query string or JSON body is refused by the framework before this route runs, in plain text rather than JSON; see errors.

More examples

A trailing space marks the last word finished
curl
curl -G "https://api.oslew.com/v1/autocomplete" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'q=Museo ' \
  --data-urlencode 'near=19.4406,-99.2047' \
  --data-urlencode 'limit=5'
Python
from oslew import Client

# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")

answer = client.autocomplete("Museo ", near="19.4406,-99.2047", limit=5)
TypeScript
import { Client } from "@oslew/client";

// The key is read from GEO_API_KEY.
const client = new Client({ baseUrl: "https://api.oslew.com" });

const answer = await client.autocomplete("Museo ", { near: "19.4406,-99.2047", limit: 5 });
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 298
ratelimit-reset: 1

{
  "query": "Museo ",
  "name": "Museo",
  "context": null,
  "near": [
    19.4406,
    -99.2047
  ],
  "results": [
    {
      "doc": 348329,
      "name": "Museo Soumaya",
      "lat": 19.44062110346353,
      "lon": -99.20465953606559,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Miguel Hidalgo",
        "region": "CMX",
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 1,
      "prominence": 5,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 348400,
      "name": "Museo Jumex",
      "lat": 19.440393312940376,
      "lon": -99.20370756260536,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Miguel Hidalgo",
        "region": "CMX",
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 1,
      "prominence": 2,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 363808,
      "name": "Museo Tlatilca",
      "lat": 19.47909264584034,
      "lon": -99.23201194126051,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Naucalpan de Juárez",
        "region": null,
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 1,
      "prominence": 0,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 356964,
      "name": "Museo Tezozómoc",
      "lat": 19.496763243826795,
      "lon": -99.20690969990365,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Azcapotzalco",
        "region": "CMX",
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 1,
      "prominence": 0,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    },
    {
      "doc": 346752,
      "name": "Museo Autoservicio",
      "lat": 19.443274519618697,
      "lon": -99.19955362835819,
      "precision": "poi",
      "precision_m": 6.756173533775122,
      "hierarchy": {
        "locality": "Miguel Hidalgo",
        "region": "CMX",
        "country": "MX",
        "category": "museum",
        "postcode": null,
        "street": null
      },
      "matched": 1,
      "extra": 1,
      "prominence": 0,
      "provenance": {
        "name": "overture-places",
        "release": "2026-08-19.0",
        "license": "CDLA-Permissive-2.0"
      }
    }
  ],
  "mode": "all",
  "examined": 24,
  "postings": 24,
  "segments": 2,
  "took_us": 1336
}

A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.

Rendered from the OpenAPI document at commit b8f4bde-dirty; the same document is served at/v1/openapi.json and generates both clients.