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
GET
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)Error responses
400 Invalid body (validation error)
401 Unauthorized
402 Insufficient Tokens
429 Rate Limited
Optimize Stops
GET
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)destinationobject
Optional return point:
{ lat, lng }. If omitted, route ends at the last optimized stop.Error responses
400 Invalid body (validation error)
401 Unauthorized
402 Insufficient Tokens
429 Rate Limited
Distance Matrix
GET
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)destinations requiredarray
Target locations, each
{ lat, lng } (1–25 points)Error responses
400 Invalid body (validation error)
401 Unauthorized
402 Insufficient Tokens
429 Rate Limited
Auto-Dispatch
GET
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)tasks requiredarray
Tasks to assign, each
{ id: string (≥ 1 char), lat: number, lng: number } (1–25 tasks)Error responses
400 Invalid body (validation error)
401 Unauthorized
402 Insufficient Tokens
429 Rate Limited
Isochrone
GET
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)
profilestring
Travel mode:
driving, walking, or cycling. Default driving.Error responses
400 Invalid body (validation error)
401 Unauthorized
402 Insufficient Tokens
429 Rate Limited
Snap to Roads
GET
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)profilestring
Travel mode:
driving, walking, or cycling. Default driving.Error responses
400 Invalid body (validation error)
401 Unauthorized
402 Insufficient Tokens
429 Rate Limited