oslew docs
Console
Menu

Administrative areas

GET /v1/admin?at=lat,lon answers "which country, region, municipality and neighbourhood is this point in": every division whose polygon contains it, outermost first, with the ISO codes to key on. It takes one parameter and reads no text, so there is nothing to misspell and nothing to rank — a point is inside a polygon or it is not.

curl
curl -G "https://api.oslew.com/v1/admin" \
  -H "Authorization: Bearer $GEO_API_KEY" \
  --data-urlencode 'at=19.4326,-99.1332'
Python
from oslew import Client

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

answer = client.admin("19.4326,-99.1332")
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.admin("19.4326,-99.1332");
Response
HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1

{
  "at": [
    19.4326,
    -99.1332
  ],
  "admin": [
    {
      "doc": 2174,
      "id": "7f1f3634-1218-43e7-9538-ac3d1f43fc1c",
      "name": "México",
      "subtype": "country",
      "country": "MX",
      "region": null,
      "admin_level": null,
      "via": "interior",
      "provenance": {
        "name": "overture-divisions",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 61,
      "id": "0831989a-c65b-47db-802e-f930af64b9e4",
      "name": "México",
      "subtype": "country",
      "country": "MX",
      "region": null,
      "admin_level": null,
      "via": "interior",
      "provenance": {
        "name": "overture-divisions-maritime",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 1560,
      "id": "bc8dbc34-544b-47c4-bdb1-d3f5ecfc6af7",
      "name": "Ciudad de México",
      "subtype": "region",
      "country": "MX",
      "region": "MX-CMX",
      "admin_level": 1,
      "via": "boundary",
      "provenance": {
        "name": "overture-divisions",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 1380,
      "id": "b468c7e5-eb6f-44c8-bfeb-c60bce169f25",
      "name": "Cuauhtémoc",
      "subtype": "county",
      "country": "MX",
      "region": "MX-CMX",
      "admin_level": 2,
      "via": "boundary",
      "provenance": {
        "name": "overture-divisions",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 1522,
      "id": "2b1d49e2-98ef-4665-b9f6-1ce96c9f015b",
      "name": "Ciudad de México",
      "subtype": "locality",
      "country": "MX",
      "region": "MX-CMX",
      "admin_level": null,
      "via": "interior",
      "provenance": {
        "name": "overture-divisions",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 1423,
      "id": "96d18adf-e0bb-473c-affc-758969b272e1",
      "name": "Centro",
      "subtype": "neighborhood",
      "country": "MX",
      "region": "MX-CMX",
      "admin_level": null,
      "via": "boundary",
      "provenance": {
        "name": "overture-divisions",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 1417,
      "id": "7fc4847d-082f-4b20-9b65-930f09f6eac3",
      "name": "Plaza de la Constitución",
      "subtype": "microhood",
      "country": "MX",
      "region": "MX-CMX",
      "admin_level": null,
      "via": "boundary",
      "provenance": {
        "name": "overture-divisions",
        "release": "2026-08-19.0",
        "license": "ODbL-1.0"
      }
    },
    {
      "doc": 147,
      "id": "America/Mexico_City",
      "name": "America/Mexico_City",
      "subtype": "timezone",
      "country": null,
      "region": null,
      "admin_level": null,
      "via": "interior",
      "provenance": {
        "name": "timezone-boundary-builder",
        "release": "2026d",
        "license": "ODbL-1.0"
      }
    }
  ],
  "layers": 3,
  "took_us": 55
}

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

Reading the example

The Zócalo, in the centre of Mexico City, has eight entries:

  • México, twice. One comes from the land divisions (overture-divisions), one from the maritime zones (overture-divisions-maritime) that zone crossings use. provenance.name and id tell them apart.
  • Ciudad de México as a region, ISO 3166-2 MX-CMX, admin_level 1.
  • Cuauhtémoc, one of the city's sixteen boroughs, as a county, admin_level 2.
  • Ciudad de México again, as a locality — the same name as the region, a different division.
  • Centro (neighborhood) and Plaza de la Constitución (microhood).
  • America/Mexico_City, the time zone.

layers is how many divisions layers were consulted — here three: land, maritime and time zones.took_us is 55 microseconds of server time.

Subtypes, outermost first

The list is sorted by subtype in this order, then by name:

SubtypeIs
countryA sovereign country.
dependencyA territory that depends on a country without being part of it.
regionThe first level inside a country: a state, province or, here, the capital district.
countyThe second level: a county, municipality or borough.
localadminA local administrative unit below the county, where a country has one.
localityA city, town or village.
macrohood, neighborhood, microhoodParts of a locality, largest to smallest.
timezoneNot an administrative division: the IANA time zone at the point, from timezone-boundary-builder, carried in the same list by the same machinery.

The subtypes and their polygons are Overture's, and how a country's own levels map onto them varies — Mexico City's boroughs are county here. Before keying anything on a subtype, look at a handful of points in the country you care about. And do not assume one entry per subtype: the example has two countries, and anywhere two divisions of the same subtype overlap, both are listed.

Fields

FieldIs
idThe division's Overture id — or, for a time zone, its IANA name. The field to key on: names repeat, as the two Ciudad de México entries show.
nameThe division's primary name.
subtypeOne of the ten above.
countryISO 3166-1 alpha-2 code: MX. null on a time zone.
regionISO 3166-2 code with its country prefix: MX-CMX. null on a country and a time zone.
admin_levelOverture's level number, where the source gives one. Sparse — null on most entries in the example — so branch on subtype, not on this.
viainterior or boundary: how the answer was decided. See below.
provenanceWhich layer, which release, which licence.
docThe entry's position in its segment. Not stable across releases; do not store it.

Note the two spellings of a region. admin carries the full ISO 3166-2 code, MX-CMX. A geocoding or autocomplete result's hierarchy.region is what that row recorded, which for the same place is CMX. Compare with the country prefix in mind.

via: decided without reading geometry, or not

Each division's polygon is covered by cells when the layer is built. Cells wholly inside the polygon become ranges of an index; cells its edge passes through are kept as boundary cells, with the polygon beside them. A query finds the cell the point is in:

  • interior — the point's cell lies wholly inside the division. The answer is a binary search over integers, and no geometry is read at all. This is the common case, and the reason the example takes microseconds.
  • boundary — the point's cell is one the division's edge crosses, so the polygon was read and tested. The answer is still the polygon's answer for the coordinate you sent.

What boundary tells you is that the point is within about one boundary cell of that division's edge. Coarse divisions use coarse cells: about 9 km for a country or time zone, 4.6 km for a region, 2.3 km for a county, 1.2 km for a locality and 600 m for the neighbourhood levels. If your coordinate is itself uncertain — a geocode'sprecision_m, a locate fix's accuracy_m, a phone's GPS — a boundary entry is the one to check, because the uncertainty may cross the line. Aninterior entry says the point's cell is wholly inside; it does not say how far the edge is.

The time-zone entry

The timezone entry's name and id are both the IANA zone id. It comes from timezone-boundary-builder under ODbL-1.0 — share-alike, like the Overture divisions above it, which matters if you store it (see data and licensing). For offsets, daylight saving and abbreviations at a given moment, use time zones.

What it is for

Tax jurisdiction lookup

Sales-tax and VAT rules are usually set by a country, a region and sometimes a municipality, andadmin gives the ISO codes and ids to look a rate up by. It gives administrative polygons, not tax jurisdictions: where a tax authority draws districts that do not follow administrative lines, you need that authority's own boundaries. Treat a boundary entry at a coordinate you are not sure of as a case for review, not an answer.

Analytics by municipality

Group by the id of the subtype that means "municipality" in your country, and keep the name only for display:

Python
from oslew import Client

client = Client(base_url="https://api.oslew.com")

def municipality(lat: float, lon: float, subtype: str = "county"):
    """The division to group by. In Mexico the municipality is a county; check yours."""
    for d in client.admin(f"{lat},{lon}")["admin"]:
        if d["subtype"] == subtype and d["provenance"]["name"] == "overture-divisions":
            return d["id"], d["name"]
    return None

Checking a region a user entered

A form with a state picker and a free-text address can disagree. Geocode the address, ask for the chain at the result, and compare the region code with the one picked:

Python
def region_agrees(address: str, picked: str) -> bool | None:
    """picked is an ISO 3166-2 code from your form, such as "MX-CMX"."""
    answer = client.geocode(address, limit=5)
    if not answer["results"] or answer["tied_at_top"] > 1:
        return None  # the address does not name one place; nothing to compare
    top = answer["results"][0]
    chain = client.admin(f"{top['lat']},{top['lon']}")["admin"]
    return picked in {d["region"] for d in chain if d["subtype"] == "region"}

A False is worth showing the user rather than silently correcting: either the picker or the address is wrong, and only they know which.

The same list elsewhere

RouteIts admin
/v1/reverseThe same list, time zone included, beside the nearest addresses and places. Reverse is in the address product, so a plan without platform still gets the chain this way.
/v1/hereThe same list without the time-zone entry, which has its own timezone field there.
/v1/locateThe chain at the computed fix.
/v1/postcodeThe chain at the postcode's centroid — which is where a postcode's locality comes from when its address rows record none.

Use /v1/admin when the chain is all you need: it is the smallest answer and the fastest. Where no divisions layer is loaded the list is empty and layers is 0 — a 200, not an error — and a point no division contains, far out at sea, answers an empty list the same way.

Endpoints

GET/v1/adminplatform

The administrative chain at a point: every division containing it, outermost first.