Auth & base URLs
Base URLs
https://routeph.com/api/osrm/v1/{profile}/{coords}
https://routeph.com/api/nominatim/{search|reverse}
- Profiles: driving
- Coords: lon,lat;lon,lat (WGS84)
- Formats: JSON (default)
Headers
Authorization: Bearer <token>
Accept: application/json
- Use HTTPS only
- Attach auth header when enabled
- Rate limits apply per key
Quickstart (60s)
๐1) Get a key
- Request an API key (Bearer token)
- Send `Authorization: Bearer <token>` on every call
๐ฃ๏ธ2) First route
curl -s -H "Authorization: Bearer <token>" \
'https://routeph.com/api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?overview=false'
๐3) First search
curl -s -H "Authorization: Bearer <token>" \
'https://routeph.com/api/nominatim/search?q=Quezon%20City&format=json'
OSRM endpoints
๐งญRoute
GET /api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?overview=false
- Returns route, duration, distance, geometry
- Params: overview (false,simplified,full), steps, annotations
- Profiles: driving
๐Matrix
GET /api/osrm/v1/driving/120.98,14.60;121.02,14.64?annotations=duration,distance
- Returns sources/destinations matrices
- Params: annotations=duration,distance
- Keep waypoint count reasonable for latency
๐ฐ๏ธMatch / Table
GET /api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?annotations=duration
- Use match/table for map matching or durations only
- Geometry: `geometries=polyline` or `geojson`
Nominatim endpoints
๐Search
GET /api/nominatim/search?q=Quezon%20City&format=json
- Params: q, format=json, countrycodes=ph, viewbox, limit
- Response includes lat, lon, boundingbox, display_name
๐Reverse
GET /api/nominatim/reverse?lat=14.5995&lon=120.9842&format=json
- Returns address components and display_name
- Params: lat, lon, zoom, addressdetails=1
Use cases
๐Food delivery
- Pickup โ restaurant โ drop-off ETAs with a single route call
- Matrix queries to pick the closest rider to the next order
- Reverse geocode building/condo pins into driver-friendly text
๐Ride-hailing
- Find nearest drivers with duration/distance matrices
- Show clean pickup/dropoff labels via reverse geocoding
- Polyline/geojson geometries for live map previews
๐ฆLogistics / marketplace
- Batch distance lookups for SLA/time-window checks
- Depot-to-customer routing to balance inventory and routes
- Forward search with country bias to reduce bad addresses
Examples (copy/paste)
๐งญRoute
curl -s 'https://routeph.com/api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?overview=false' | jq '.routes[0].distance, .routes[0].duration'
๐Matrix
curl -s 'https://routeph.com/api/osrm/v1/driving/120.98,14.60;121.02,14.64?annotations=duration,distance' | jq '.durations'
๐Search
curl -s 'https://routeph.com/api/nominatim/search?q=Quezon%20City&format=json' | jq '.[0].display_name'
๐Reverse
curl -s 'https://routeph.com/api/nominatim/reverse?lat=14.5995&lon=120.9842&format=json' | jq '.address.city'
Playground
Route
Open route in new tab
curl -s 'https://routeph.com/api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?overview=false'
Search
Open search in new tab
curl -s 'https://routeph.com/api/nominatim/search?q=Quezon%20City&format=json'
Map preview
Loads the last fetched route geometry (polyline).
Distance โ ETA will appear here.
Drop pins
Click two points on the map โ weโll fetch and draw the route.
Click on the map to set origin and destination.
Errors & limits
โ ๏ธStatus codes
- 200: OK
- 400: Bad request (check coords/params)
- 401/403: Missing or invalid token
- 429: Rate limit exceeded (try later)
- 5xx: Upstream error (retry with backoff)
โฑ๏ธRate limits
- Per-key quotas; contact us for higher limits
- Use 429 responses to trigger retry with jitter
- Cache GET responses where possible
๐จHeaders
- Send `Authorization: Bearer <token>`
- Expect `Content-Type: application/json`
- CORS allowed for browser apps
Language snippets
๐ปJavaScript (fetch)
fetch('https://routeph.com/api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?overview=false', {
headers: { Authorization: 'Bearer <token>' }
}).then(r => r.json()).then(console.log);
๐Python (requests)
import requests
resp = requests.get(
"https://routeph.com/api/nominatim/search",
params={"q": "Quezon City", "format": "json"},
headers={"Authorization": "Bearer <token>"}
)
print(resp.json())
โฑ๏ธJS ETA (two stops)
const url = 'https://routeph.com/api/osrm/v1/driving/120.98,14.60;121.02,14.64?annotations=duration';
fetch(url, { headers: { Authorization: 'Bearer <token>' }})
.then(r => r.json())
.then(data => console.log('ETA (s):', data.routes[0].duration));
๐งฎPython matrix batch
import requests
coords = "120.98,14.60;121.02,14.64;121.06,14.55"
resp = requests.get(
"https://routeph.com/api/osrm/v1/driving/" + coords,
params={"annotations": "duration,distance"},
headers={"Authorization": "Bearer <token>"}
)
print(resp.json()["durations"])
๐ฏJS geocode with bias
const url = 'https://routeph.com/api/nominatim/search?q=Eastwood&countrycodes=ph&format=json';
fetch(url, { headers: { Authorization: 'Bearer <token>' }})
.then(r => r.json())
.then(results => console.log(results[0]?.display_name));
๐งฐPostman
Download collection:
https://routeph.com/postman/routeph-apis.json
๐บ๏ธJS polyline decode
import polyline from 'https://cdn.skypack.dev/@mapbox/polyline';
// Request a route with polyline6 geometry
const url = 'https://routeph.com/api/osrm/v1/driving/120.9822,14.6042;121.0437,14.6760?geometries=polyline6';
fetch(url, { headers: { Authorization: 'Bearer <token>' }})
.then(r => r.json())
.then(data => {
const encoded = data.routes[0].geometry;
const coords = polyline.decode(encoded, 6); // [[lat, lon], ...]
console.log('First 3 points:', coords.slice(0,3));
});