Map
Route planner
Turn-by-turn directions by road between two postals, the same way AI dispatch gives them.
GEThttps://api.samplebot.app/v1/route
Prefer a button to click? This tool also works in your browser at samplebot.app/tools/route.
Parameters
| Name | Description | Default |
|---|---|---|
from required | From postal. | |
to required | To postal. |
Send them as query parameters.
Example request
curl
curl "https://api.samplebot.app/v1/route?from=218&to=401" \
-H "Authorization: Bearer $SAMPLE_API_KEY"
JavaScript (Node 18+)
const res = await fetch("https://api.samplebot.app/v1/route?from=218&to=401", {
headers: { Authorization: `Bearer ${process.env.SAMPLE_API_KEY}` },
});
const { ok, data, text, error } = await res.json();
if (!ok) throw new Error(error.message);
console.log(data);
Python
import os, requests
res = requests.get(
"https://api.samplebot.app/v1/route",
params={"from":"218","to":"401"},
headers={"Authorization": f"Bearer {os.environ['SAMPLE_API_KEY']}"},
)
print(res.json()["data"])
Example reply
This is the real reply to the example request. Long lists are shortened here.
{
"ok": true,
"tool": "route",
"data": {
"from": {
"code": "218",
"x": 2124,
"z": 3710,
"street": "Freedom Avenue"
},
"to": {
"code": "401",
"x": 2071,
"z": 3206,
"street": "Fairfax Road"
},
"distance": 1241,
"steps": [
{
"text": "Head east on Freedom Avenue",
"distance": 0
},
{
"text": "Turn left onto Riverside Drive",
"distance": 82
},
{
"text": "Turn left onto Fairfax Road",
"distance": 811
},
{
"text": "Turn left",
"distance": 249
},
"... 1 more"
],
"points": [
{
"x": 2180,
"z": 3822
},
{
"x": 2194,
"z": 3818
},
{
"x": 2236,
"z": 3818
},
{
"x": 2258,
"z": 3806
},
"... 19 more"
]
},
"text": "Route from postal 218 to postal 401, about 1241 studs by road:\n1. Head east on Freedom Avenue\n2. Turn left onto Riverside Drive (in 82 studs)\n3. Turn left onto Fairfax Road (in 811 studs)\n4. Turn left (in 249 studs)\n5. You have arrived (in 236 studs)"
}
Using it in your app
Read data for the values, or post text as it is: it is already formatted for Discord. Check ok first: when it is false, error.message says what went wrong in words you can show your users. Keep your key on your server, never in a web page or a Roblox game.