GeocodingaddressoperationId postcode
GET/v1/postcode
A postcode: the centroid of its addresses, their extent, how many there are, and the administrative chain it sits in.
The position is the mean of the code's own address points, not a published centroid, so it is where the addresses actually are; precision_m is half the diagonal of what they cover, which for a rural code is kilometres. Without country, a code that two countries share comes back twice rather than being guessed at. admin is filled from the divisions layer, which is where the locality comes from for a country whose address rows carry none — Mexico's do not.
Send Authorization: Bearer sk_live_…. The key's plan must include theaddress product; which plans do.
Explained in Postcodes.
Example
One postcode, narrowed to a country.
curl -G "https://api.oslew.com/v1/postcode" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'code=03940' \
--data-urlencode 'country=MX'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.postcode("03940", country="MX")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.postcode("03940", { country: "MX" });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 298
ratelimit-reset: 1
{
"query": "03940",
"results": [
{
"code": "03940",
"country": "MX",
"lat": 19.365164,
"lon": -99.180155,
"bbox": [
19.362674,
19.367267,
-99.182424,
-99.178061
],
"addresses": 271,
"locality": null,
"region": "Ciudad de México",
"precision_m": 342.89968972092777,
"precision": "postcode",
"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": 1621,
"id": "57c3f700-1244-4858-b97d-0980a217b02e",
"name": "Benito Juárez",
"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": "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": 1,
"provenance": {
"name": "overture-addresses",
"release": "postcodes",
"license": "CDLA-Permissive-2.0"
},
"took_us": 468
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
Query
| Name | Type | Description |
|---|---|---|
codequeryrequired | string | Any spelling: 03940, SW1A 1AA, sw1a1aa. |
countryquery | string | ISO code, to narrow a shared code. |
prefixquery | boolean | Treat code as a prefix: the codes that begin with it. |
limitquery | integer ≤ 50 default 10 |
Responses
200 — Matches, or none.
layersintegerrequiredquerystringrequiredresultsobject[]requiredaddressesintegerrequiredHow many addresses the centroid is the mean of.adminHit[]requireddocintegerrequiredOrdinal in the segment.idstringrequiredOverture id.namestringrequiredprovenanceSourcerequiredlicensestringrequirednamestringrequiredreleasestringrequired
subtypestringrequiredcountry | dependency | region | county | localadmin | locality | macrohood | neighborhood | microhood | timezoneviastringrequiredinterior: the point's cell is provably inside, no geometry read;boundary: the polygon decided.interior | boundaryadmin_levelinteger | nullcountrystring | nullISO code.regionstring | nullISO region code,MX-JAL.
bboxnumber[]required4 itemslat_lo, lat_hi, lng_lo, lng_hiof the addresses behind the code.codestringrequiredAs the source spells it.countrystringrequiredlatnumberrequiredlonnumberrequiredprecisionPrecisionrequiredWhat the position locates, finest first.rooftopis 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.interpolatedis a point placed between the two recorded numbers that bracket the one asked for, which is what Google callsRANGE_INTERPOLATED.streetis an address row with no number to place along it.precision_mcarries 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 | poiprecision_mnumberrequiredHalf the diagonal of the bounding box.localitystring | nullregionstring | null
took_usintegerrequiredprovenanceSourcelicensestringrequirednamestringrequiredreleasestringrequired
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.
| 400 | No code, or no postcode layer loaded. |
| 401 | No key, or one that is unknown, revoked or suspended. |
| 403 | The 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. |
| 429 | This 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. |
| 503 | The 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
Every code that begins with a prefix
curl -G "https://api.oslew.com/v1/postcode" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'code=0394' \
--data-urlencode 'country=MX' \
--data-urlencode 'prefix=true' \
--data-urlencode 'limit=3'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.postcode("0394", country="MX", prefix=True, limit=3)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.postcode("0394", { country: "MX", prefix: true, limit: 3 });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 297
ratelimit-reset: 1
{
"query": "0394",
"results": [
{
"code": "03940",
"country": "MX",
"lat": 19.365164,
"lon": -99.180155,
"bbox": [
19.362674,
19.367267,
-99.182424,
-99.178061
],
"addresses": 271,
"locality": null,
"region": "Ciudad de México",
"precision_m": 342.89968972092777,
"precision": "postcode",
"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": 1621,
"id": "57c3f700-1244-4858-b97d-0980a217b02e",
"name": "Benito Juárez",
"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": "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": 1,
"provenance": {
"name": "overture-addresses",
"release": "postcodes",
"license": "CDLA-Permissive-2.0"
},
"took_us": 96
}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.