RoutingroutingoperationId route
GET/v1/route
The fastest road route between two points, each snapped to the nearest point on a road.
Send Authorization: Bearer sk_live_…. The key's plan must include therouting product; which plans do.
Explained in Products and plans, Errors, Routes and profiles, Live traffic, Operator feeds, A store locator and Delivery planning.
Example
Driving from Museo Soumaya to the Zócalo.
curl -G "https://api.oslew.com/v1/route" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'from=19.4406,-99.2047' \
--data-urlencode 'to=19.4326,-99.1332' \
--data-urlencode 'geometry=false'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.route("19.4406,-99.2047", "19.4326,-99.1332", geometry=False)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.route("19.4406,-99.2047", "19.4326,-99.1332", { geometry: false });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1
{
"from": [
19.4406,
-99.2047
],
"to": [
19.4326,
-99.1332
],
"snapped_from": {
"from": 394836,
"to": 394840,
"frac": 0.05159010871941542,
"lat": 19.440242113128892,
"lon": -99.20471337400338,
"distance_m": 39.819960107330104,
"time_ds": 28,
"len_m": 39,
"two_way": false
},
"snapped_to": {
"from": 355496,
"to": 355490,
"frac": 0.16199866758190418,
"lat": 19.43200133133587,
"lon": -99.13329035902773,
"distance_m": 67.23995201279342,
"time_ds": 110,
"len_m": 92,
"two_way": false
},
"found": true,
"distance_m": 9269,
"duration_s": 695.2,
"nodes": 165,
"settled": 431,
"geometry": [],
"engine": "base/hierarchy",
"provenance": {
"name": "overture-transportation",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
},
"took_us": 932
}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 |
|---|---|---|
fromqueryrequired | string | lat,lon. |
toqueryrequired | string | lat,lon. |
geometryquery | boolean default true | Return the path as (lat, lon) per node. |
profilequery | string driving | walking | cycling | rail | live default driving | The mode; each has its own network, speeds and access rules. live is driving on the traffic feed's weights when one is applied, and the release's weights when none is. |
trafficquery | string live | Use the traffic feed's weights when one is applied (driving only); the same as profile=live. |
Responses
200 — The route, or found: false.
distance_minteger | nullrequiredduration_snumber | nullrequiredAt the posted limit where given, else the class default speed; no traffic.enginestringrequiredfoundbooleanrequiredfromnumber[]requiredgeometrynumber[][]required(lat, lon): the snapped origin, every node, the snapped destination.nodesintegerrequiredprovenanceSourcerequiredlicensestringrequirednamestringrequiredreleasestringrequired
settledintegerrequiredsnapped_fromEdgeSnaprequireddistance_mnumberrequiredFrom the query point to the snapped position.fracnumberrequiredPosition along the edge, 0 at from, 1 at to.fromintegerrequiredlatnumberrequiredlen_mintegerrequiredlonnumberrequiredtime_dsintegerrequiredtointegerrequiredtwo_waybooleanrequired
snapped_toEdgeSnaprequireddistance_mnumberrequiredFrom the query point to the snapped position.fracnumberrequiredPosition along the edge, 0 at from, 1 at to.fromintegerrequiredlatnumberrequiredlen_mintegerrequiredlonnumberrequiredtime_dsintegerrequiredtointegerrequiredtwo_waybooleanrequired
tonumber[]requiredtook_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.
| 400 | Bad request, or no road within 9 km. |
| 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
The same trip on foot
curl -G "https://api.oslew.com/v1/route" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'from=19.4406,-99.2047' \
--data-urlencode 'to=19.4326,-99.1332' \
--data-urlencode 'profile=walking' \
--data-urlencode 'geometry=false'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.route(
"19.4406,-99.2047",
"19.4326,-99.1332",
geometry=False,
profile="walking",
)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.route("19.4406,-99.2047", "19.4326,-99.1332", { geometry: false, profile: "walking" });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 298
ratelimit-reset: 1
{
"from": [
19.4406,
-99.2047
],
"to": [
19.4326,
-99.1332
],
"snapped_from": {
"from": 434020,
"to": 434026,
"frac": 1,
"lat": 19.44050138408404,
"lon": -99.20451818453606,
"distance_m": 21.99305218267701,
"time_ds": 324,
"len_m": 18,
"two_way": true
},
"snapped_to": {
"from": 387407,
"to": 387421,
"frac": 0.45641447518550365,
"lat": 19.432124810825027,
"lon": -99.13328961848858,
"distance_m": 53.66787209985155,
"time_ds": 940,
"len_m": 131,
"two_way": true
},
"found": true,
"distance_m": 7979,
"duration_s": 5761.4,
"nodes": 142,
"settled": 1002,
"geometry": [],
"engine": "base/hierarchy",
"provenance": {
"name": "overture-transportation",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
},
"took_us": 3052
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
A short route with its geometry
curl -G "https://api.oslew.com/v1/route" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'from=19.4326,-99.1332' \
--data-urlencode 'to=19.4352,-99.1412'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.route("19.4326,-99.1332", "19.4352,-99.1412")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.route("19.4326,-99.1332", "19.4352,-99.1412");HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 297
ratelimit-reset: 1
{
"from": [
19.4326,
-99.1332
],
"to": [
19.4352,
-99.1412
],
"snapped_from": {
"from": 355496,
"to": 355490,
"frac": 0.16199866758190418,
"lat": 19.43200133133587,
"lon": -99.13329035902773,
"distance_m": 67.23995201279342,
"time_ds": 110,
"len_m": 92,
"two_way": false
},
"snapped_to": {
"from": 289909,
"to": 289914,
"frac": 0.6128848307339685,
"lat": 19.435137788683768,
"lon": -99.14071924890425,
"distance_m": 50.883507740291044,
"time_ds": 35,
"len_m": 49,
"two_way": false
},
"found": true,
"distance_m": 1699,
"duration_s": 208.9,
"nodes": 28,
"settled": 78,
"geometry": [
[
19.43200133133587,
-99.13329035902773
],
[
19.431903616212214,
-99.1325623738953
],
[
19.431911572708522,
-99.13244027479968
],
[
19.43171223480434,
-99.13232577540224
],
[
19.431627961164846,
-99.13232788637784
],
[
19.43085290660703,
-99.13234781399032
]
],
"engine": "base/hierarchy",
"provenance": {
"name": "overture-transportation",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
},
"took_us": 679
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call. Shortened for the page: geometry shows 6 of 28.
A key whose plan does not include the product
curl -G "https://api.oslew.com/v1/route" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'from=19.4406,-99.2047' \
--data-urlencode 'to=19.4326,-99.1332'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.route("19.4406,-99.2047", "19.4326,-99.1332")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.route("19.4406,-99.2047", "19.4326,-99.1332");HTTP/1.1 403 Forbidden
content-type: application/json
{
"error": "the free plan does not include routing; Routing ($299/mo) does"
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
An unknown profile
curl -G "https://api.oslew.com/v1/route" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'from=19.4406,-99.2047' \
--data-urlencode 'to=19.4326,-99.1332' \
--data-urlencode 'profile=base'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.route("19.4406,-99.2047", "19.4326,-99.1332", profile="base")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.route("19.4406,-99.2047", "19.4326,-99.1332", { profile: "base" });HTTP/1.1 400 Bad Request
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1
{
"error": "unknown profile `base`; driving, walking, cycling or rail"
}A real response, captured from the service at commit b8f4bde-dirty. Timing fields such as took_us differ on every call.
The same route on live weights
curl -G "https://api.oslew.com/v1/route" \
-H "Authorization: Bearer $GEO_API_KEY" \
--data-urlencode 'from=19.4406,-99.2047' \
--data-urlencode 'to=19.4326,-99.1332' \
--data-urlencode 'traffic=live' \
--data-urlencode 'geometry=false'from oslew import Client
# The key is read from GEO_API_KEY.
client = Client(base_url="https://api.oslew.com")
answer = client.route(
"19.4406,-99.2047",
"19.4326,-99.1332",
geometry=False,
traffic="live",
)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.route("19.4406,-99.2047", "19.4326,-99.1332", { geometry: false, traffic: "live" });HTTP/1.1 200 OK
content-type: application/json
ratelimit-limit: 100
ratelimit-remaining: 299
ratelimit-reset: 1
{
"from": [
19.4406,
-99.2047
],
"to": [
19.4326,
-99.1332
],
"snapped_from": {
"from": 394836,
"to": 394840,
"frac": 0.05159010871941542,
"lat": 19.440242113128892,
"lon": -99.20471337400338,
"distance_m": 39.819960107330104,
"time_ds": 28,
"len_m": 39,
"two_way": false
},
"snapped_to": {
"from": 355496,
"to": 355490,
"frac": 0.16199866758190418,
"lat": 19.43200133133587,
"lon": -99.13329035902773,
"distance_m": 67.23995201279342,
"time_ds": 110,
"len_m": 92,
"two_way": false
},
"found": true,
"distance_m": 9269,
"duration_s": 695.2,
"nodes": 165,
"settled": 65350,
"geometry": [],
"engine": "live/dijkstra",
"provenance": {
"name": "overture-transportation",
"release": "2026-08-19.0",
"license": "ODbL-1.0"
},
"took_us": 7120
}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.