S
Stower API Docs
Wise-style • Auto reference sections

API Documentation

Reference documentation for the Logistics Engine optimization service (routing + loading).

Base URL: https://api.stower.dev
Generated: 2026-01-04 00:52:43

Authentication

Authenticate requests using an API key in either header:

Authorization: Bearer <API_KEY>
X-API-Key: <API_KEY>

Idempotency

For safe retries on submissions, send an idempotency header:

Idempotency-Key: <unique value>
X-Idempotency-Key: <unique value>

HTTP response codes and errors

CodeMeaning
200Success
400Bad request / validation error
401Missing/invalid credentials
403Insufficient role/permissions
404Not found
409Conflict (e.g., idempotency key reused with different payload)
429Rate limit / tenant concurrency admission rejected
503Service unavailable / draining

Error format is JSON:

{
  "detail": "human-readable message"
}

Reference

Parameter groups used by the optimization API.

Policies

Feature flags and behavior knobs that influence routing/packing and solver strategy. Pass under policies in requests (where supported).

KeyTypeRequiredDefaultDescription
aisle_prioritybooleanNoBias routing/servicing decisions using aisle or service-order preferences when applicable.
center_balance_modebooleanNo
enable_voxel_nestingbooleanNo
fragile_separationbooleanNo
objectiveobjectNo
objective_namestringNo
rear_load_biasbooleanNoBias packing toward rear-loading preference (may affect packing efficiency).
spread_itemsbooleanNo
strap_prioritybooleanNo
voxel_pitch_innumberNo
vrp_lnsobjectNoOptional VRP Large Neighborhood Search (LNS) tuning object. Also accepted as top-level config.vrp_lns and mirrored into policies.vrp_lns.

Example

{
  "policies": {
    "rear_load_bias": true,
    "center_balance_mode": true,
    "spread_items": true,
    "aisle_priority": true,
    "strap_priority": true,
    "fragile_separation": true,
    "enable_voxel_nesting": true,
    "voxel_pitch_in": 2.0,
    "objective_name": "minimize_miles",
    "objective": {
      "name": "minimize_miles",
      "truck_fixed_cost_miles": 60.0,
      "weights": {
        "total_miles": 1.0,
        "trucks_used": 8.0,
        "unplaced_items": 250.0
      }
    }
  }
}

Objective

Controls the optimization objective (cost function) and related weights/presets. Pass under objective in requests (where supported).

KeyTypeRequiredDefaultDescription
namestringNo
truck_fixed_cost_milesnumberNo
weightsobjectNo

Example

{
  "objective": {
    "truck_fixed_cost_miles": 60.0,
    "weights": {
      "total_miles": 1.0,
      "trucks_used": 8.0,
      "unplaced_items": 250.0,
      "weight_distribution_penalty": 3.0,
      "fragile_violation_penalty": 6.0
    }
  }
}

Metaheuristic

Advanced solver settings (GA, local search, etc.). Usually for expert tuning. Pass under metaheuristic in requests (where supported).

KeyTypeRequiredDefaultDescription
elite_fractionnumberNo
enable_gabooleanNo
generationsintegerNo
mutation_ratenumberNo
population_sizeintegerNo

Example

{
  "metaheuristic": {
    "enable_ga": true,
    "population_size": 12,
    "generations": 6,
    "elite_fraction": 0.25,
    "mutation_rate": 0.35
  }
}

Safety profile

Safety preferences for routing/packing (e.g., stability, fragile handling). Pass under safety_profile in requests (where supported).

KeyTypeRequiredDefaultDescription
allowed_tagsarrayNo
max_height_ftnumberNo
max_vehicle_length_ftintegerNo
oversize_thresholdsobjectNo
prohibited_access_flagsarrayNo
prohibited_road_tags_for_hazmatarrayNo

Example

{
  "safety_profile": {
    "max_vehicle_length_ft": 26,
    "max_height_ft": 12.5,
    "allowed_tags": [
      "highway",
      "arterial",
      "industrial",
      "residential"
    ],
    "prohibited_access_flags": [
      "no_26ft"
    ],
    "prohibited_road_tags_for_hazmat": [
      "tunnel",
      "bridge_restricted"
    ],
    "oversize_thresholds": {
      "max_single_piece_weight_lbs": 2500.0,
      "max_single_piece_length_in": 192.0,
      "max_single_piece_width_in": 96.0,
      "max_single_piece_height_in": 84.0,
      "near_limit_pct": 0.92,
      "permit_weight_lbs": 5000.0,
      "permit_length_in": 240.0,
      "permit_width_in": 102.0,
      "permit_height_in": 96.0
    }
  }
}

Constraints

Hard/soft constraints applied during routing/packing. Pass under constraints in requests (where supported).

KeyTypeRequiredDefaultDescription
bottom_layerbooleanNo
front_loadbooleanNo
rear_loadbooleanNo
top_layerbooleanNo
z_bandstringNo

Example

{
  "constraints": {
    "bottom_layer": true,
    "top_layer": false,
    "front_load": false,
    "rear_load": true,
    "z_band": "bottom"
  }
}

Hazmat

Hazardous materials configuration and compatibility rules. Pass under hazmat in requests (where supported).

KeyTypeRequiredDefaultDescription
classobjectNo
enabledbooleanNo
incompatible_witharrayNo
packing_groupobjectNo
requires_separation_innumberNo
un_numberobjectNo

Example

{
  "hazmat": {
    "enabled": false,
    "class": null,
    "un_number": null,
    "packing_group": null,
    "incompatible_with": [],
    "requires_separation_in": 6.0
  }
}

Policies patch

Patch-style overrides applied on top of effective policies (scenario overrides). Pass under policies_patch in requests (where supported).

KeyTypeRequiredDefaultDescription
center_balance_modebooleanNo
fragile_separationbooleanNo
objective_namestringNo
rear_load_biasbooleanNo

Zones

Geographic zones, service areas, and zone-based constraints. Pass under zones in requests (where supported).

KeyTypeRequiredDefaultDescription
temperaturestringNo

Example

{
  "zones": {
    "temperature": "ambient"
  }
}

Public API

POST /optimize Optimize (sync)

Run routing + packing synchronously. Best for smaller payloads or when you need an immediate response.

Auth
Query
_job_id, _run_id, _bypass_cache (default false)
Authorization: Bearer or X-API-Key
Request body
💡 Use Idempotency-Key for safe retries.
💡 For large payloads, prefer /optimize_async.
Try it
Runs in your browser (CORS must allow it).
POST /optimize/validate Validate request

Validate an OptimizeRequest without running the solver.

Auth
Authorization: Bearer or X-API-Key
Request body
💡 Useful in CI/integration tests to catch schema issues early.
Try it
Runs in your browser (CORS must allow it).
POST /optimize_async Optimize (async)

Submit an optimization job for asynchronous processing. Returns a job_id.

Auth
Authorization: Bearer or X-API-Key
Request body
💡 Poll status and result endpoints.
💡 Use Idempotency-Key for safe retries of submissions.
Try it
Runs in your browser (CORS must allow it).
GET /optimize_async/status/{job_id} Async status

Get state/stage/progress snapshot for an async job.

Auth
Path
job_id
Authorization: Bearer or X-API-Key
GET /optimize_async/result/{job_id} Async result

Fetch final result for a completed async job (or a status object if still running).

Auth
Path
job_id
Authorization: Bearer or X-API-Key
GET /optimize_async/payload/{job_id} Async payload

Fetch the original (redacted) request payload for an async job (if stored).

Auth
Authorization: Bearer or X-API-Key
Path
job_id
GET /optimize_async/events/{job_id} Async events (SSE)

Server-Sent Events stream of progress updates.

Auth
Path
job_id
Authorization: Bearer or X-API-Key
💡 Consumes as text/event-stream.
POST /optimize_async/cancel/{job_id} Cancel async job

Request cancellation of an in-progress job (best-effort).

Auth
Path
job_id
Authorization: Bearer or X-API-Key
POST /optimize_scenarios Optimize scenarios

Run multiple scenario variants and return per-scenario results.

Auth
Authorization: Bearer or X-API-Key
💡 Supports legacy shapes (vehicles/orders aliases) and optional RFC6902 jsonpatch.
💡 Alias: /optimize-scenarios
Try it
Runs in your browser (CORS must allow it).

Tenant

GET /tenant/me Tenant identity

Return resolved tenant identity and policy snapshot.

Auth
Authorization: Bearer or X-API-Key
GET /tenant/usage Tenant usage

Return tenant usage metrics and quota/capacity limits.

Auth
Query
days (default 30)
Authorization: Bearer or X-API-Key
GET /tenant/audit Tenant audit

Return tenant-scoped audit events.

Auth
Query
days (default 30), top_n (default 10)
Authorization: Bearer or X-API-Key
GET /runs Runs list

List recent optimization runs for the resolved tenant (most recent first).

Auth
Authorization: Bearer or X-API-Key
Query
limit (default 50), since_ms, until_ms
GET /runs/{run_id} Run detail

Fetch a decision-traceability record for a specific run_id (tenant-scoped).

Auth
Authorization: Bearer or X-API-Key
Path
run_id
GET /runs/{run_id}/explain Run explain

Fetch explainability artifacts for a run (e.g., unassigned stops / unplaced items).

Auth
Authorization: Bearer or X-API-Key
Path
run_id
Query
limit (default 1000), artifact_type
POST /runs/{run_id}/replay Run replay

Re-run a prior optimization run (server-side replay) using the stored payload/snapshot (tenant-scoped).

Auth
Authorization: Bearer or X-API-Key
Path
run_id
GET /audit Audit events

Append-only audit event stream for the resolved tenant (filterable).

Auth
Authorization: Bearer or X-API-Key
Query
limit (default 200), since_ms, until_ms, action, request_id, run_id, user_id

Org & Membership

Endpoints for managing organizations, user memberships, and inter-org relationships. Orgs can be of type THREE_PL, SHIPPER, or CARRIER. Relationships between orgs (e.g. a 3PL linking to a shipper) use a two-step invite/approve flow. User memberships use a single invite/accept flow. All write endpoints require tenant:write scope; read endpoints require tenant:read.

POST /org/tenants Create org

Create a new organization. org_type must be one of THREE_PL, SHIPPER, or CARRIER. Invite policies default to MANUAL.

Auth
Authorization: Bearer or X-API-Key — scope tenant:write
Body
application/jsonOrgCreateRequest
Fields
name, org_type, invite_policy_shipper (AUTO_ACCEPT|MANUAL), invite_policy_carrier, plus contact fields: email, phone, address, city, state, zipCode, country (ISO-3), lat, lng
GET /org/auth/whoami Auth whoami

Return the resolved actor identity for the current request — useful for verifying which user ID is being inferred from the auth token.

Auth
Authorization: Bearer or X-API-Key — scope tenant:read
POST /org/memberships/invite Invite member

Invite a user to join an org by email. The invitee receives a token they must submit to /org/invites/accept. role is granted upon acceptance.

Auth
Authorization: Bearer or X-API-Key — scope tenant:write
Body
application/jsonMembershipInviteRequest
Fields
org_id, invitee_email, role (OWNER | ADMIN | SHIPPER_MANAGER | CARRIER_MANAGER | FLEET_MANAGER | DISPATCHER | DRIVER | VIEWER), inviter_user_id (optional — resolved from auth if omitted)
POST /org/memberships/list List members

Return all members of an org with their roles and statuses.

Auth
Authorization: Bearer or X-API-Key — scope tenant:read
Body
application/json{"org_id": "..."}
POST /org/relationships/invite Invite relationship

Initiate a relationship between two orgs (e.g. a 3PL linking to a shipper or carrier). The invitee org must approve via /org/relationships/approve unless their invite_policy is AUTO_ACCEPT.

Auth
Authorization: Bearer or X-API-Key — scope tenant:write
Body
application/jsonRelationshipInviteRequest
Fields
from_org_id, to_org_id, relationship_kind (SHIPPER|CARRIER), invitee_email, inviter_user_id (optional)
POST /org/relationships/approve Approve relationship

Approve a pending inter-org relationship invite. Only needed when the invitee org's invite_policy is MANUAL.

Auth
Authorization: Bearer or X-API-Key — scope tenant:write
Body
application/jsonApproveRelationshipRequest
Fields
from_org_id, to_org_id, relationship_kind, approver_user_id (optional)
POST /org/invites/accept Accept invite

Accept a membership or relationship invite using the token from the invite response. Works for both USER_MEMBERSHIP and TENANT_RELATIONSHIP invite kinds.

Auth
Authorization: Bearer or X-API-Key — scope tenant:write
Body
application/jsonAcceptInviteRequest
Fields
token, acceptor_email, acceptor_user_id (optional — resolved from auth if omitted)

Reseller

Endpoints for reseller tenants to provision and manage customer sub-tenants and their API keys. All endpoints require the reseller:admin scope and authenticate via the reseller's own API key. Child tenant key prefixes must start with {reseller_prefix}__.

GET /reseller/tenants List customer tenants

Return all customer tenants owned by the authenticated reseller, scoped to the reseller prefix namespace.

Auth
X-API-Key with reseller:admin scope
POST /reseller/tenants Create customer tenant

Create or upsert a customer tenant under the reseller namespace. Entitlements are automatically clamped to the reseller policy. key_prefix must start with {reseller_prefix}__.

Auth
X-API-Key with reseller:admin scope
Body
application/jsonResellerTenantCreate
POST /reseller/tenants/{key_prefix}/suspend Set tenant status

Update the status of a customer tenant (active, suspended, or disabled). The tenant must be in the reseller namespace.

Auth
X-API-Key with reseller:admin scope
Path
key_prefix
Body
application/jsonResellerTenantSuspend
POST /reseller/tenants/{key_prefix}/keys Create customer API key

Issue a new API key for a customer tenant. Scopes are clamped to the tenant's allowed_scopes policy. Requires the API key store to be enabled.

Auth
X-API-Key with reseller:admin scope
Path
key_prefix
Body
application/jsonResellerKeyCreate

Ops

GET /health Health

Liveness endpoint.

Auth
Authorization: Bearer or X-API-Key
GET /readyz Readiness

Readiness endpoint.

Auth
Authorization: Bearer or X-API-Key
GET /metrics Prometheus metrics

Prometheus text exposition format.

Auth
Authorization: Bearer or X-API-Key
GET /objectives Objectives

List supported objective presets.

Auth
Authorization: Bearer or X-API-Key
GET /capacity Capacity

Capacity snapshot (slots, draining state).

Auth
Authorization: Bearer or X-API-Key

Model definitions

Schema reference derived from Pydantic models.

OptimizeRequest

FieldTypeRequiredDefaultDescription
configOptimizationConfigYes
trucksList[Truck]Yes
jobsList[Job]Yes

OptimizeScenariosRequest

FieldTypeRequiredDefaultDescription
configOptimizationConfigYes
trucksList[Truck]Yes
jobsList[Job]Yes
scenariosList[ScenarioSpec]YesList of what-if scenarios to evaluate.
optionsMap[string, object]NoOptional controls, e.g. {include_plans:false, max_scenarios:8}.

OptimizationConfig

FieldTypeRequiredDefaultDescription
api_keystringYes
depot_addressstringYes
depot_latnumberYes
depot_lngnumberYes
async_stop_thresholdintegerNo40
auto_tuningbooleanNofalse
break_rulesMap[string, integer]No
debugbooleanNofalse
enforce_geometrybooleanNotrue
feasibility_prover_core_secondsnumberNo1.0
feasibility_prover_enabledbooleanNotrue
feasibility_prover_extract_corebooleanNotrue
feasibility_prover_include_witnessbooleanNofalse
feasibility_prover_max_itemsintegerNo18
feasibility_prover_max_secondsnumberNo2.0
google_api_keystring | nullNo
include_actionable_recommendationsbooleanNotrue
include_feasibility_explanationsbooleanNotrue
lifo_modestringNo"soft"
max_auto_passesintegerNo1
metaheuristicMap[string, object]No
objectiveobject | nullNo
objective_namestring | nullNo
policiesMap[string, object]No
priority_modestringNo"soft"
quality_weightsMap[string, number] | nullNo
securement_checks_enabledbooleanNofalse
securement_default_strap_wll_lbsnumberNo3333.0
seedinteger | nullNo
soft_tw_penalty_per_minuteintegerNo5
time_window_modestringNo"hard"
timezonestringNo"America/New_York"
travel_matrixTravelMatrixConfigNo
travel_modestringNo"driving"
two_man_lift_enabledbooleanNofalse
two_man_lift_threshold_lbsnumberNo75.0
unit_systemstringNo"imperial"
vrp_lnsMap[string, object] | nullNo
webhook_urlstring | nullNo

TravelMatrixConfig

FieldTypeRequiredDefaultDescription
cache_max_entriesintegerNo200000
cache_ttl_secintegerNo21600
departure_timestring | nullNo
fallback_to_haversinebooleanNotrue
max_elements_per_requestintegerNo625
osrm_base_urlstringNo"https://router.project-osrm.org"
osrm_profilestring | nullNo
providerstringNo"haversine"
routing_preferencestring | nullNo
timeout_secnumberNo15.0
trafficbooleanNofalse

Truck

FieldTypeRequiredDefaultDescription
truck_idstringYes
truck_typestringYes
start_locationstringYes
crew_sizeintegerNo1
dimsMap[string, number]No
dock_height_modestringNo"either"
has_dollybooleanNofalse
has_liftgatebooleanNofalse
has_pallet_jackbooleanNofalse
hazmat_profileMap[string, object]No
loading_sidesList[string]No
max_cargo_volumenumber | nullNo
max_cargo_weightnumberNo34000.0
max_durationintegerNo43200
max_milesnumberNo500.0
max_stopsintegerNo99
safety_profileMap[string, object]No
start_timestringNo"08:00"
trailer_profilestring | nullNo
zonesMap[string, object]No

Job

FieldTypeRequiredDefaultDescription
job_idintegerYes
exclusive_truck_idsList[string] | nullNo
priorityintegerNo1
stopsList[Stop]No

Stop

FieldTypeRequiredDefaultDescription
stop_idstringYes
typestringYes
latnumberYes
lngnumberYes
access_restrictionsList[string]No
addressstringNo""
dock_heightstring | nullNo
earlieststring | nullNo
itemsList[Item]No
lateststring | nullNo
loading_sidestring | nullNo
pickup_delivery_idstring | nullNo
requires_dollyboolean | nullNo
requires_liftgateboolean | nullNo
requires_pallet_jackboolean | nullNo
safety_tagsList[string]No
service_time_secinteger | nullNo

Item

FieldTypeRequiredDefaultDescription
item_idstringYes
allowed_orientationsList[string]No
assembly_idstring | nullNo
can_accept_underloadbooleanNofalse
can_nest_withList[string]No
constraintsMap[string, object] | nullNo
dimsDimensionsNo
fragilebooleanNofalse
hazmatMap[string, object] | nullNo
is_nestablebooleanNofalse
is_top_flatbooleanNotrue
item_classstringNo"generic"
job_idinteger | nullNo
max_stack_weightnumberNo99999.0
max_tierintegerNo10
mesh_formatstring | nullNo
mesh_urlstring | nullNo
position_constraintstringNo"none"
stack_group_idstring | nullNo
stack_membersList[string] | nullNo
stackablebooleanNotrue
stop_idstring | nullNo
stop_seq_indexinteger | nullNo
strap_requiredbooleanNofalse
temperature_zonestring | nullNo
tilt_modesList[string]No
volumenumberNo0.0
weightnumberNo0.0

Dimensions

FieldTypeRequiredDefaultDescription
hnumberNo0.0
lnumberNo0.0
wnumberNo0.0

ScenarioSpec

FieldTypeRequiredDefaultDescription
scenario_idstringYesStable scenario identifier (client-provided).
jsonpatchList[Map[string, object]] | nullNoRFC 6902 JSON Patch operations to apply to the full payload for this scenario.
labelstring | nullNoHuman label for display.
objectiveobject | nullNoObjective override for this scenario.
objective_namestring | nullNoObjective name override (alias).
policies_patchMap[string, object] | nullNoDeep-merge patch to apply to config.policies for this scenario (overrides baseline).

Examples

Optimize (minimal)

{
  "config": {
    "api_key": "test_api_key_123",
    "depot_address": "350 5th Ave, New York, NY 10118",
    "depot_lat": 40.7484,
    "depot_lng": -73.9857
  },
  "trucks": [
    {
      "truck_id": "T26-001",
      "truck_type": "box-26",
      "start_location": "350 5th Ave, New York, NY 10118",
      "start_time": "08:00"
    }
  ],
  "jobs": [
    {
      "job_id": 1,
      "priority": 1,
      "stops": [
        {
          "stop_id": "S1",
          "type": "delivery",
          "address": "11 Wall St, New York, NY 10005",
          "lat": 40.7074,
          "lng": -74.0113,
          "items": []
        }
      ]
    }
  ]
}

Optimize (full — all params)

{
  "config": {
    "api_key": "test_api_key_123",
    "depot_address": "350 5th Ave, New York, NY 10118",
    "depot_lat": 40.7484,
    "depot_lng": -73.9857,
    "travel_mode": "driving",
    "unit_system": "imperial",
    "timezone": "America/New_York",
    "objective_name": "minimize_miles",
    "objective": {
      "truck_fixed_cost_miles": 60.0,
      "weights": {
        "total_miles": 1.0,
        "trucks_used": 8.0,
        "unplaced_items": 250.0,
        "weight_distribution_penalty": 3.0,
        "fragile_violation_penalty": 6.0
      }
    },
    "travel_matrix": {
      "provider": "haversine",
      "osrm_base_url": "https://router.project-osrm.org",
      "osrm_profile": "driving",
      "traffic": true,
      "departure_time": "2026-01-02T08:00:00-05:00",
      "routing_preference": "TRAFFIC_AWARE",
      "timeout_sec": 12.0,
      "fallback_to_haversine": true,
      "max_elements_per_request": 625,
      "cache_ttl_sec": 7200,
      "cache_max_entries": 50000
    },
    "google_api_key": "TEST_GOOGLE_KEY",
    "seed": 12345,
    "webhook_url": "https://example.com/webhook",
    "async_stop_threshold": 10,
    "two_man_lift_enabled": true,
    "two_man_lift_threshold_lbs": 100.0,
    "break_rules": {
      "mandatory_break_duration": 1800,
      "drive_time_before_break": 10800
    },
    "enforce_geometry": true,
    "priority_mode": "hard",
    "lifo_mode": "hard",
    "securement_checks_enabled": true,
    "securement_default_strap_wll_lbs": 2500.0,
    "time_window_mode": "soft",
    "soft_tw_penalty_per_minute": 10,
    "policies": {
      "rear_load_bias": true,
      "center_balance_mode": true,
      "spread_items": true,
      "aisle_priority": true,
      "strap_priority": true,
      "fragile_separation": true,
      "enable_voxel_nesting": true,
      "voxel_pitch_in": 2.0,
      "objective_name": "minimize_miles",
      "objective": {
        "name": "minimize_miles",
        "truck_fixed_cost_miles": 60.0,
        "weights": {
          "total_miles": 1.0,
          "trucks_used": 8.0,
          "unplaced_items": 250.0
        }
      }
    },
    "auto_tuning": true,
    "max_auto_passes": 2,
    "debug": true,
    "metaheuristic": {
      "enable_ga": true,
      "population_size": 12,
      "generations": 6,
      "elite_fraction": 0.25,
      "mutation_rate": 0.35
    },
    "quality_weights": {
      "routing_weight": 0.55,
      "loading_weight": 0.45
    },
    "include_feasibility_explanations": true,
    "include_actionable_recommendations": true
  },
  "trucks": [
    {
      "truck_id": "T26-001",
      "truck_type": "box-26",
      "start_location": "350 5th Ave, New York, NY 10118",
      "start_time": "08:00",
      "crew_size": 2,
      "dims": {
        "l": 312.0,
        "w": 96.0,
        "h": 96.0
      },
      "max_miles": 180.0,
      "max_duration": 36000,
      "max_stops": 30,
      "max_cargo_weight": 12000.0,
      "max_cargo_volume": 1400.0,
      "trailer_profile": "box-26",
      "has_liftgate": true,
      "has_pallet_jack": true,
      "has_dolly": true,
      "dock_height_mode": "either",
      "loading_sides": [
        "rear",
        "side"
      ],
      "safety_profile": {
        "max_vehicle_length_ft": 26,
        "max_height_ft": 12.5,
        "allowed_tags": [
          "highway",
          "arterial",
          "industrial",
          "residential"
        ],
        "prohibited_access_flags": [
          "no_26ft"
        ],
        "prohibited_road_tags_for_hazmat": [
          "tunnel",
          "bridge_restricted"
        ],
        "oversize_thresholds": {
          "max_single_piece_weight_lbs": 2500.0,
          "max_single_piece_length_in": 192.0,
          "max_single_piece_width_in": 96.0,
          "max_single_piece_height_in": 84.0,
          "near_limit_pct": 0.92,
          "permit_weight_lbs": 5000.0,
          "permit_length_in": 240.0,
          "permit_width_in": 102.0,
          "permit_height_in": 96.0
        }
      },
      "hazmat_profile": {
        "enabled": true,
        "allowed_classes": [
          "3",
          "8"
        ],
        "max_hazmat_weight": 600.0
      },
      "zones": {
        "temperature": "ambient"
      }
    },
    {
      "truck_id": "T53-001",
      "truck_type": "dry-van-53",
      "start_location": "350 5th Ave, New York, NY 10118",
      "start_time": "07:30",
      "crew_size": 1,
      "dims": {
        "l": 636.0,
        "w": 100.0,
        "h": 110.0
      },
      "max_miles": 450.0,
      "max_duration": 43200,
      "max_stops": 60,
      "max_cargo_weight": 34000.0,
      "max_cargo_volume": null,
      "trailer_profile": "dry-van-53",
      "has_liftgate": false,
      "has_pallet_jack": false,
      "has_dolly": false,
      "dock_height_mode": "dock",
      "loading_sides": [
        "rear"
      ],
      "safety_profile": {
        "max_vehicle_length_ft": 53,
        "max_height_ft": 13.5,
        "allowed_tags": [
          "highway",
          "arterial",
          "industrial"
        ],
        "prohibited_access_flags": [
          "no_53ft"
        ],
        "prohibited_road_tags_for_hazmat": [
          "tunnel",
          "bridge_restricted"
        ],
        "oversize_thresholds": {
          "max_single_piece_weight_lbs": 4000.0,
          "max_single_piece_length_in": 240.0,
          "max_single_piece_width_in": 96.0,
          "max_single_piece_height_in": 96.0,
          "near_limit_pct": 0.92,
          "permit_weight_lbs": 8000.0,
          "permit_length_in": 360.0,
          "permit_width_in": 102.0,
          "permit_height_in": 108.0
        }
      },
      "hazmat_profile": {
        "enabled": false,
        "allowed_classes": [],
        "max_hazmat_weight": 1000.0
      },
      "zones": {
        "temperature": "ambient"
      }
    }
  ],
  "jobs": [
    {
      "job_id": 101,
      "priority": 2,
      "stops": [
        {
          "stop_id": "S-101-P1",
          "type": "pickup",
          "address": "1 Liberty Island, New York, NY 10004",
          "lat": 40.6892,
          "lng": -74.0445,
          "earliest": "2026-01-02T08:30:00-05:00",
          "latest": "2026-01-02T10:30:00-05:00",
          "service_time_sec": 900,
          "items": [],
          "pickup_delivery_id": "PD-101",
          "safety_tags": [
            "industrial"
          ],
          "access_restrictions": [],
          "requires_liftgate": null,
          "requires_pallet_jack": null,
          "requires_dolly": null,
          "dock_height": "ground",
          "loading_side": "rear"
        },
        {
          "stop_id": "S-101-D1",
          "type": "delivery",
          "address": "200 Central Park West, New York, NY 10024",
          "lat": 40.7813,
          "lng": -73.9735,
          "earliest": "2026-01-02T11:00:00-05:00",
          "latest": "2026-01-02T14:30:00-05:00",
          "service_time_sec": 1200,
          "items": [
            {
              "item_id": "SOFA-3SEAT-001",
              "weight": 180.0,
              "volume": 90.0,
              "dims": {
                "l": 84.0,
                "w": 38.0,
                "h": 34.0
              },
              "item_class": "upholstery",
              "stackable": false,
              "is_top_flat": false,
              "fragile": false,
              "max_stack_weight": 0.0,
              "max_tier": 1,
              "position_constraint": "bottom",
              "allowed_orientations": [
                "upright"
              ],
              "tilt_modes": [
                "upright"
              ],
              "strap_required": true,
              "assembly_id": "LIVING-SET-A",
              "mesh_url": null,
              "mesh_format": null,
              "can_accept_underload": false,
              "is_nestable": false,
              "can_nest_with": [],
              "job_id": 101,
              "stop_id": "S-101-D1",
              "stop_seq_index": 1,
              "stack_group_id": null,
              "stack_members": null,
              "hazmat": {
                "enabled": false,
                "class": null,
                "un_number": null,
                "packing_group": null,
                "incompatible_with": [],
                "requires_separation_in": 6.0
              },
              "constraints": {
                "bottom_layer": true,
                "top_layer": false,
                "front_load": false,
                "rear_load": true,
                "z_band": "bottom"
              },
              "temperature_zone": "ambient"
            },
            {
              "item_id": "TABLE-GLASS-002",
              "weight": 120.0,
              "volume": 40.0,
              "dims": {
                "l": 60.0,
                "w": 36.0,
                "h": 30.0
              },
              "item_class": "glass",
              "stackable": false,
              "is_top_flat": true,
              "fragile": true,
              "max_stack_weight": 0.0,
              "max_tier": 1,
              "position_constraint": "rear",
              "allowed_orientations": [
                "upright",
                "rotated"
              ],
              "tilt_modes": [
                "upright",
                "side"
              ],
              "strap_required": true,
              "assembly_id": null,
              "mesh_url": null,
              "mesh_format": null,
              "can_accept_underload": false,
              "is_nestable": false,
              "can_nest_with": [],
              "job_id": 101,
              "stop_id": "S-101-D1",
              "stop_seq_index": 1,
              "stack_group_id": null,
              "stack_members": null,
              "hazmat": {
                "enabled": false,
                "class": null,
                "un_number": null,
                "packing_group": null,
                "incompatible_with": [],
                "requires_separation_in": 6.0
              },
              "constraints": {
                "bottom_layer": false,
                "top_layer": true,
                "front_load": false,
                "rear_load": false,
                "z_band": "top"
              },
              "temperature_zone": "ambient"
            }
          ],
          "pickup_delivery_id": "PD-101",
          "safety_tags": [
            "residential"
          ],
          "access_restrictions": [
            "no_53ft"
          ],
          "requires_liftgate": true,
          "requires_pallet_jack": false,
          "requires_dolly": true,
          "dock_height": "ground",
          "loading_side": "either"
        }
      ],
      "exclusive_truck_ids": [
        "T26-001"
      ]
    },
    {
      "job_id": 202,
      "priority": 1,
      "stops": [
        {
          "stop_id": "S-202-D1",
          "type": "delivery",
          "address": "10 Exchange Pl, Jersey City, NJ 07302",
          "lat": 40.7163,
          "lng": -74.0334,
          "earliest": "2026-01-02T09:00:00-05:00",
          "latest": "2026-01-02T12:00:00-05:00",
          "service_time_sec": 600,
          "items": [
            {
              "item_id": "PAINT-5GAL-UN1263",
              "weight": 55.0,
              "volume": 2.0,
              "dims": {
                "l": 14.0,
                "w": 14.0,
                "h": 18.0
              },
              "item_class": "hazmat",
              "stackable": true,
              "is_top_flat": true,
              "fragile": false,
              "max_stack_weight": 500.0,
              "max_tier": 4,
              "position_constraint": "none",
              "allowed_orientations": [
                "upright",
                "rotated"
              ],
              "tilt_modes": [
                "upright"
              ],
              "strap_required": false,
              "assembly_id": null,
              "mesh_url": null,
              "mesh_format": null,
              "can_accept_underload": true,
              "is_nestable": true,
              "can_nest_with": [
                "hazmat",
                "generic"
              ],
              "job_id": 202,
              "stop_id": "S-202-D1",
              "stop_seq_index": 0,
              "stack_group_id": "STACK-PAINT-1",
              "stack_members": [
                "PAINT-5GAL-UN1263"
              ],
              "hazmat": {
                "enabled": true,
                "class": "3",
                "un_number": "UN1263",
                "packing_group": "II",
                "incompatible_with": [
                  "5.1"
                ],
                "requires_separation_in": 12.0
              },
              "constraints": {
                "bottom_layer": true,
                "top_layer": false,
                "front_load": true,
                "rear_load": false,
                "z_band": null
              },
              "temperature_zone": "ambient"
            }
          ],
          "pickup_delivery_id": null,
          "safety_tags": [
            "industrial"
          ],
          "access_restrictions": [],
          "requires_liftgate": false,
          "requires_pallet_jack": true,
          "requires_dolly": false,
          "dock_height": "dock",
          "loading_side": "rear"
        }
      ],
      "exclusive_truck_ids": null
    }
  ]
}

Optimize scenarios

{
  "base_request": {
    "config": {
      "api_key": "test_api_key_123",
      "depot_address": "350 5th Ave, New York, NY 10118",
      "depot_lat": 40.7484,
      "depot_lng": -73.9857,
      "travel_mode": "driving",
      "unit_system": "imperial",
      "timezone": "America/New_York",
      "objective_name": "minimize_miles",
      "objective": {
        "truck_fixed_cost_miles": 60.0,
        "weights": {
          "total_miles": 1.0,
          "trucks_used": 8.0,
          "unplaced_items": 250.0,
          "weight_distribution_penalty": 3.0,
          "fragile_violation_penalty": 6.0
        }
      },
      "travel_matrix": {
        "provider": "haversine",
        "osrm_base_url": "https://router.project-osrm.org",
        "osrm_profile": "driving",
        "traffic": true,
        "departure_time": "2026-01-02T08:00:00-05:00",
        "routing_preference": "TRAFFIC_AWARE",
        "timeout_sec": 12.0,
        "fallback_to_haversine": true,
        "max_elements_per_request": 625,
        "cache_ttl_sec": 7200,
        "cache_max_entries": 50000
      },
      "google_api_key": "TEST_GOOGLE_KEY",
      "seed": 12345,
      "webhook_url": "https://example.com/webhook",
      "async_stop_threshold": 10,
      "two_man_lift_enabled": true,
      "two_man_lift_threshold_lbs": 100.0,
      "break_rules": {
        "mandatory_break_duration": 1800,
        "drive_time_before_break": 10800
      },
      "enforce_geometry": true,
      "priority_mode": "hard",
      "lifo_mode": "hard",
      "securement_checks_enabled": true,
      "securement_default_strap_wll_lbs": 2500.0,
      "time_window_mode": "soft",
      "soft_tw_penalty_per_minute": 10,
      "policies": {
        "rear_load_bias": true,
        "center_balance_mode": true,
        "spread_items": true,
        "aisle_priority": true,
        "strap_priority": true,
        "fragile_separation": true,
        "enable_voxel_nesting": true,
        "voxel_pitch_in": 2.0,
        "objective_name": "minimize_miles",
        "objective": {
          "name": "minimize_miles",
          "truck_fixed_cost_miles": 60.0,
          "weights": {
            "total_miles": 1.0,
            "trucks_used": 8.0,
            "unplaced_items": 250.0
          }
        }
      },
      "auto_tuning": true,
      "max_auto_passes": 2,
      "debug": true,
      "metaheuristic": {
        "enable_ga": true,
        "population_size": 12,
        "generations": 6,
        "elite_fraction": 0.25,
        "mutation_rate": 0.35
      },
      "quality_weights": {
        "routing_weight": 0.55,
        "loading_weight": 0.45
      },
      "include_feasibility_explanations": true,
      "include_actionable_recommendations": true
    },
    "vehicles": [
      {
        "truck_id": "T26-001",
        "truck_type": "box-26",
        "start_location": "350 5th Ave, New York, NY 10118",
        "start_time": "08:00",
        "crew_size": 2,
        "dims": {
          "l": 312.0,
          "w": 96.0,
          "h": 96.0
        },
        "max_miles": 180.0,
        "max_duration": 36000,
        "max_stops": 30,
        "max_cargo_weight": 12000.0,
        "max_cargo_volume": 1400.0,
        "trailer_profile": "box-26",
        "has_liftgate": true,
        "has_pallet_jack": true,
        "has_dolly": true,
        "dock_height_mode": "either",
        "loading_sides": [
          "rear",
          "side"
        ],
        "safety_profile": {
          "max_vehicle_length_ft": 26,
          "max_height_ft": 12.5,
          "allowed_tags": [
            "highway",
            "arterial",
            "industrial",
            "residential"
          ],
          "prohibited_access_flags": [
            "no_26ft"
          ],
          "prohibited_road_tags_for_hazmat": [
            "tunnel",
            "bridge_restricted"
          ],
          "oversize_thresholds": {
            "max_single_piece_weight_lbs": 2500.0,
            "max_single_piece_length_in": 192.0,
            "max_single_piece_width_in": 96.0,
            "max_single_piece_height_in": 84.0,
            "near_limit_pct": 0.92,
            "permit_weight_lbs": 5000.0,
            "permit_length_in": 240.0,
            "permit_width_in": 102.0,
            "permit_height_in": 96.0
          }
        },
        "hazmat_profile": {
          "enabled": true,
          "allowed_classes": [
            "3",
            "8"
          ],
          "max_hazmat_weight": 600.0
        },
        "zones": {
          "temperature": "ambient"
        }
      },
      {
        "truck_id": "T53-001",
        "truck_type": "dry-van-53",
        "start_location": "350 5th Ave, New York, NY 10118",
        "start_time": "07:30",
        "crew_size": 1,
        "dims": {
          "l": 636.0,
          "w": 100.0,
          "h": 110.0
        },
        "max_miles": 450.0,
        "max_duration": 43200,
        "max_stops": 60,
        "max_cargo_weight": 34000.0,
        "max_cargo_volume": null,
        "trailer_profile": "dry-van-53",
        "has_liftgate": false,
        "has_pallet_jack": false,
        "has_dolly": false,
        "dock_height_mode": "dock",
        "loading_sides": [
          "rear"
        ],
        "safety_profile": {
          "max_vehicle_length_ft": 53,
          "max_height_ft": 13.5,
          "allowed_tags": [
            "highway",
            "arterial",
            "industrial"
          ],
          "prohibited_access_flags": [
            "no_53ft"
          ],
          "prohibited_road_tags_for_hazmat": [
            "tunnel",
            "bridge_restricted"
          ],
          "oversize_thresholds": {
            "max_single_piece_weight_lbs": 4000.0,
            "max_single_piece_length_in": 240.0,
            "max_single_piece_width_in": 96.0,
            "max_single_piece_height_in": 96.0,
            "near_limit_pct": 0.92,
            "permit_weight_lbs": 8000.0,
            "permit_length_in": 360.0,
            "permit_width_in": 102.0,
            "permit_height_in": 108.0
          }
        },
        "hazmat_profile": {
          "enabled": false,
          "allowed_classes": [],
          "max_hazmat_weight": 1000.0
        },
        "zones": {
          "temperature": "ambient"
        }
      }
    ],
    "orders": [
      {
        "job_id": 101,
        "priority": 2,
        "stops": [
          {
            "stop_id": "S-101-P1",
            "type": "pickup",
            "address": "1 Liberty Island, New York, NY 10004",
            "lat": 40.6892,
            "lng": -74.0445,
            "earliest": "2026-01-02T08:30:00-05:00",
            "latest": "2026-01-02T10:30:00-05:00",
            "service_time_sec": 900,
            "items": [],
            "pickup_delivery_id": "PD-101",
            "safety_tags": [
              "industrial"
            ],
            "access_restrictions": [],
            "requires_liftgate": null,
            "requires_pallet_jack": null,
            "requires_dolly": null,
            "dock_height": "ground",
            "loading_side": "rear"
          },
          {
            "stop_id": "S-101-D1",
            "type": "delivery",
            "address": "200 Central Park West, New York, NY 10024",
            "lat": 40.7813,
            "lng": -73.9735,
            "earliest": "2026-01-02T11:00:00-05:00",
            "latest": "2026-01-02T14:30:00-05:00",
            "service_time_sec": 1200,
            "items": [
              {
                "item_id": "SOFA-3SEAT-001",
                "weight": 180.0,
                "volume": 90.0,
                "dims": {
                  "l": 84.0,
                  "w": 38.0,
                  "h": 34.0
                },
                "item_class": "upholstery",
                "stackable": false,
                "is_top_flat": false,
                "fragile": false,
                "max_stack_weight": 0.0,
                "max_tier": 1,
                "position_constraint": "bottom",
                "allowed_orientations": [
                  "upright"
                ],
                "tilt_modes": [
                  "upright"
                ],
                "strap_required": true,
                "assembly_id": "LIVING-SET-A",
                "mesh_url": null,
                "mesh_format": null,
                "can_accept_underload": false,
                "is_nestable": false,
                "can_nest_with": [],
                "job_id": 101,
                "stop_id": "S-101-D1",
                "stop_seq_index": 1,
                "stack_group_id": null,
                "stack_members": null,
                "hazmat": {
                  "enabled": false,
                  "class": null,
                  "un_number": null,
                  "packing_group": null,
                  "incompatible_with": [],
                  "requires_separation_in": 6.0
                },
                "constraints": {
                  "bottom_layer": true,
                  "top_layer": false,
                  "front_load": false,
                  "rear_load": true,
                  "z_band": "bottom"
                },
                "temperature_zone": "ambient"
              },
              {
                "item_id": "TABLE-GLASS-002",
                "weight": 120.0,
                "volume": 40.0,
                "dims": {
                  "l": 60.0,
                  "w": 36.0,
                  "h": 30.0
                },
                "item_class": "glass",
                "stackable": false,
                "is_top_flat": true,
                "fragile": true,
                "max_stack_weight": 0.0,
                "max_tier": 1,
                "position_constraint": "rear",
                "allowed_orientations": [
                  "upright",
                  "rotated"
                ],
                "tilt_modes": [
                  "upright",
                  "side"
                ],
                "strap_required": true,
                "assembly_id": null,
                "mesh_url": null,
                "mesh_format": null,
                "can_accept_underload": false,
                "is_nestable": false,
                "can_nest_with": [],
                "job_id": 101,
                "stop_id": "S-101-D1",
                "stop_seq_index": 1,
                "stack_group_id": null,
                "stack_members": null,
                "hazmat": {
                  "enabled": false,
                  "class": null,
                  "un_number": null,
                  "packing_group": null,
                  "incompatible_with": [],
                  "requires_separation_in": 6.0
                },
                "constraints": {
                  "bottom_layer": false,
                  "top_layer": true,
                  "front_load": false,
                  "rear_load": false,
                  "z_band": "top"
                },
                "temperature_zone": "ambient"
              }
            ],
            "pickup_delivery_id": "PD-101",
            "safety_tags": [
              "residential"
            ],
            "access_restrictions": [
              "no_53ft"
            ],
            "requires_liftgate": true,
            "requires_pallet_jack": false,
            "requires_dolly": true,
            "dock_height": "ground",
            "loading_side": "either"
          }
        ],
        "exclusive_truck_ids": [
          "T26-001"
        ]
      },
      {
        "job_id": 202,
        "priority": 1,
        "stops": [
          {
            "stop_id": "S-202-D1",
            "type": "delivery",
            "address": "10 Exchange Pl, Jersey City, NJ 07302",
            "lat": 40.7163,
            "lng": -74.0334,
            "earliest": "2026-01-02T09:00:00-05:00",
            "latest": "2026-01-02T12:00:00-05:00",
            "service_time_sec": 600,
            "items": [
              {
                "item_id": "PAINT-5GAL-UN1263",
                "weight": 55.0,
                "volume": 2.0,
                "dims": {
                  "l": 14.0,
                  "w": 14.0,
                  "h": 18.0
                },
                "item_class": "hazmat",
                "stackable": true,
                "is_top_flat": true,
                "fragile": false,
                "max_stack_weight": 500.0,
                "max_tier": 4,
                "position_constraint": "none",
                "allowed_orientations": [
                  "upright",
                  "rotated"
                ],
                "tilt_modes": [
                  "upright"
                ],
                "strap_required": false,
                "assembly_id": null,
                "mesh_url": null,
                "mesh_format": null,
                "can_accept_underload": true,
                "is_nestable": true,
                "can_nest_with": [
                  "hazmat",
                  "generic"
                ],
                "job_id": 202,
                "stop_id": "S-202-D1",
                "stop_seq_index": 0,
                "stack_group_id": "STACK-PAINT-1",
                "stack_members": [
                  "PAINT-5GAL-UN1263"
                ],
                "hazmat": {
                  "enabled": true,
                  "class": "3",
                  "un_number": "UN1263",
                  "packing_group": "II",
                  "incompatible_with": [
                    "5.1"
                  ],
                  "requires_separation_in": 12.0
                },
                "constraints": {
                  "bottom_layer": true,
                  "top_layer": false,
                  "front_load": true,
                  "rear_load": false,
                  "z_band": null
                },
                "temperature_zone": "ambient"
              }
            ],
            "pickup_delivery_id": null,
            "safety_tags": [
              "industrial"
            ],
            "access_restrictions": [],
            "requires_liftgate": false,
            "requires_pallet_jack": true,
            "requires_dolly": false,
            "dock_height": "dock",
            "loading_side": "rear"
          }
        ],
        "exclusive_truck_ids": null
      }
    ]
  },
  "scenarios": [
    {
      "scenario_id": "S1_obj_min_trucks",
      "label": "Minimize trucks used",
      "objective_name": "minimize_trucks",
      "policies_patch": {
        "rear_load_bias": false,
        "center_balance_mode": true
      }
    },
    {
      "scenario_id": "S2_soft_tw_no_ga",
      "label": "Soft TW + GA off, reduce penalty",
      "policies_patch": {
        "objective_name": "maximize_items_placed",
        "fragile_separation": true
      },
      "jsonpatch": [
        {
          "op": "replace",
          "path": "/config/time_window_mode",
          "value": "soft"
        },
        {
          "op": "replace",
          "path": "/config/soft_tw_penalty_per_minute",
          "value": 2
        },
        {
          "op": "replace",
          "path": "/config/metaheuristic/enable_ga",
          "value": false
        },
        {
          "op": "replace",
          "path": "/trucks/0/max_miles",
          "value": 120.0
        }
      ]
    }
  ],
  "options": {
    "include_plans": true,
    "max_scenarios": 8
  }
}
POST /optimize
cURL
Python
JavaScript
curl -sS -X POST "https://api.stower.dev/optimize" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
  "config": {
    "api_key": "test_api_key_123",
    "depot_address": "350 5th Ave, New York, NY 10118",
    "depot_lat": 40.7484,
    "depot_lng": -73.9857
  },
  "trucks": [
    {
      "truck_id": "T26-001",
      "truck_type": "box-26",
      "start_location": "350 5th Ave, New York, NY 10118",
      "start_time": "08:00"
    }
  ],
  "jobs": [
    {
      "job_id": 1,
      "priority": 1,
      "stops": [
        {
          "stop_id": "S1",
          "type": "delivery",
          "address": "11 Wall St, New York, NY 10005",
          "lat": 40.7074,
          "lng": -74.0113,
          "items": []
        }
      ]
    }
  ]
}'
Code samples update as you scroll.