Navigation
Navigation
A server-aware navigation control plane for building a first-class turn-by-turn experience without re-inventing the hard geometry on the client. It sits on top of Routing and Traffic: you start a session for a trip, feed it live GPS fixes, and the server computes snap-to-route progress, off-route detection, automatic re-routing, a traffic-aware ETA, arrival detection, and a rolling event log (with optional signed webhooks).
Every stateless helper (off-route, progress, arrival-check) is also available on its own if you prefer to drive the loop client-side.
Scope required: routing
x-api-key). Anonymous requests return 401. Sessions are owned by whoever created them; another caller reading or updating your session gets 403.{ lat, lng } on every Navigation body (unlike the low-level routing passthrough, which uses lon). Route geometry (routeShape) is an encoded polyline, precision 6 (a.k.a. polyline6) — decode with a factor of 1e6. All POSTs return 201 on success.POST /navigation/sessions
Start a managed navigation session. The server plans the route (via the Navvo routing engine), parses the maneuvers with cumulative distances, and returns a session you can drive with PATCH/positions.
Request body
{ "lat": number, "lng": number, "heading"?: number, "speed"?: number }. If the trip starts while the vehicle is moving, send heading (the GPS course in degrees clockwise from north) and speed (m/s) so the first route starts in the direction of travel. Also send horizontalAccuracy (metres) when you have it. Without a usable heading the start road is a best guess: the response says start.confirmed: false, and the first PATCH with speed and heading checks it. If that fix shows the vehicle on another road (common at stacked interchanges and parallel service roads), the route is re-planned from where the vehicle really is and returned as a reroute, with event start_road_corrected.{ "lat": number, "lng": number, "name"?: string, "placeSlug"?: string }. placeSlug lets arrival detection resolve a mapped entrance.auto (default), motorcycle, pedestrian, bicycle, motor_scooter, truck, wheelchair.en-US, ar). Default en-US.fastest, shortest, or balanced.tolls, highways, ferries, unpaved.routeId of the route the driver picked in POST /routing/plan (the main route or an alternate), sent within 15 minutes. The session then starts on exactly that route: distanceMeters and distanceRemainingMeters equal its trip.summary.length, with no re-planning, and costing, preference, avoid and language default to the ones it was planned with. The response says routeSource: "preview". If the ID has expired, the origin is more than 250 m or the destination more than 50 m from the previewed ones, or costing/avoid/preference/language differ, a new route is planned (routeSource: "planned") and warnings[] says why (route_id_expired or route_id_mismatch).preference and avoid, so the app can show which options are in force. Every server reroute (off-route, wrong-way, POST /navigation/recalculate, live-socket reroutes and alternatives) uses the session's avoid list.curl -s -X POST "https://navvo.io/api/v1/navigation/sessions" \
-H "Authorization: Bearer $NAVVO_JWT" -H "Content-Type: application/json" \
-d '{
"origin": { "lat": 31.9539, "lng": 35.9106 },
"destination": { "lat": 31.9730, "lng": 35.9200, "name": "Sports City" },
"costing": "auto", "language": "en-US"
}'
Response (201)
{
"sessionId": "b23f9bec-516c-4038-a2fa-c3a275ec598b",
"status": "active",
"costing": "auto",
"language": "en-US",
"destination": { "lat": 31.9730, "lng": 35.9200, "name": "Sports City" },
"routeShape": "…encoded polyline6…",
"maneuvers": [
{
"index": 0, "type": 1, "instruction": "Drive north.",
"verbalAlert": "Drive north.", "verbalPre": "Drive north for 300 meters.",
"verbalPost": "Continue for 300 meters.", "streetNames": ["King Abdullah St"],
"roundaboutExit": null, "exitSign": null,
"distanceMeters": 300, "timeSeconds": 34,
"lat": 31.9539, "lng": 35.9106, "cumulativeMeters": 0
}
],
"distanceMeters": 6366,
"baseSeconds": 402,
"etaSeconds": 402,
"distanceRemainingMeters": 6366,
"durationRemainingSeconds": 402,
"maneuverIndex": 0,
"eventSeq": 0,
"expiresAt": "2026-07-20T02:00:00.000Z",
"route": { "shape": "…", "maneuvers": [ … ], "distanceMeters": 6366, "etaSeconds": 402 }
}
| Field | Meaning |
|---|---|
maneuvers[] | Parsed turn list. type is a maneuver code — resolve it with GET /routing/maneuver-types. cumulativeMeters is the distance from the route start to that maneuver (used for progress). verbal* are ready for text-to-speech. |
distanceMeters / baseSeconds | Total route length and no-traffic duration. |
eventSeq | Monotonic event counter — poll GET …/events?since= with the last value you saw. |
expiresAt | Sessions auto-expire ~6 h after last activity. |
congestion | Traffic along the new route, as spans of route-shape indexes. See below. |
routeAttributes | The same body POST /routing/route-attributes returns for this route (speed limits, typical speeds, road names and classes per edge). You no longer need that second call when a trip starts. |
Congestion and road attributes on session start
The session response carries what a client used to fetch with a second request:
"congestion": {
"available": true,
"delaySeconds": 42,
"durationInTrafficSeconds": 582,
"spans": [
{ "shapeIndexFrom": 0, "shapeIndexTo": 4, "level": "light" },
{ "shapeIndexFrom": 4, "shapeIndexTo": 9, "level": "moderate" },
{ "shapeIndexFrom": 9, "shapeIndexTo": 212, "level": "unknown" }
]
}
- Spans cover
route.shapefrom the first point to the last, in order, with no gaps. Each span ends on the index where the next one starts. levelislight,moderate,heavy,blockedorunknown.unknownmeans there is no current observation for that stretch. It does not mean the road is clear.- Both blocks are capped at 2.5 s so they never hold up the start of a trip. If one is not ready in time, it reads
"available": false; callPOST /routing/route-attributesorPOST /traffic/routefor it only then. - They describe the route at session start. After a reroute, the new route's traffic comes from those endpoints as before.
Errors: 400 if no route can be planned between the points (or costing: "truck" where truck routing is not provisioned); 401 unauthenticated.
GET /navigation/sessions/{id}
Fetch the current session snapshot (route, maneuvers, progress, status). 404 if unknown, 403 if it belongs to another caller.
PATCH /navigation/sessions/{id}
Feed the latest GPS fix. The server snaps it to the route, advances the maneuver pointer, detects arrival and off-route (auto-re-planning when off-route), appends any events, and returns the fresh progress.
Request body
Response (201)
{
"sessionId": "…", "status": "active", "maneuverIndex": 2, "eventSeq": 4,
"etaSeconds": 237, "distanceRemainingMeters": 3756, "durationRemainingSeconds": 237,
"progress": {
"offRoute": false,
"wrongWay": false,
"staleFix": false,
"arrived": false,
"shapeIndex": 128,
"maneuverIndex": 2,
"snapped": { "lat": 31.9601, "lng": 35.9149 },
"distanceToRouteMeters": 6,
"distanceRemainingMeters": 3756,
"durationRemainingSeconds": 237,
"distanceToNextManeuverMeters": 210,
"nextManeuver": { "index": 2, "type": 15, "instruction": "Turn left onto …", "verbalAlert": "Turn left onto …", "cumulativeMeters": 3966, "lat": 31.96, "lng": 35.915 },
"progressFraction": 0.41
},
"reroute": null
}
When the fix is off the route corridor, progress.offRoute is true, an off_route event is emitted, and the server re-plans from the current position: reroute then carries the new { shape, maneuvers, distanceMeters, etaSeconds } and a rerouted event is logged. The new route starts on the road being driven, in the direction of travel, when the fix carries heading and a speed of at least 2 m/s. If GPS is offset from that road and the route starts more than 25 m from the fix, the off-route limit widens above 40 m for 30 seconds (up to 75 m), so the offset alone does not trigger another reroute. When within ~35 m of the destination the session flips to status: "arrived" and an arrived event fires.
Going the wrong way. Within 40 m the distance check cannot see a driver on the opposite carriageway, so direction is checked too. When the fix carries heading and a speed of at least 2 m/s, and every piece of the route within 40 m runs against that heading for 3 seconds, progress.wrongWay becomes true, a wrong_way event is emitted, and the server re-plans from the current position, at most once every 15 seconds. Walking and wheelchair sessions are exempt. Send fixes at least every 2 seconds while moving so this can confirm promptly.
Route revisions. Session responses carry routeRevision, an integer that goes up each time the route changes, and routeUpdatedAt. Send the revision you are following as routeRevision in the body or the X-Route-Revision header, and ignore any response with a lower revision than the one you have applied. A position update cannot replace the route when it is out of date: its routeRevision is older than the session's, its capturedAt is before the last recalculation, it was already in flight when a recalculation landed, or it lies behind the start of a route that changed in the last 20 seconds. Such an update returns progress.staleFix: true, gives the reason in staleReason, and changes nothing on the session. Its progress still measures the position against the current route, so distanceRemainingMeters and durationRemainingSeconds keep counting down while the client catches up; take the new routeRevision from the response. routeRevision is always at the top level of every session, PATCH and recalculate response. For 5 seconds after POST /navigation/recalculate, off-route triggers are ignored.
DELETE /navigation/sessions/{id}
End the session (status: "cancelled"). Returns { "ended": true, "sessionId": "…", "status": "cancelled" }.
If the server already ended the session (see below), a late DELETE changes nothing and returns { "ended": true, "status": "ended", "endReason": "client_timeout" }.
Sessions the server ends
A client can disappear without sending a DELETE, for example when the user stops navigation while offline. The server ends such sessions on its own:
endReason | When |
|---|---|
client_timeout | No PATCH, no live-socket message and no socket ping for 5 minutes. |
start_unconfirmed | The session started without a heading (start.confirmed: false), has never moved with a heading, and has heard nothing from the client for 60 seconds. |
An open live socket counts as contact, because its pings keep the session alive. A client that keeps sending positions, even from a car standing still, is never ended this way. A stale PATCH (staleFix: true) counts as contact too.
An ended session has status: "ended", plus endReason and endedAt (ISO time) on GET /navigation/sessions/{id}. A PATCH on it returns progress: null with a note, and the live socket refuses it with close code 4001. To continue the trip, create a new session from the current position.
POST /navigation/sessions/{id}/positions
Submit a batch of recent fixes (up to 50) — useful for a background/duty-cycled uplink. The latest fix drives the authoritative progress update; the response mirrors PATCH plus accepted (count) and newEvents (events produced by this batch).
{ "positions": [ { "lat": 31.958, "lng": 35.897, "speed": 11 }, { "lat": 31.960, "lng": 35.915, "speed": 9 } ] }
GET /navigation/sessions/{id}/events
Poll the session's event log. Pass ?since=<eventSeq> to get only newer events.
{
"sessionId": "…", "status": "active", "eventSeq": 6,
"events": [
{ "seq": 4, "type": "maneuver_completed", "at": "2026-07-19T18:02:11.000Z", "data": { "maneuverIndex": 1, "instruction": "…" } },
{ "seq": 5, "type": "off_route", "at": "…", "data": { "distanceToRouteMeters": 67 } },
{ "seq": 6, "type": "rerouted", "at": "…", "data": { "reroutes": 1, "distanceMeters": 4175, "startOffsetMeters": 6 } }
]
}
Event types: maneuver_approaching, maneuver_completed, off_route, wrong_way, rerouted, arrived. The last ~50 events are retained per session.
GET /navigation/sessions/{id}/eta
Recompute the traffic-aware ETA for the remaining route (from the last snapped position onward). This is the cheap, session-scoped alternative to polling POST /traffic/route with a hand-built shape.
{
"sessionId": "…", "available": true, "etaSeconds": 660,
"arrivalTime": "2026-07-19T18:15:00.000Z",
"delaySeconds": 120, "trafficLevel": "slow", "source": "traffic"
}
When live traffic is unavailable it returns { "available": false, "etaSeconds": <base>, "source": "base" }.
POST /navigation/off-route
Stateless. Test a single position against a route corridor — no session needed.
Request body
{ "lat": number, "lng": number }.40).Response (201)
{
"provider": "navvo-navigation",
"offRoute": true,
"distanceToRouteMeters": 67.2,
"confidence": 0.91,
"snapped": { "lat": 31.9598, "lng": 35.9141 },
"shapeIndex": 128,
"alongMeters": 2606
}
snapped is the nearest point on the route; alongMeters is how far along the route that snapped point is. 400 if routeShape does not decode to at least two points.
POST /navigation/recalculate
Re-plan the remaining route from the current location. Preserves the trip's preferences, including avoid. If sessionId is provided the session's route is replaced in place (and reroutes incremented); otherwise it is a stateless one-off (supply destination).
Request body
destination/costing/preference default to the session's.{ "lat": number, "lng": number, "heading"?: number, "speed"?: number } — the new origin. heading is the GPS course in degrees clockwise from north, never a compass reading, and speed is in m/s. With both, and a speed of at least 2 m/s, the new route starts on the road being driven, in the direction of travel. If they are missing or unusable and sessionId is set, the session's latest position is used instead, provided it was captured under 20 seconds ago, within 300 m, and carries a moving heading. Walking and wheelchair sessions ignore direction. A successful recalculation is logged as a rerouted event.sessionId is omitted.fastest / shortest / balanced.tolls, highways, ferries, unpaved. Omit it to keep the session's list. When sent with sessionId, it replaces the session's list for this and every later reroute (as do costing and preference). Without sessionId it applies to this one route.Response (201)
{
"provider": "navvo-navigation",
"sessionId": "…or null",
"costing": "auto", "preference": "balanced", "avoid": ["highways", "tolls"],
"routeRevision": 4, "routeUpdatedAt": "…",
"route": { "shape": "…encoded polyline6…", "maneuvers": [ … ], "distanceMeters": 4175, "etaSeconds": 260 }
}
POST /navigation/progress
Stateless. Project a position onto a known route and get remaining distance/time, the next-maneuver index, and arrival — the same math the session PATCH runs, without a session.
Request body
{ "lat": number, "lng": number }.[{ "cumulativeMeters": number }, …] (from a session or /routing/plan) so the response can advance maneuverIndex.durationRemainingSeconds.30).Response (201)
{
"provider": "navvo-navigation",
"shapeIndex": 128, "maneuverIndex": 3,
"snapped": { "lat": 31.9598, "lng": 35.9141 },
"distanceToRouteMeters": 4.2,
"distanceRemainingMeters": 2100,
"durationRemainingSeconds": 280,
"distanceToNextManeuverMeters": 120,
"progressFraction": 0.64,
"arrived": false
}
POST /navigation/arrival-check
Stateless. Confirm arrival at a destination (and resolve the nearest mapped entrance when a placeSlug is supplied).
Request body
{ "lat": number, "lng": number, "placeSlug"?: string }.{ "lat": number, "lng": number }.destination.placeSlug for the entrance lookup.30).Response (201)
{ "provider": "navvo-navigation", "arrived": true, "distanceMeters": 12.4, "radiusMeters": 30, "entranceId": "ent_3" }
entranceId is null when the place has no mapped entrances (or none is supplied).
POST /navigation/speak
Turn a maneuver instruction into speech-ready output. Always returns the normalized text, a ready-to-use ssml string (with the correct language + a calm speaking rate), and the resolved language. When a server-side text-to-speech provider is configured it also returns an audioUrl; otherwise available is false and clients synthesize on-device from text/ssml (the default, recommended path — consistent Arabic/English pronunciation with zero extra latency).
Request body
en-US or ar-SA. Default en-US.Response (201)
{
"provider": "navvo-navigation",
"available": false,
"reason": "on_device",
"language": "en-US",
"text": "In 200 meters, turn right onto King Abdullah Street.",
"ssml": "<speak xml:lang=\"en-US\"><prosody rate=\"0.94\">In 200 meters, turn right onto King Abdullah Street.</prosody></speak>",
"audioUrl": null
}
POST /navigation/trip-feedback
Submit post-trip feedback from the arrival screen — thumbs up/down plus an optional free-text feedback box. This is not the in-nav road-problem chip (POST /feedback); it is CSAT for the trip that just ended.
Scope: routing (same auth as the rest of Navigation — Bearer JWT or API key).
Request body
up or down.curl -s -X POST "https://navvo.io/api/v1/navigation/trip-feedback" \
-H "Authorization: Bearer $NAVVO_JWT" -H "Content-Type: application/json" \
-d '{
"rating": "up",
"message": "Smooth ETA, clear voice prompts",
"sessionId": "b23f9bec-516c-4038-a2fa-c3a275ec598b",
"destinationName": "Sports City",
"distanceKm": 12.4,
"durationSec": 918
}'
Response (201)
{ "ok": true, "id": "…", "rating": "up", "hasMessage": true, "createdAt": "2026-11-05T09:00:00.000Z" }
Live navigation over WebSocket
Instead of a PATCH every second or two, keep one WebSocket open for the session. Positions go up it, and progress, new routes, alternatives and hazard alerts come down it. The Navigation WebSocket page has every message in full. Session creation and ending stay on REST. When the socket is down, POST /navigation/sessions/{id}/live takes the same messages over plain HTTPS and answers with the messages the socket would have sent.
wss://navvo.io/api/v1/navigation/sessions/{sessionId}/live
Authenticate in the handshake with Authorization: Bearer <token> or X-Api-Key, or with ?token= if your client cannot set headers. Send a WebSocket ping every 25 seconds. Each message is a JSON text frame: { "type", "timestamp", "payload" }.
| Direction | type | Purpose |
|---|---|---|
| Send | location_update | lat, lng, bearing, speed, routeRevision, capturedAt |
| Send | request_reroute | currentLocation, reason, routeRevision |
| Send | select_alternative | alternativeId, routeRevision |
| Receive | progress | Sent for each position: snapped point, remaining distance and time, next maneuver, staleFix, offRoute, wrongWay |
| Receive | route_updated | A new route with its routeRevision and reason |
| Receive | alternative_available | Another route you can take, valid until expiresAt |
| Receive | hazard_alert | A hazard within 600 m ahead on the route |
| Receive | error | A message could not be used. The socket stays open |
Close codes: 1000 trip ended, 4001 session missing, expired or ended, 4003 not authorized, 4009 replaced by a newer connection. Do not reconnect after any of these. For anything else, reconnect with backoff, and once the socket has been down for more than 5 seconds use the HTTP form below.
POST /navigation/sessions/{id}/live
The live socket over plain HTTPS, for when the socket cannot connect or keeps dropping. Send { "routeRevision", "messages": [ … ] } with up to 20 of the messages you would send on the socket. The answer has the messages the socket would have sent, in the same { type, timestamp, payload } format, plus closed (the close code once the trip is over), nextPollMs and socket.available. The Navigation WebSocket page has the full contract.
POST /navigation/sessions/{id}/complete
Ends the trip and closes its live socket. All body fields are optional: rating (up or down), message, destinationName, distanceKm, durationSec. Returns { "completed": true, "sessionId": "…", "status": "arrived", "feedbackId": "…" }.
Navigation event webhooks
If a session was created with a webhookUrl, each batch of new events is POSTed to it as { "sessionId": "…", "events": [ … ] }. Deliveries carry:
X-Navvo-Signature: sha256=<hex>— HMAC-SHA256 of the raw request body. Verify it with your webhook secret before trusting a delivery.X-Navvo-Delivery— a short idempotency token.
The URL must be https and must resolve to a public address — deliveries to loopback/private ranges are refused (SSRF protection). Delivery is best-effort (5 s timeout, no retries); poll GET …/events as the source of truth.
Related
- Maneuver code table:
GET /routing/maneuver-types. - Embed lanes + speed limits directly in a plan:
POST /routing/planwithincludeLanes/includeAttributes. - Raw traffic-aware ETA for an arbitrary shape:
POST /traffic/route. - Contribute GPS outside a navigation session to improve traffic, with an API key or a signed-in session:
POST /telemetry/batcheswhile driving, or a whole trip afterwards withPOST /telemetry/trips.