API docs ยท OSRM routing + Nominatim search

Build with RoutePH APIs

Endpoints, parameters, and request samples for routing, matrices, and geocoding. All examples point to your live domain.

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)); });