Skip to main content
Docs menu
POST

/tour-planning

API tạo tour planning cho đối tác sử dụng

Path

POST/api/v1/partners/tour-planning
Authentication requiredapi-keytoken

curl example

curl -X POST "https://api.route4green.com/api/v1/partners/tour-planning" \
  -H "api-key: YOUR_API_KEY" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "content-type: application/json" \
  -d '{
  "tourPlanOption": [
    {
      "delivery_mode": {},
      "kindOfPlan": {},
      "tour_mode": "string",
      "transport_mode": {}
    }
  ],
  "offers": [
    {
      "registration_number": "string",
      "resource_id": 0,
      "from_address": "string",
      "from_lat": 0,
      "from_lon": 0,
      "from_working_time": "2026-01-01T00:00:00+07:00",
      "handling_unit_ids": [
        "string"
      ],
      "height_of_vehicle": 0,
      "length_of_vehicle": 0,
      "width_of_vehicle": 0,
      "vehicle_tonnage": 0,
      "to_address": "string",
      "to_lat": 0,
      "to_lon": 0,
      "to_working_time": "2026-01-01T00:00:00+07:00",
      "member_id": "string",
      "offer_kind": {}
    }
  ],
  "requests": [
    {
      "order_id": "string",
      "handling_unit_id": 0,
      "service_id": 0,
      "resource_id": 0,
      "distance": 0,
      "drop_address": "string",
      "drop_lat": 0,
      "drop_lon": 0,
      "drop_wid": 0,
      "pickup_address": "string",
      "pickup_lat": 0,
      "pickup_lon": 0,
      "pickup_wid": 0,
      "pickup_date_time": "2026-01-01T00:00:00+07:00",
      "pickup_date_time_to": "2026-01-01T00:00:00+07:00",
      "drop_date_time": "2026-01-01T00:00:00+07:00",
      "drop_date_time_to": "2026-01-01T00:00:00+07:00",
      "loading_time": 0,
      "unloading_time": 0,
      "rlength": 0,
      "rwidth": 0,
      "rheight": 0,
      "rweight": 0,
      "count_of_parcels": 0,
      "sender_name": "string",
      "sender_phone": "string",
      "receiver_name": "string",
      "receiver_phone": "string"
    }
  ]
}'

Parameters

This endpoint takes no parameters.

Request body

FieldTypeRequiredDescription
tourPlanOptionobject[]Yes
offersobject[]Yes
requestsobject[]Yes

Fields of tourPlanOption

FieldTypeRequiredDescription
delivery_mode1 | 2 | 3 | 4Yes1: normal, 2: same day delivery, 3: express 2H delivery, 4: 4H delivery
kindOfPlan1 | 2Yes1: actual planning, 2: plan in advance
tour_modestringYesOptimization mode: 6 param separate by semicolon 1: minimize total distance, 2: minimize vehicle count, 3: balance workload across vehicles, 4: prioritize time windows, 5: require an available driver, 6: time-limited route as an integer count of minutes (not a flag). Positions 1-5 are 0/1 flags.
transport_mode1 | 2 | 3 | 20 | 50 | 100Yes1: last mile, 2: first mile, 3: pickup and drop, 20: mid mile

Fields of offers

FieldTypeRequiredDescription
registration_numberstringYes
resource_idnumberYes
from_addressstringYes
from_latnumberYes
from_lonnumberYes
from_working_timestring (date-time)Yes
handling_unit_idsstring[]No
height_of_vehiclenumberYes
length_of_vehiclenumberYes
width_of_vehiclenumberYes
vehicle_tonnagenumberNo
to_addressstringNo
to_latnumberNo
to_lonnumberNo
to_working_timestring (date-time)Yes
member_idstringNo
offer_kind1 | 2 | 3NoOffer kind (1: theo tuyến, 2: theo thời gian)

Fields of requests

FieldTypeRequiredDescription
order_idstringYes
handling_unit_idnumberYes
service_idnumberYes
resource_idnumberNo
distancenumberNo
drop_addressstringYes
drop_latnumberYes
drop_lonnumberYes
drop_widnumberNoDrop ward id
pickup_addressstringYes
pickup_latnumberYes
pickup_lonnumberYes
pickup_widnumberNoPickup ward id
pickup_date_timestring (date-time)Yes
pickup_date_time_tostring (date-time)Yes
drop_date_timestring (date-time)Yes
drop_date_time_tostring (date-time)Yes
loading_timenumberNoTổng số phút cho việc chất hàng lên xe
unloading_timenumberNoTổng số phút cho việc dở hàng khỏi xe
rlengthnumberYes
rwidthnumberYes
rheightnumberYes
rweightnumberYes
count_of_parcelsnumberYes
sender_namestringYes
sender_phonestringYes
receiver_namestringYes
receiver_phonestringYes
3 fieldsBulkInsertRequestDto

Responses

201

Back to group: Tour planning

POST /tour-planning | Route4Green