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
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
- Routing endpoints are API-only
- 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 requiredobject
Start point:
{ lat: number (−90 to 90), lng: number (−180 to 180) }destination requiredobject
End point:
{ lat: number (−90 to 90), lng: number (−180 to 180) }waypointsarray
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
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
- Stop optimization is an API-only operation
- Use the REST API or TypeScript SDK
Body field
Type
Description
origin requiredobject
Starting point:
{ lat, lng }stops requiredarray
Stops to optimize, each
{ lat, lng } (1–12 stops)1–12 items
destinationobject
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
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
- Distance matrix is an API-only operation
- Use the REST API or TypeScript SDK
Body field
Type
Description
origins requiredarray
Source locations, each
{ lat, lng } (1–25 points)1–25 items
destinations requiredarray
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
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 }],
)
- Auto-dispatch is an API-only operation
- Use the REST API or TypeScript SDK
Body field
Type
Description
agents requiredarray
Available agents, each
{ id: string (≥ 1 char), lat: number, lng: number } (1–25 agents)1–25 items
tasks requiredarray
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
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',
)
- Isochrone generation is an API-only operation
- Use the REST API or TypeScript SDK
Body field
Type
Description
origin requiredobject
Center point:
{ lat, lng }minutes requirednumber[]
Travel time contours in minutes (1–4 values, each 1–60)
1–4 items
profilestring
Travel mode:
driving, walking, or cycling. Default driving.values:
driving, walking, cyclingdefault drivingError responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited
Snap to Roads
POST
/logistics/routing/snap
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 },
])
- Snap to roads is an API-only operation
- Use the REST API or TypeScript SDK
Body field
Type
Description
pings requiredarray
GPS points to snap, each
{ lat, lng, recorded_at? } (2–100 points)2–100 items
profilestring
Travel mode:
driving, walking, or cycling. Default driving.values:
driving, walking, cyclingdefault drivingError responses
401 Unauthorized
402 Insufficient tokens
429 Rate limited