{
  "openapi": "3.0.0",
  "info": {
    "description": "Suite of APIs to pull load tracking stats.",
    "version": "2.0.0",
    "title": "Load Track Stats API Suite",
    "contact": {
      "email": "integrations@truckertools.com"
    }
  },
  "security": [],
  "paths": {
    "/report/getReportStat/trackingMetric": {
      "post": {
        "tags": [
          "Get general tracking stats"
        ],
        "summary": "Provides general stats",
        "description": "Pass in your API keys and track end date range to pull general data\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API call to pull stats was successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/generalResponse"
                }
              }
            }
          }
        }
      }
    },
    "/report/getReportStat/loadtrack": {
      "post": {
        "tags": [
          "Get track stats by load number"
        ],
        "summary": "Provides load level stats",
        "description": "Pass in your API keys and track end date range to pull data by load number\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API call to pull stats was successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/loadtrackResponse"
                }
              }
            }
          }
        }
      }
    },
    "/report/getReportStat/dispatcher": {
      "post": {
        "tags": [
          "Get track stats by dispatcher"
        ],
        "summary": "Provides dispatcher level stats",
        "description": "Pass in your API keys and track end date range to pull data by dispatcher ID\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API call to pull stats was successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/dispatcherResponse"
                }
              }
            }
          }
        }
      }
    },
    "/report/getReportStat/shipper": {
      "post": {
        "tags": [
          "Get track stats by shipper"
        ],
        "summary": "Provides shipper level stats",
        "description": "Pass in your API keys and track end date range to pull data by shipper ID\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API call to pull stats was successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/shipperResponse"
                }
              }
            }
          }
        }
      }
    },
    "/report/getReportStat/carrier": {
      "post": {
        "tags": [
          "Get track stats by carrier"
        ],
        "summary": "Provides carrier level stats",
        "description": "Pass in your API keys and track end date range to pull data by carrier\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API call to pull stats was successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/carrierResponse"
                }
              }
            }
          }
        }
      }
    },
    "/report/getReportStat/driver": {
      "post": {
        "tags": [
          "Get track stats by driver"
        ],
        "summary": "Provides driver level stats",
        "description": "Pass in your API keys and track end date range to pull data by driver\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "API call to pull stats was successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/driverResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://loadtracking.truckertools.com",
      "description": "Production Server"
    }
  ],
  "components": {
    "schemas": {
      "RequestPayload": {
        "type": "object",
        "required": [
          "accountId",
          "partnerId",
          "startDate",
          "endDate"
        ],
        "properties": {
          "accountId": {
            "type": "string",
            "example": "yIXbN9xjC7xINRc2kszHJQ==",
            "description": "Your account ID provided by Trucker Tools"
          },
          "partnerId": {
            "type": "string",
            "example": 3,
            "description": "Your TMS system ID provided by Trucker Tools"
          },
          "startDate": {
            "type": "string",
            "example": "2023-01-01",
            "description": "Start of time period to pull data. Based on scheduled end time of track"
          },
          "endDate": {
            "type": "string",
            "example": "2023-01-01",
            "description": "End of time period to pull data. Based on scheduled end time of track"
          }
        }
      },
      "loadtrackResponse": {
        "type": "object",
        "required": [
          "status",
          "callTimestamp",
          "dataCount",
          "reports"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of API call",
            "example": true
          },
          "callTimestamp": {
            "type": "string",
            "example": "2024-01-23 03:01:32 UTC",
            "description": "Timestamp of API call in UTC"
          },
          "dataCount": {
            "type": "number",
            "description": "Number of records returned",
            "example": 3525
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/track"
            }
          }
        }
      },
      "track": {
        "type": "object",
        "required": [
          "loadNumber",
          "scheduledStartDate",
          "scheduledEndDate"
        ],
        "properties": {
          "loadNumber": {
            "type": "string",
            "example": 1234,
            "description": "Customer load number"
          },
          "dispatcher": {
            "type": "string",
            "example": "dispatcher1",
            "description": "ID of the dispatcher assigned to the load"
          },
          "scheduledStartDate": {
            "type": "string",
            "example": "2022-12-30 05:00:00 CST",
            "description": "Scheduled start date of the load in the time zone received from TMS (Typically local)"
          },
          "actualStartDate": {
            "type": "string",
            "example": "2022-12-30 05:00:00 CST",
            "description": "Actual start date of the load in the time zone received from driver device (Typically local). Null if the load has not started."
          },
          "scheduledEndDate": {
            "type": "string",
            "example": "2022-12-31 05:00:00 CST",
            "description": "Scheduled end date of the load in the time zone received from TMS (Typically local)"
          },
          "actualEndDate": {
            "type": "string",
            "example": "2022-12-31 05:00:00 CST",
            "description": "Actual end date of the load in the time zone received from driver device (Typically local). Null if the load has not ended."
          },
          "cancelled": {
            "type": "string",
            "description": "Flag if the load was cancelled. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "notMobileNumber": {
            "type": "string",
            "description": "Flag if the driver phone number was not a mobile number. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "toBeTracked": {
            "type": "string",
            "description": "Flag if the load could be tracked (Assigned, not cancelled, mobile number or ELD assigned ). \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "tracked": {
            "type": "string",
            "description": "Flag if the load was tracked (At least one location update). \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "consistentlyTracked": {
            "type": "string",
            "description": "Flag if the load was consistently tracked (Every 60 minutes, every 60 miles, updates on every geofence). \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "partialConsistencyPercentage": {
            "type": "string",
            "description": "Percentage of hours the load actually tracked for vs. hours it was scheduled to track for",
            "example": 90
          },
          "assigned": {
            "type": "string",
            "description": "Flag if the load was assigned to a driver. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "lateAssigned": {
            "type": "string",
            "description": "Flag if the load was assigned to a driver after the start time. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "stopCount": {
            "type": "number",
            "description": "Count of stops on the load",
            "example": 3
          },
          "stopsEntered": {
            "type": "number",
            "description": "Count of stops on the load that were entered by the driver",
            "example": 2
          },
          "pickupEntered": {
            "type": "string",
            "description": "Flag if the pickup geofence was entered. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "deliveryEntered": {
            "type": "string",
            "description": "Flag if the delivery geofence was entered. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "pickupState": {
            "type": "string",
            "description": "State code of the pickup location",
            "example": "TX"
          },
          "pickupCity": {
            "type": "string",
            "description": "City of the pickup location",
            "example": "HOUSTON"
          },
          "deliveryState": {
            "type": "string",
            "description": "State code of the delivery location",
            "example": "VA"
          },
          "deliveryCity": {
            "type": "string",
            "description": "City of the delivery location",
            "example": "RICHMOND"
          },
          "eldLoad": {
            "type": "string",
            "description": "Flag if the carrier on the load was ELD integrated. \"Yes\" if true, \"\" if false",
            "example": "Yes"
          },
          "shipper": {
            "type": "string",
            "description": "Shipper ID provided for the load",
            "example": "shipperA"
          },
          "shipperEmail": {
            "type": "string",
            "description": "Shipper email(s) provided for the load to receive updates. Can be comma separated list.",
            "example": "track@shipper.com"
          },
          "carrierName": {
            "type": "string",
            "description": "Name of the carrier hauling the load",
            "example": "Carrier A"
          },
          "carrierDocket": {
            "type": "string",
            "description": "Docket number of the carrier hauling the load",
            "example": "MC1234"
          },
          "driverPhoneNumber": {
            "type": "string",
            "description": "Phone number of the driver hauling the load",
            "example": 1231231234
          }
        }
      },
      "dispatcherResponse": {
        "type": "object",
        "required": [
          "status",
          "callTimestamp",
          "dataCount",
          "reports"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of API call",
            "example": true
          },
          "callTimestamp": {
            "type": "string",
            "example": "2024-01-23 03:01:32 UTC",
            "description": "Timestamp of API call in UTC"
          },
          "dataCount": {
            "type": "number",
            "description": "Number of records returned",
            "example": 3525
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/dispatcher"
            }
          }
        }
      },
      "dispatcher": {
        "type": "object",
        "properties": {
          "dispatcher": {
            "type": "string",
            "example": "dispatcherA",
            "description": "Dispatcher ID sent for the loads"
          },
          "created": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks created"
          },
          "cancelled": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks cancelled"
          },
          "unassigned": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks not assigned a driver or asset"
          },
          "notMobileNumber": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks assigned a non-mobile driver phone number"
          },
          "toBeTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks to be tracked (Assigned, not cancelled, mobile number or ELD assigned)"
          },
          "tracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were tracked (At least one location update)"
          },
          "trackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "tracked count over toBeTracked count to produce the tracked %"
          },
          "consistentlyTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were consistently tracked (Every 60 minutes, every 60 miles, updates on every geofence)"
          },
          "consistentlyTrackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "consistentlyTracked count over tracked count to produce the consistently tracked %"
          },
          "infrequentPing": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were possible to be tracked (toBeTracked) that received infrequent pings (Average distance between pings is > 60 miles and/or we did not get a ping for every scheduledhour of the track)"
          },
          "lateAssignment": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were assigned after pickup"
          }
        }
      },
      "shipperResponse": {
        "type": "object",
        "required": [
          "status",
          "callTimestamp",
          "dataCount",
          "reports"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of API call",
            "example": true
          },
          "callTimestamp": {
            "type": "string",
            "example": "2024-01-23 03:01:32 UTC",
            "description": "Timestamp of API call in UTC"
          },
          "dataCount": {
            "type": "number",
            "description": "Number of records returned",
            "example": 3525
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/shipper"
            }
          }
        }
      },
      "shipper": {
        "type": "object",
        "properties": {
          "shipper": {
            "type": "string",
            "example": "shipperA",
            "description": "Shipper ID sent for the loads"
          },
          "shipperEmail": {
            "type": "string",
            "example": "track@shipper.com",
            "description": "Shipper email(s) sent for the loads. Can be comma separated list."
          },
          "created": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks created"
          },
          "cancelled": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks cancelled"
          },
          "unassigned": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks not assigned a driver or asset"
          },
          "notMobileNumber": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks assigned a non-mobile driver phone number"
          },
          "toBeTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks to be tracked (Assigned, not cancelled, mobile number or ELD assigned)"
          },
          "tracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were tracked (At least one location update)"
          },
          "trackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "tracked count over toBeTracked count to produce the tracked %"
          },
          "consistentlyTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were consistently tracked (Every 60 minutes, every 60 miles, updates on every geofence)"
          },
          "consistentlyTrackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "consistentlyTracked count over tracked count to produce the consistently tracked %"
          },
          "infrequentPing": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were possible to be tracked (toBeTracked) that received infrequent pings (Average distance between pings is > 60 miles and/or we did not get a ping for every scheduledhour of the track)"
          },
          "lateAssignment": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were assigned after pickup"
          }
        }
      },
      "carrierResponse": {
        "type": "object",
        "required": [
          "status",
          "callTimestamp",
          "dataCount",
          "reports"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of API call",
            "example": true
          },
          "callTimestamp": {
            "type": "string",
            "example": "2024-01-23 03:01:32 UTC",
            "description": "Timestamp of API call in UTC"
          },
          "dataCount": {
            "type": "number",
            "description": "Number of records returned",
            "example": 3525
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/carrier"
            }
          }
        }
      },
      "carrier": {
        "type": "object",
        "properties": {
          "carrier": {
            "type": "string",
            "example": "carrierA",
            "description": "Name of carrier assigned to the loads"
          },
          "docket": {
            "type": "string",
            "example": "MC1234",
            "description": "Docket number of carrier assigned to the loads"
          },
          "eldIntegrated": {
            "type": "string",
            "enum": [
              "Yes",
              "No"
            ],
            "description": "Flag if Carrier is ELD integrated with Trucker Tools or not"
          },
          "created": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks created"
          },
          "cancelled": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks cancelled"
          },
          "unassigned": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks not assigned a driver or asset"
          },
          "notMobileNumber": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks assigned a non-mobile driver phone number"
          },
          "toBeTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks to be tracked (Assigned, not cancelled, mobile number or ELD assigned)"
          },
          "tracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were tracked (At least one location update)"
          },
          "trackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "tracked count over toBeTracked count to produce the tracked %"
          },
          "consistentlyTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were consistently tracked (Every 60 minutes, every 60 miles, updates on every geofence)"
          },
          "consistentlyTrackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "consistentlyTracked count over tracked count to produce the consistently tracked %"
          },
          "infrequentPing": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were possible to be tracked (toBeTracked) that received infrequent pings (Average distance between pings is > 60 miles and/or we did not get a ping for every scheduledhour of the track)"
          },
          "lateAssignment": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were assigned after pickup"
          }
        }
      },
      "driverResponse": {
        "type": "object",
        "required": [
          "status",
          "callTimestamp",
          "dataCount",
          "reports"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of API call",
            "example": true
          },
          "callTimestamp": {
            "type": "string",
            "example": "2024-01-23 03:01:32 UTC",
            "description": "Timestamp of API call in UTC"
          },
          "dataCount": {
            "type": "number",
            "description": "Number of records returned",
            "example": 3525
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/driver"
            }
          }
        }
      },
      "driver": {
        "type": "object",
        "properties": {
          "driverPhone": {
            "type": "string",
            "example": 1231231234,
            "description": "Driver phone number assigned to the loads"
          },
          "driverName": {
            "type": "string",
            "example": "Joe Smith",
            "description": "Name of driver assigned to the loads"
          },
          "carrier": {
            "type": "string",
            "example": "carrierA",
            "description": "Name of carrier assigned to the loads"
          },
          "docket": {
            "type": "string",
            "example": "MC1234",
            "description": "Docket number of carrier assigned to the loads"
          },
          "created": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks created"
          },
          "cancelled": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks cancelled"
          },
          "unassigned": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks not assigned a driver or asset"
          },
          "notMobileNumber": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks assigned a non-mobile driver phone number"
          },
          "toBeTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks to be tracked (Assigned, not cancelled, mobile number or ELD assigned)"
          },
          "tracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were tracked (At least one location update)"
          },
          "trackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "tracked count over toBeTracked count to produce the tracked %"
          },
          "consistentlyTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were consistently tracked (Every 60 minutes, every 60 miles, updates on every geofence)"
          },
          "consistentlyTrackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "consistentlyTracked count over tracked count to produce the consistently tracked %"
          },
          "infrequentPing": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were possible to be tracked (toBeTracked) that received infrequent pings (Average distance between pings is > 60 miles and/or we did not get a ping for every scheduledhour of the track)"
          },
          "lateAssignment": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were assigned after pickup"
          }
        }
      },
      "generalResponse": {
        "type": "object",
        "required": [
          "status",
          "callTimestamp",
          "dataCount",
          "reports"
        ],
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of API call",
            "example": true
          },
          "callTimestamp": {
            "type": "string",
            "example": "2024-01-23 03:01:32 UTC",
            "description": "Timestamp of API call in UTC"
          },
          "dataCount": {
            "type": "number",
            "description": "Number of records returned",
            "example": 3525
          },
          "reports": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/general"
            }
          }
        }
      },
      "general": {
        "type": "object",
        "properties": {
          "created": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks created"
          },
          "cancelled": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks cancelled"
          },
          "unassigned": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks not assigned a driver or asset"
          },
          "notMobileNumber": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks assigned a non-mobile driver phone number"
          },
          "toBeTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks to be tracked (Assigned, not cancelled, mobile number or ELD assigned)"
          },
          "tracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were tracked (At least one location update)"
          },
          "trackedPercentage": {
            "type": "string",
            "example": "100%",
            "description": "tracked count over toBeTracked count to produce the tracked %"
          },
          "consistentlyTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were consistently tracked (Every 60 minutes, every 60 miles, updates on every geofence)"
          },
          "2HoursConsistentlyTracked": {
            "type": "number",
            "example": 10,
            "description": "Number of load tracks that were consistently tracked at least once every 2 hours for the scheduled duration of the track"
          },
          "2HoursConsistentlyTrackedPercentageBasedOnLoadCounts": {
            "type": "string",
            "example": "100%",
            "description": "2HoursConsistentlyTracked count over toBeTracked count"
          },
          "2HoursConsistentlyTrackedPercentageBasedOnTrackedLoadCounts": {
            "type": "string",
            "example": "100%",
            "description": "2HoursConsistentlyTracked count over tracked count"
          }
        }
      }
    }
  }
}