Skip to main content

RESTful APIs Developer Guide


Our routing, location and mapping APIs allow you to enhance and develop your own specialty applications by calling data from PC*MILER, the transportation industry standard for more than 30 years.

With our easy-to-use RESTful APIs, you can generate routes for trucks and other commercial vehicles, calculate distances, and gather location information throughout the world.

What Can You Do?

Our services are widely used by fleet management companies, carriers and shippers in the U.S., Canada, Mexico, and Europe for applications such as freight rating, fuel surcharge computations, and equipment usage monitoring.

They can be used in developing native .NET based applications on your Microsoft Windows machines, Android and iOS applications on mobile devices, as well as web browser applications.

You can also use our JavaScript Maps SDK to build map-centric web applications that call routing and location data.

Accessing the Service

The APIs provide a direct way to access these services via HTTP/S requests.

The base URIs to access our various services via HTTP REST requests are:

Routing, Mapping and Location

Single Search{region}/api/


Trip Management


Account Manager

Multi-Vehicle Routing

Freight Rail{version}/Service.svc


All requests to Web Services must include a valid API Key. Go here if you would like to get a free, trial API key.

The API Key must be supplied with every request. If the client making the API request has an invalid API key, then the key will fail to authenticate.

For REST, insert the API Key in the http Authorization: header or use authToken={APIKey} in the query string in the URI of the request. For example:

Request Properties

All API request parameters and method parameters can be sent via the standard HTTP methods—POST, GET, PUT, and DELETE.

A typical REST action consists of sending an HTTP request to the API Server and waiting for the response. Like any HTTP request, a REST request to API Server contains a request method, a URI, request headers, and a query string or request body. The response contains an HTTP status code, response headers, and a response body.

Request ElementDescription
HOSTThe Host header defines PC*MILER REST API server (where to connect).
Example: Host:
APIKEYAPI Key will be used to fully determine privileges and visibility for the request within PC*MILER platform.
Example:add Authorization: YOUR_KEY_HERE in Request Header
attach &authToken= YOUR_KEY_HERE in the URL.
CONTENT-TYPEDefines expected request MIME type.
application/json: PC*MILER will render the response in JSON format following the current REST API specifications.

URL Encoding Requests

It is important that you URL encode any URL in order to ensure that it does not contain any “Unsafe” or “Reserved” characters. It is especially important to URL encode any data included in a URL—things like coordinates, addresses, or other text will often include characters that must be encoded in order to be included in a URL.

Most programming languages have packages or functions that will automatically encode a URL.

Sample GET Requests

Java Header-Based GET Authentication

Query = "coords=-85.974742,37.892845";
String nospac = Query.replace(" ", "%20");
address = "";
urlFormatted = address + nospac;
url = new URL(urlFormatted);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization", apiKeyVal);
connection.setReadTimeout(15 * 1000);
builder = new StringBuilder();
String type = connection.getContentType();
if (type == null) {

Sample POST Requests

Java POST Request

String address = ("");
URL url = new URL(address);

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", API_KEY);
String postData = "{ \"ReportRoutes\": [{\"RouteId\": \"test\", \"Stops\": [{\"Address\": {\"Zip\": \"08540\"},\"Label\": \"Trimble Maps\"}, {\"Address\": {\"Zip\": \"90266\"},\"Label\": \"Manhattan Beach\"}], \"ReportTypes\": [{\"__type\": \"MileageReportType:\",\"THoursWithSeconds\": false}]}]}";
conn.setRequestProperty("Content-Length", Integer.toString(postData.length()));
OutputStream os = conn.getOutputStream();

if (conn.getResponseCode() != 200)
if (conn.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
throw new RuntimeException("Failed : HTTP error code : "+ conn.getResponseCode());

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();

while ((inputLine = in.readLine()) != null) {


C# POST Request

var request = (HttpWebRequest)WebRequest.Create("");
var postData = "{ \"ReportRoutes\": [{\"RouteId\": \"test\", \"Stops\": [{\"Address\": {\"Zip\": \"08540\"},\"Label\": \"Trimble Maps\"}, {\"Address\": {\"Zip\": \"90266\"},\"Label\": \"Manhattan Beach\"}], \"ReportTypes\": [{\"__type\": \"MileageReportType:\",\"THoursWithSeconds\": false}]}]}";
var data = Encoding.ASCII.GetBytes(postData);
request.Headers.Add("Authorization", API_KEY);
request.Method = "POST";
request.ContentType = "application/json";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
stream.Write(data, 0, data.Length);
var response = (HttpWebResponse)request.GetResponse();
var responseJSON = new StreamReader(response.GetResponseStream()).ReadToEnd();

JavaScript POST Request

reqhttp = new XMLHttpRequest();
var url =
  "";"POST", url, true);
reqhttp.setRequestHeader("Content-type", "application/json");
reqhttp.setRequestHeader("Authorization", APIKEY);
reqhttp.responseType = "arraybuffer";

reqhttp.onreadystatechange = function () {
  //Call a function when the state changes.
  if (reqhttp.readyState == 4 && reqhttp.status == 200) {
    var res = reqhttp.response;
    if (res) {
      var uInt8Array = new Uint8Array(res);
      var i = uInt8Array.length;
      var binaryString = new Array(i);
      while (i--) {
        binaryString[i] = String.fromCharCode(uInt8Array[i]);
      var data = binaryString.join("");

      document.getElementById("textbox").innerText = data;

var postData =
  '{ "ReportRoutes": [{"RouteId": "test", "Stops": [{"Address": {"Zip": "08540"},"Label": "Trimble Maps"}, {"Address": {"Zip": "90266"},"Label": "Manhattan Beach"}], "ReportTypes": [{"__type": "MileageReportType:","THoursWithSeconds": false}]}]}';

function doFunction() {


Throughout this guide, you will see interactive examples where you can both validate your API key and test any calls to our Web Services. You need to enter your key in the YOUR API KEY HERE field in order for the sample requests to return a response.

Watch Video
Last updated December 2, 2022.