Search docs ⌘K
esc
Type to search across all documentation pages
Logistics

Routing

Compute driving routes, optimize multi-stop sequences, build distance matrices, auto-dispatch, generate isochrones, and snap GPS traces to roads. All routes live under /logistics/* and require a token with logistics:read or logistics:write scope.

Calculate Route

POST
/logistics/routing/route
logistics:write0.0000053 tokens

Get driving directions between two points via Mapbox.

curl
curl -X POST https://api.saasignal.saastemly.com/logistics/routing/route \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"origin":{},"destination":{}}'
json — 200 OK
{ "status": "ok" }
typescript
const route = await ss.logistics.routing.route(
  { lat: 40.7128, lng: -74.0060 },
  { lat: 40.7580, lng: -73.9855 },
)
// route.distance_km, route.duration_min, route.steps, route.polyline
  1. Routing endpoints are API-only
  2. Use the REST API or TypeScript SDK to compute routes
Route results include a polyline you can render on any map library.
Body field
Type
Description
origin required
object
Start point: { lat: number (−90 to 90), lng: number (−180 to 180) }
destination required
object
End point: { lat: number (−90 to 90), lng: number (−180 to 180) }
waypoints
array
Intermediate stops, each { lat, lng } (max 25 waypoints)
max 25 items
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

Optimize Stops

POST
/logistics/routing/optimize
logistics:write0.0000053 tokens per stop

Find the optimal order to visit a set of stops.

curl
curl -X POST https://api.saasignal.saastemly.com/logistics/routing/optimize \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"origin":{},"stops":[]}'
json — 200 OK
{ "status": "ok" }
typescript
const result = await ss.logistics.routing.optimize(
  { lat: 40.7128, lng: -74.0060 }, // origin
  [
    { lat: 40.7580, lng: -73.9855 },
    { lat: 40.7282, lng: -73.7949 },
    { lat: 40.6892, lng: -74.0445 },
  ], // stops
)
// result.ordered_stops, result.total_distance_km, result.total_duration_min
  1. Stop optimization is an API-only operation
  2. Use the REST API or TypeScript SDK
Body field
Type
Description
origin required
object
Starting point: { lat, lng }
stops required
array
Stops to optimize, each { lat, lng } (1–12 stops)
1–12 items
destination
object
Optional return point: { lat, lng }. If omitted, route ends at the last optimized stop.
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

Distance Matrix

POST
/logistics/routing/distance-matrix
logistics:read0.0000008 tokens per cell

Get distances and durations between multiple origins and destinations.

curl
curl -X POST https://api.saasignal.saastemly.com/logistics/routing/distance-matrix \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"origins":[],"destinations":[]}'
json — 200 OK
{ "status": "ok" }
typescript
const matrix = await ss.logistics.routing.distanceMatrix(
  [{ lat: 40.71, lng: -74.01 }, { lat: 40.76, lng: -73.98 }],
  [{ lat: 40.69, lng: -74.04 }, { lat: 40.73, lng: -73.80 }],
)
// matrix.matrix[i][j].distance_km, matrix.matrix[i][j].duration_min
  1. Distance matrix is an API-only operation
  2. Use the REST API or TypeScript SDK
Body field
Type
Description
origins required
array
Source locations, each { lat, lng } (1–25 points)
1–25 items
destinations required
array
Target locations, each { lat, lng } (1–25 points)
1–25 items
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

Auto-Dispatch

POST
/logistics/routing/dispatch
logistics:write0.0000008 tokens per matrix cell

Compute optimal agent-to-task assignment using distance matrix.

curl
curl -X POST https://api.saasignal.saastemly.com/logistics/routing/dispatch \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"agents":[],"tasks":[]}'
json — 200 OK
{ "status": "ok" }
typescript
const assignments = await ss.logistics.routing.dispatch(
  [{ id: 'agent-1', lat: 40.71, lng: -74.01 }],
  [{ id: 'task-1', lat: 40.76, lng: -73.98 }],
)
  1. Auto-dispatch is an API-only operation
  2. Use the REST API or TypeScript SDK
Body field
Type
Description
agents required
array
Available agents, each { id: string (≥ 1 char), lat: number, lng: number } (1–25 agents)
1–25 items
tasks required
array
Tasks to assign, each { id: string (≥ 1 char), lat: number, lng: number } (1–25 tasks)
1–25 items
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

Isochrone

POST
/logistics/routing/isochrone
logistics:read0.0000053 tokens

Get GeoJSON polygons of areas reachable from a point within given time budgets.

curl
curl -X POST https://api.saasignal.saastemly.com/logistics/routing/isochrone \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"origin":{},"minutes":[]}'
json — 200 OK
{ "status": "ok" }
typescript
const iso = await ss.logistics.routing.isochrone(
  { lat: 40.7128, lng: -74.0060 },
  [5, 10, 15], // minutes
  'driving',
)
  1. Isochrone generation is an API-only operation
  2. Use the REST API or TypeScript SDK
Body field
Type
Description
origin required
object
Center point: { lat, lng }
minutes required
number[]
Travel time contours in minutes (1–4 values, each 1–60)
1–4 items
profile
string
Travel mode: driving, walking, or cycling. Default driving.
values: driving, walking, cyclingdefault driving
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited

Snap to Roads

POST
/logistics/routing/snap
logistics:read0.0000008 tokens per ping

Correct raw GPS coordinates by matching to the road network.

curl
curl -X POST https://api.saasignal.saastemly.com/logistics/routing/snap \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"pings":[]}'
json — 200 OK
{ "status": "ok" }
typescript
const snapped = await ss.logistics.routing.snap([
  { lat: 40.7128, lng: -74.0060 },
  { lat: 40.7135, lng: -74.0055 },
])
  1. Snap to roads is an API-only operation
  2. Use the REST API or TypeScript SDK
Body field
Type
Description
pings required
array
GPS points to snap, each { lat, lng, recorded_at? } (2–100 points)
2–100 items
profile
string
Travel mode: driving, walking, or cycling. Default driving.
values: driving, walking, cyclingdefault driving
Error responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited