Headlight API: Optimize Daily Routes

Comments Comments Off by MobileIQ on June 8, 2015

Here’s a quick tutorial for using the Headlight API to optimize daily routes and create an output file. It’s a convenient way to automate the process of optimizing routes every day. Route optimization jobs can be scheduled to run after hours with the results ready for review in the morning. Since the the information is sent back in a standard format, the billing system even can be updated before generating route itinerary reports or uploading data to handheld devices.




Headlight_API_token = unique for every Headlight account
date = scheduled delivery or service date in mm/dd/yyyy format
filename = output file will be saved to the Headlight Dropbox

sequence_start = first stop number
sequence_increment = stop number increment
fmt = V5 (default) returns a file compatible with the Smart Sync upload specifications
fmt = basic returns a simplified file format
optimize=1 (default) returns optimized routes
optimize=0 returns the current routes without any optimization

Note: Parameters are separated by an ‘&’ character without any spaces.


Here’s an example URL that will optimize routes using the following options:

  • route all deliveries or service calls scheduled for April 17, 2016
  • 1st scheduled delivery will be Stop #10
  • additional deliveries will be Stop #20, Stop #30, Stop #40 …
  • results will be saved to a file in the Headlight Dropbox
  • filename will be ‘04_17_2012_optimized_routes.csv”


Here’s an example URL that will retrieve manual changes to the routes:

Example using PHP and cURL

$url = 'https://applications.gomobileiq.com/routes/optimize';
$curl_data = array(

'token' => 'my_headlight_authentication_token',
'date' => '4/17/2016',
'filename' => '04_17_2016_optimized_routes.csv'


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($curl_data));


Comments are closed.