Batch and Sequence Orders
Post a sequence of orders to be planned either manually or automatically by HyperTrack. For automatic planning, please contact the HyperTrack team to get set up.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/orders/" \ -H "Content-Type: application/json" \ -d '{ "plan_mode": "manual", "ops_group_handle": "store-SF", "orders": [ { "order_handle": "order-1", "scheduled_at": "2023-10-31T02:00:00.000Z", "product_type": [ "frozen", "fragile" ], "type": "pick", "metadata": { "customerID": "12654" }, "destination": { "address": "1709 Automation Pkwy, San Jose, CA 95101", "geometry": { "type": "Point", "coordinates": [ -121.8871193, 37.390611 ] }, "radius": 100 } }, { "order_handle": "order-2", "scheduled_at": "2023-10-31T04:00:00.000Z", "product_type": [ "frozen", "fragile" ], "type": "drop", "metadata": { "customerID": "12654" }, "destination": { "address": "1028 E Brokaw Rd, San Jose, CA 95131", "geometry": { "type": "Point", "coordinates": [ -121.9007247, 37.3811932 ] }, "radius": 100 } } ] }'{ "route_handle": "string", "status": "planned", "version": 0, "created_at": "string", "embed_url": "string", "orders": [ { "order_handle": "string", "status": "planned", "destination": { "geofence_id": "string", "place_handle": "string", "address": "string", "geometry": { "coordinates": [ 0 ], "type": "Point" }, "place_id": "string", "radius": 30 }, "fulfillment_attempt": 0, "risk_status": true, "ops_group_handle": "string", "plan_mode": "on_demand", "plan_id": "string", "planning_failure_reason": "string", "device_id": "string", "driver_handle": "string", "worker_handle": "string", "place_handle": "string", "created_at": "string", "started_at": "string", "assigned_at": "string", "planned_at": "string", "scheduled_at": "string", "scheduled_after": "string", "completed_at": "string", "cancelled_at": "string", "disabled_at": "string", "enabled_at": "string", "arrived_at": "string", "exited_at": "string", "metadata": { "property1": null, "property2": null }, "risks": { "property1": null, "property2": null }, "expected_service_time": 0, "product_type": [ "string" ], "type": "pick", "type_index": 0, "capacity_used": 0, "region": { "country": "string", "city": "string", "state": "string" }, "distance": 0, "duration": 0, "estimate": { "start_at": "string", "start_by": "string", "arrive_at": "string", "distance": 0, "duration": 0, "initial_arrive_at": "string", "current_worker_location": { "geometry": { "type": "string", "coordinates": [ null ] }, "bearing": 0, "accuracy": 0, "speed": 0, "recorded_at": "string" } }, "share_url": "string", "route_handle": "string", "track_mode": "on_shift", "actual_service_time": 0, "tracked_service_time": 0, "tracking_rate": 0, "time_to_first_event": 0, "time_to_first_location": 0, "created_by": { "source": "string", "timestamp": "string", "ip-address": "string", "device_id": "string", "driver_handle": "string", "user_id": "string", "email": "string" }, "outage_summary": [ { "duration": 0, "distance": 0, "code": "string", "label": "string", "description": "string", "category": "behavioural" } ], "embed_url": "string", "device_switch_mode": "manual", "tasks": [ { "label": "string", "task_definition_id": "string", "description": "string", "metadata": { "property1": null, "property2": null }, "priority": "none", "task_id": "string", "status": "string" } ], "priority": "low", "worker_profile": { "property1": null, "property2": null }, "rescheduled_marked_at": "string", "cancellation_source": { "property1": null, "property2": null }, "cancellation_reason": "string", "timesheets": [ { "source": "string", "type": "string", "start_time": "string", "end_time": "string", "total_duration_on_premises": 0, "total_break_duration": 0, "breaks": [ { "type": "string", "start_time": "string", "end_time": "string", "duration": 0 } ], "finalized": true } ] } ], "created_by": { "source": "string", "timestamp": "string", "ip-address": "string", "device_id": "string", "driver_handle": "string", "user_id": "string", "email": "string" }, "ops_group_handle": "default", "track_mode": "full_shift", "plan_mode": "on_demand", "started_at": "string", "assigned_at": "string", "planned_at": "string", "completed_at": "string", "device_id": "string", "driver_handle": "string", "worker_handle": "string", "metadata": { "property1": null, "property2": null }, "region": { "country": "string", "city": "string", "state": "string" }, "distance": 0, "duration": 0, "estimate": { "start_by": "string", "distance": 0, "duration": 0, "polyline": { "type": "string", "coordinates": [ [ null ] ] }, "start_location": { "type": "string", "coordinates": [ null ] }, "end_location": { "type": "string", "coordinates": [ null ] } }, "plan_id": "string", "device_switch_mode": "manual", "candidate_devices": [ "string" ], "completion_source": "string", "scheduled_start_at": "string", "auto_complete_at": "string", "polyline": { "type": "string", "coordinates": [ [ null ] ] }, "start_location": { "type": "string", "coordinates": [ null ] }, "end_location": { "type": "string", "coordinates": [ null ] }, "tracking_rate": 0, "time_to_first_event": 0, "time_to_first_location": 0, "completion_type": "end_at_last_order"}{ "title": "string", "detail": "string"}{ "code": "string", "title": "string", "detail": "string"}Get Orders GET
### Planning failure reasons When an order is left unplanned by automated planning, `planning_failure_reason` may contain one of these values: - `No Worker was available for this plan.` - `No Worker schedule overlaps with this order's time window.` - `This order is outside the available Worker working hours.` - `Worker location is unavailable, so travel time could not be evaluated.` - `Worker start location is unavailable for the configured route start setting.` - `No Worker supports the required product type for this order.` - `Route was being modified concurrently and this order needs to be re-planned.` - `The optimizer dropped this order to satisfy planning constraints for the overall plan.` - `The optimizer could not find a feasible plan for the provided constraints.` - `Travel time calculation failed for this planning attempt.` - `Ops group configuration is incomplete for automated planning.` - `Assigning this order would exceed route or Worker capacity.` - `No Worker can reach this order before scheduled_at.` - `Assigning this order would delay an already planned downstream order.` - `Assigning this order would exceed the Worker's shift end time.` - `Existing assigned route conflicts with the Worker schedule, so this order could not be inserted into the plan.` - `Existing assigned route exceeds the Worker's shift, so this order could not be inserted into the plan.` - `Existing assigned route has conflicting appointment windows, so this order could not be inserted into the plan.` - `Existing assigned route exceeds route or Worker capacity, so this order could not be inserted into the plan.` - `Existing assigned route exceeds the configured maximum route distance, so this order could not be inserted into the plan.` - `Existing assigned routes were preserved, so this order could not be inserted into the plan.` - `Assigning this order would exceed the configured maximum route distance.` - `The optimizer reached its planning limit before it could assign this order.` - `Automated planning could not assign this order with the provided constraints.`
Track Orders POST
This API allows the creation and immediate tracking of order fulfillment. If the route has been planned and exists in the HyperTrack system, then tracking can be initiated using the route_handle. Send your own `route_handle` with `orders` to create a route under that handle. A retry with the same handle returns the same route (200) and does not create a second one; the `orders` of a retry are ignored. A handle of a route with a different worker, of a completed route, or of a route with other times returns 409. **Shift routes.** Send `scheduled_start_at` (and `auto_complete_at`), or `tracking_window: shift`, to make a shift route. Times that you send always win. With `tracking_window: shift`, the times that you do not send come from the worker's schedule, else from the schedule of the worker's ops group. The response shows the resolved `scheduled_start_at` and `auto_complete_at`. A route with hours from a schedule follows later edits of that schedule until it completes: a route that waits moves to the new hours, a tracking route takes the new end of the current shift. It keeps its times when the edit leaves no current shift, breaks a limit, or overlaps another shift. A route with times you sent, or with times set by a PATCH, does not follow schedule edits. Without `tracking_window`, a missing `auto_complete_at` is `scheduled_start_at` plus 24 hours. Limits for shift routes: `scheduled_start_at` is at most 24 hours in the past, and a past start starts tracking at once; `auto_complete_at` is in the future, after the start, and at most 24 hours after it. A start in the future (at most 24 hours ahead) creates the route as `assigned` with no tracking; HyperTrack starts tracking at `scheduled_start_at`, within about one minute, with the route's own `track_mode`. A call by handle before the start returns the route and does not start it. Another open shift route of the same worker at the same time returns 409 (`shift_overlap`). A start by handle of a shift route that is not tracking and whose `auto_complete_at` has passed returns 409 (`shift_ended`). A shift route needs `worker_handle`. `track_mode` stays required; the route keeps the mode of the call. Schedules are read in the timezone of the worker's ops group (else the ops group of the call) when it is set and is not UTC; else in the timezone of the worker's device; else in UTC. An 08:00 schedule read in UTC starts at 08:00 UTC. A call that sends only `auto_complete_at` makes a route that is not a shift route, as before.