post https://api.keeptruckin.com/v3/dispatches
Create a dispatch
This API only accepts a JSON object in the body of the request and is used to create a new dispatch. The JSON object should take the general form illustrated in these examples.
The following includes examples of trips with multiple stops. You can include more trips, which can potentially encompass more stops. Stops across trips must be unique.
Sample Requests
{
"vendor_id":"VV-1",
"status":"planned",
"dispatch_stops":[
{
"vendor_id":"VDS-1",
"type":"pickup",
"number":1,
"early_date":"2023-03-13T19:13:00+00:00",
"late_date":"2023-03-15T19:13:00+00:00",
"form_ids":[
"1ee148ac-6083-4b5a-af7b-75b875bb233f",
"f60e5305-c2e2-45d7-97d7-eb4760b1a973"
],
"vendor_dispatch_location_id":"VDSL-1",
"status":"available"
}
],
"dispatch_trips":[
{
"vendor_id":"VT-1",
"vehicle_id":64734,
"driver_id":1088505,
"vendor_stop_ids":[
"VDS-1"
],
"status":"not_started"
}
]
}
{
"vendor_id":"VV-2",
"status":"planned",
"dispatch_stops":[
{
"vendor_id":"VDS-1",
"type":"pickup",
"number":1,
"early_date":"2023-03-13T19:13:00+00:00",
"late_date":"2023-03-15T19:13:00+00:00",
"form_ids":[
"1ee148ac-6083-4b5a-af7b-75b875bb233f",
"f60e5305-c2e2-45d7-97d7-eb4760b1a973"
],
"vendor_dispatch_location_id":"VDSL-1",
"status":"available"
},
{
"vendor_id":"VDS-2",
"type":"delivery",
"number":2,
"early_date":"2023-03-13T23:13:00+00:00",
"late_date":"2023-03-15T23:13:00+00:00",
"form_ids":[
"1ee148ac-6083-4b5a-af7b-75b875bb233f",
"f60e5305-c2e2-45d7-97d7-eb4760b1a973"
],
"vendor_dispatch_location_id":"VDSL-2",
"status":"available"
}
],
"dispatch_trips":[
{
"vendor_id":"VT-1",
"vehicle_id":64734,
"driver_id":1088505,
"vendor_stop_ids":[
"VDS-1",
"VDS-2"
],
"status":"not_started"
}
]
}
{
"vendor_id":"VV-3",
"status":"planned",
"dispatch_stops":[
{
"vendor_id":"VDS-1",
"type":"pickup",
"number":1,
"early_date":"2023-03-13T19:13:00+00:00",
"late_date":"2023-03-15T19:13:00+00:00",
"form_ids":[
"1ee148ac-6083-4b5a-af7b-75b875bb233f",
"f60e5305-c2e2-45d7-97d7-eb4760b1a973"
],
"vendor_dispatch_location_id":"VDSL-1",
"status":"available"
},
{
"vendor_id":"VDS-2",
"type":"delivery",
"number":2,
"early_date":"2023-03-13T23:13:00+00:00",
"late_date":"2023-03-15T23:13:00+00:00",
"form_ids":[
"1ee148ac-6083-4b5a-af7b-75b875bb233f",
"f60e5305-c2e2-45d7-97d7-eb4760b1a973"
],
"vendor_dispatch_location_id":"VDSL-2",
"status":"available"
}
],
"dispatch_trips":[
{
"vendor_id":"VT-1",
"vehicle_id":64734,
"driver_id":1088505,
"vendor_stop_ids":[
"VDS-1"
],
"status":"not_started"
},
{
"vendor_id":"VT-2",
"vehicle_id":64735,
"driver_id":1088506,
"vendor_stop_ids":[
"VDS-2"
],
"status":"not_started"
}
]
}
The above examples create a dispatch with dispatch trips and dispatch stops.
Disclaimer: The above sample request will not work as is because form IDs and dispatch location IDs will be different for your fleet. Make sure to change these values before making a request to the API.