KeepTruckin Public API

The KeepTruckin Public API Developer Hub

Welcome to the KeepTruckin Public API developer hub. You'll find comprehensive guides and documentation to help you start working with KeepTruckin Public API as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results
Suggest Edits

Introduction

 

KeepTruckin makes it easy for you to access all of your fleet management data, so you can take advantage of the powerful data collection technology in the KeepTruckin ELD and mobile apps.

This site describes how to interact with our APIs. Our APIs will allow you to get data for reports, make changes to your fleet, integrate with Transportation Management Systems (TMS), and build dashboards outside of KeepTruckin to help you understand your business as a whole.

KeepTruckin APIs are secured with HTTPS and will provide JSON or XML formatted responses. The sections that follow contain information on how to access the API, how to fetch response in a certain format, how to format timestamps in a certain timezone, and how to set unit of measure for various metrics.

Suggest Edits

Endpoints

 

Our APIs can all be accessed through HTTPS requests to URLs like:

https://api.keeptruckin.com/<version>/<endpoint>

All KeepTruckin APIs are versioned. If we intend to make breaking changes to the API that changes the response format or request parameters, we will always increment the version.

Suggest Edits

Authentication

 

We use a simple and secure authentication system. You must get an API key from the KeepTruckin dashboard, and provide that key on every API request. You can create multiple API keys for your company. If a key needs to be disabled because someone with it leaves the company or if it gets shared accidentally, you can disable it in the KeepTruckin dashboard. You should not share your API key with anyone outside your organization.

API keys can be configured for “test mode” or “live mode”. A test API key will never modify data and is useful when developing your integration. Use a test API key to experiment with the API without accidentally making unwanted changes to your company profile or fleet.

To authenticate, the API client needs to include a Company API key in an HTTP header.

Header Name
Value

X-Api-Key

<company api key>

Suggest Edits

Time Zone

 

The date and time specified in either the request parameters or the date or time attributes returned in the API responses are in UTC, unless a time zone is specified in an HTTP header.

Header Name
Value

X-Time-Zone

<time zone>

We support the following values in the X-Time-Zone header:

Header Value
UTC OFFSET

Atlantic Time (Canada)

UTC -4, uses DST

Eastern Time (US & Canada)

UTC -5, uses DST

Indiana (East)

UTC -5, no DST

Central Time (US & Canada)

UTC -6, uses DST

Saskatchewan

UTC -6, no DST

Mountain Time (US & Canada)

UTC -7, uses DST

Arizona

UTC -7, no DST

Pacific Time (US & Canada)

UTC -8, uses DST

Alaska

UTC -9, uses DST

curl -H 'X-Api-Key: 24eb4181-ee55-446b-a25b-b39777cf4d8d' -H 'X-Time-Zone: Alaska' 'https://api.keeptruckin.com/v1/users'
Suggest Edits

System of Units

 

The values specified in request params or response params are returned in company's system of units setting, unless X-Metric-Units HTTP header is included in the request. The header indicates whether the values should be returned in metric units or imperial units.

Header Name
Value

X-Metric-Units

<true for metric system of units>

 

API requests are performed on behalf of the first active admin of the fleet, unless some other fleet admin's user id is included in the request as X-USER-ID header.

Header Name
Value

X-User-Id

<Fleet admin's user id>

We also support the concept of a system user or an API user. The API user can be used to perform API requests but does not have access to web dashboard or mobile app.

System User

If you need to provision a system user, please contact our support team.

Suggest Edits

Request Methods

 

All KeepTruckin APIs use HTTP request methods to indicate the desired operation to be performed. All endpoints in this documentation will specify the request method that should be used for each API request.

GET

Use a GET request when fetching data (like listing all your company’s drivers).

POST

Use a POST request when creating new records (like adding a driver to your fleet).

PUT

Use a PUT request when updating existing records (like changing a driver’s cycle setting).

DELETE

Use a DELETE request when deleting existing records (like removing a driver from your fleet).

Suggest Edits

Response Codes

 

The APIs respond with codes in the 200’s, 400’s, and 500’s. Your API client should handle each class differently.

2XX

These are successful responses and indicate the API request completed without any errors.

4XX

These indicate there was a problem with the request, like missing parameters or invalid parameter values. Check the response for specific error details. Requests that respond in the 400’s should NOT be retried without modification.

5XX

These indicate there was a problem with the server and should be retried. They should only occur when the server is unreachable or misconfigured.

Suggest Edits

Response Formats

 

Responses can be formatted with JSON or XML. To specify the desired response format, append .json or .xml to the request path or use the Accept HTTP header. JSON is the default when nothing is specified.

curl -H 'X-Api-Key: <insert api key here>' 'https://api.keeptruckin.com/v1/users.json'
curl -H 'Accept: application/json' -H 'X-Api-Key: <insert api key here>' 'https://api.keeptruckin.com/v1/users'
curl -H 'X-Api-Key: <insert api key here>' 'https://api.keeptruckin.com/v1/users.xml'
curl -H 'Accept: application/xml' -H 'X-Api-Key: <insert api key here>' 'https://api.keeptruckin.com/v1/users'
Suggest Edits

Pagination

 

All GET requests will limit the number of results returned at a time for performance reasons and so all APIs support pagination for enumerating large numbers of records in the responses. By default, only 25 results will be included at a time and so you will need to increase the number of results per page or request each page consecutively. The API supports the following parameters for paginating results.

  • per_page: Number of results to return in response. Default is 25 and maximum value can be 100.
  • page_no: The page number to return. Default is 1
    The total number of results, page number, and number of results per page are included in all API responses.
{
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 123
  }
}
Suggest Edits

User Object

 

A user object represents a driver or a fleet manager. The fleet's data is either associated with a user, vehicle, or both. User can have one the following three roles: driver, fleet_admin, or fleet_user.

Drivers can login to the KeepTruckin's mobile app, record Hours of Service logs, create inspection reports, upload documents, send messages, etc. In order to calculate availability times and determine if your driver has a violation on his logs, we require you to select a HOS cycle for your driver. Each HOS cycle listed below has some additional exceptions that you can select from:

Cycle API Value
Description
Allowed Exceptions
Violations

70_8

USA Property 70 hour / 8 day

exception_24_hour_restart
exception_8_hour_break
exception_short_haul

duty_16
duty_14
driving_11
break_30
cycle_70

60_7

USA Property 60 hour / 7 day

exception_24_hour_restart
exception_8_hour_break
exception_short_haul

duty_16
duty_14
driving_11
break_30
cycle_60

70_8_o

USA Oil and Gas 70 hour / 8 day

exception_24_hour_restart
exception_8_hour_break
exception_wait_time
exception_short_haul

duty_16
duty_14
driving_11
break_30
cycle_70

60_7_o

USA Oil and Gas 60 hour / 7 day

exception_24_hour_restart
exception_8_hour_break
exception_wait_time
exception_short_haul

duty_16
duty_14
driving_11
break_30
cycle_60

70_8_p

USA Passenger 70 hour / 8 day

duty_15
driving_10
cycle_70_p

60_7_p

USA Passenger 60 hour / 7 day

duty_15
driving_10
cycle_60_p

80_8

California Property 80 hour / 8 day

exception_24_hour_restart

ca_driving_12
ca_duty_16
ca_cycle_80

80_8_o

California Oil and Gas 80 hour / 8 day

exception_24_hour_restart
exception_wait_time

ca_driving_12
ca_duty_16
ca_cycle_80

80_8_p

California Passenger 80 hour / 8 day

exception_ca_farm_school_bus

ca_driving_10
ca_duty_15
ca_cycle_80_p
ca_duty_16

tx_70_7

Texas 70 hour / 7 day

exception_24_hour_restart

tx_driving_12
tx_duty_15
tx_cycle_70

ak_70_7

Alaska Property 70 hour / 7 day

exception_24_hour_restart

ak_duty_20,
ak_driving_15,
ak_cycle_70

ak_80_8

Alaska Property 80 hour / 8 day

exception_24_hour_restart

ak_duty_20,
ak_driving_15,
ak_cycle_80

ak_70_7_o

Alaska Oil and Gas 70 hour / 7 day

exception_24_hour_restart
exception_wait_time

ak_duty_20,
ak_driving_15,
ak_cycle_70

ak_80_8_o

Alaska Oil and Gas 80 hour / 8 day

exception_24_hour_restart
exception_wait_time

ak_duty_20,
ak_driving_15,
ak_cycle_80

ak_70_7_p

Alaska Passenger 70 hour / 7 day

ak_duty_20
ak_driving_15
ak_cycle_70_p

ak_80_8_p

Alaska Passenger 80 hour / 8 day

ak_duty_20
ak_driving_15
ak_cycle_80_p

70_7

Canada South 70 hour / 7 day (Cycle 1)

canada_driving_13
canada_duty_14
canada_duty_16
canada_daily_driving_13
canada_daily_duty_14
canada_daily_break_10
canada_cycle_70
canada_break_24

120_14

Canada South 120 hour / 14 day (Cycle 2)

canada_driving_13
canada_duty_14
canada_duty_16
canada_daily_driving_13
canada_daily_duty_14
canada_daily_break_10
canada_cycle_120
canada_break_24
canada_break_24_70

canada_oil

Canada South Oil and Gas

exception_wait_time

canada_oil_driving_13
canada_oil_duty_14
canada_oil_duty_16
canada_oil_daily_driving_13
canada_oil_daily_duty_14
canada_oil_daily_break_10
canada_oil_break_3_24

80_7

Canada North 80 hour / 7 day (Cycle 1)

canada_driving_15
canada_duty_18
canada_duty_20
canada_daily_break_8
canada_cycle_80
canada_break_24

120_14_north

Canada North 120 hour / 14 day (Cycle 2)

canada_driving_15
canada_duty_18
canada_duty_20
canada_daily_break_8
canada_cycle_120
canada_break_24_80

Other

Other

Following is the list of exceptions with description:

Exception API name
Description

exception_24_hour_restart

24 hour restart exception allows any 24+ hour "off_duty" or "sleeper" period to start a new cycle.

exception_8_hour_break

8 hour break exception exempts the driver from taking 30+ minutes breaks.

exception_wait_time

Wait time exception adds a 5th status to the log chart and any time spent waiting does not count towards the 14 hour shift limit.

exception_short_haul

Short haul exception allows a 16 hour shift once per week or after a 34 hour restart.

exception_ca_farm_school_bus

Farm/School bus exception allows for a 16 hour shift limit.

Following is this list of violations with description:

Violation API name
Description

break_30

30 Minute Break Required

driving_11

11 Hour Driving Limit

duty_14

14 Hour Shift Limit

duty_16

16 Hour Shift Limit

cycle_60

60 Hour Cycle Limit

cycle_70

70 Hour Cycle Limit

driving_10

10 Hour Driving Limit

duty_15

15 Hour On Duty Limit

cycle_60_p

60 Hour Cycle Limit

cycle_70_p

70 Hour Cycle Limit

canada_driving_13

13 Hour Driving Limit

canada_driving_15

15 Hour Driving Limit

canada_duty_14

14 Hour On Duty Limit

canada_duty_16

16 Hour Shift Limit

canada_duty_18

18 Hour On Duty Limit

canada_duty_20

20 Hour Shift Limit

canada_daily_break_8

Daily 8 Hours Off Duty Required

canada_daily_break_10

Daily 10 Hours Off Duty Required

canada_daily_driving_13

Daily 13 Hour Driving Limit

canada_daily_duty_14

Daily 14 Hour On Duty Limit

canada_cycle_70

70 Hour Cycle Limit

canada_cycle_80

80 Hour Cycle Limit

canada_cycle_120

120 Hour Cycle Limit

canada_break_24

24 Hour Break Required

canada_break_24_70

24 Hour Break Required

canada_break_24_80

24 Hour Break Required

canada_oil_driving_13

13 Hour Driving Limit

canada_oil_duty_14

14 Hour On Duty Limit

canada_oil_duty_16

16 Hour Shift Limit

canada_oil_break_3_24

Three 24 Hour Breaks Required

canada_oil_daily_driving_13

Daily 13 Hour Driving Limit

canada_oil_daily_duty_14

Daily 14 Hour On Duty Limit

canada_oil_daily_break_10

Daily 10 Hours Off Duty Required

ca_driving_12

12 Hour Driving Limit

ca_duty_16

16 Hour Shift Limit

ca_cycle_80

80 Hour Cycle Limit

ca_driving_10

10 Hour Driving Limit

ca_duty_15

15 Hour On Duty Limit

ca_duty_16_p

16 Hour On Duty Limit

ca_cycle_80_p

80 Hour Cycle Limit

tx_driving_12

12 Hour Driving Limit

tx_duty_15

15 Hour On Duty Limit

tx_cycle_70

70 Hour Cycle Limit

ak_cycle_70

70 Hour Cycle Limit

ak_cycle_80

80 Hour Cycle Limit

ak_duty_20

20 Hour Shift Limit

ak_driving_15

15 Hour Driving Limit

ak_cycle_70_p

70 Hour Cycle Limit

ak_cycle_80_p

80 Hour Cycle Limit

Behind the scenes, we also track driver's performance, time driver spends driving vs idling, etc. This data is automatically recorded from the hardware device and is associated with the driver based on his driving records.

Fleet admins or fleet users have access to KeepTruckin's web dashboard. You can look at drivers' or vehicles' data and manage the fleet. Please note that fleet managers cannot use KeepTruckin's driver mobile app.

Following set of endpoints can be used to manage users including getting existing users' information, provisioning new users, and modifying users' settings.

Deleting Users

Once a user is created, it cannot be deleted. The status of the user can be set to deactivated, but it is not same as deleting the user. You will continue to see the provisioned user in the web dashboard.

Suggest Edits

/users

List company users

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/users

Query Params

role
string

User's role. Valid values include driver, fleet_user, and admin.

duty_status
string

Driver's current duty status. Valid values include off_duty, on_duty, sleeper, driving, and waiting.

status
string

User's status. Valid values include active and deactivated.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

The API returns all company users and can optionally filter the response.

curl --request GET \
  --url https://api.keeptruckin.com/v1/users
var request = require("request");

var options = { method: 'GET', url: 'https://api.keeptruckin.com/v1/users' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/users");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/users"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "users": [
    {
      "user": {
        "id": 294979,
        "email": null,
        "first_name": "John",
        "last_name": "Connor",
        "phone": "",
        "phone_ext": null,
        "time_zone": "Pacific Time (US & Canada)",
        "carrier_name": "Demo Carrier",
        "carrier_street": "415 Truckin St.",
        "carrier_city": "San Francisco",
        "carrier_state": "CA",
        "carrier_zip": "94105",
        "violation_alerts": "1_hour",
        "terminal_street": "350 Sansome St",
        "terminal_city": "San Francisco",
        "terminal_state": "CA",
        "terminal_zip": "94104",
        "exception_24_hour_restart": false,
        "exception_8_hour_break": false,
        "exception_wait_time": false,
        "exception_short_haul": false,
        "exception_ca_farm_school_bus": false,
        "cycle2": null,
        "exception_24_hour_restart2": false,
        "exception_8_hour_break2": false,
        "exception_wait_time2": false,
        "exception_short_haul2": false,
        "exception_ca_farm_school_bus2": false,
        "export_combined": true,
        "export_recap": true,
        "export_odometers": true,
        "metric_units": false,
        "username": "demo_driver_1_kt3647454",
        "cycle": "70_8",
        "driver_company_id": null,
        "minute_logs": true,
        "duty_status": "off_duty",
        "eld_mode": "logs",
        "drivers_license_number": "",
        "drivers_license_state": "",
        "yard_moves_enabled": true,
        "personal_conveyance_enabled": true,
        "role": "driver",
        "status": "active",
        "created_at": "2016-08-09T00:43:40Z",
        "updated_at": "2017-03-30T01:06:13.169610Z"
      }
    },
    {
      "user": {
        "id": 378672,
        "email": null,
        "first_name": "Mark",
        "last_name": "Jordan",
        "phone": null,
        "phone_ext": null,
        "time_zone": "Pacific Time (US & Canada)",
        "carrier_name": "Demo Carrier",
        "carrier_street": "415 Truckin St.",
        "carrier_city": "San Francisco",
        "carrier_state": "CA",
        "carrier_zip": "94105",
        "violation_alerts": "1_hour",
        "terminal_street": "350 Sansome St",
        "terminal_city": "San Francisco",
        "terminal_state": "CA",
        "terminal_zip": "94104",
        "exception_24_hour_restart": false,
        "exception_8_hour_break": false,
        "exception_wait_time": false,
        "exception_short_haul": false,
        "exception_ca_farm_school_bus": false,
        "cycle2": null,
        "exception_24_hour_restart2": false,
        "exception_8_hour_break2": false,
        "exception_wait_time2": false,
        "exception_short_haul2": false,
        "exception_ca_farm_school_bus2": false,
        "export_combined": true,
        "export_recap": true,
        "export_odometers": true,
        "metric_units": false,
        "username": "demo_driver_2_kt3647454",
        "cycle": "70_8",
        "driver_company_id": null,
        "minute_logs": true,
        "duty_status": "off_duty",
        "eld_mode": "logs",
        "drivers_license_number": null,
        "drivers_license_state": null,
        "yard_moves_enabled": false,
        "personal_conveyance_enabled": false,
        "role": "driver",
        "status": "active",
        "created_at": "2017-01-20T22:05:52Z",
        "updated_at": "2017-03-29T20:34:40.394359Z"
      }
    },
    {
      "user": {
        "id": 378673,
        "email": null,
        "first_name": "Nathan",
        "last_name": "Farren",
        "phone": null,
        "phone_ext": null,
        "time_zone": "Pacific Time (US & Canada)",
        "carrier_name": "Demo Carrier",
        "carrier_street": "415 Truckin St.",
        "carrier_city": "San Francisco",
        "carrier_state": "CA",
        "carrier_zip": "94105",
        "violation_alerts": "1_hour",
        "terminal_street": "350 Sansome St",
        "terminal_city": "San Francisco",
        "terminal_state": "CA",
        "terminal_zip": "94104",
        "exception_24_hour_restart": false,
        "exception_8_hour_break": false,
        "exception_wait_time": false,
        "exception_short_haul": false,
        "exception_ca_farm_school_bus": false,
        "cycle2": null,
        "exception_24_hour_restart2": false,
        "exception_8_hour_break2": false,
        "exception_wait_time2": false,
        "exception_short_haul2": false,
        "exception_ca_farm_school_bus2": false,
        "export_combined": true,
        "export_recap": true,
        "export_odometers": true,
        "metric_units": false,
        "username": "demo_driver_3_kt3647454",
        "cycle": "70_8",
        "driver_company_id": null,
        "minute_logs": true,
        "duty_status": "off_duty",
        "eld_mode": "logs",
        "drivers_license_number": null,
        "drivers_license_state": null,
        "yard_moves_enabled": false,
        "personal_conveyance_enabled": false,
        "role": "driver",
        "status": "active",
        "created_at": "2017-01-20T22:05:53Z",
        "updated_at": "2017-03-30T02:06:33.768861Z"
      }
    },
    {
      "user": {
        "id": 378674,
        "email": null,
        "first_name": "Brian",
        "last_name": "Ingram",
        "phone": null,
        "phone_ext": null,
        "time_zone": "Pacific Time (US & Canada)",
        "carrier_name": "Demo Carrier",
        "carrier_street": "415 Truckin St.",
        "carrier_city": "San Francisco",
        "carrier_state": "CA",
        "carrier_zip": "94105",
        "violation_alerts": "1_hour",
        "terminal_street": "350 Sansome St",
        "terminal_city": "San Francisco",
        "terminal_state": "CA",
        "terminal_zip": "94104",
        "exception_24_hour_restart": false,
        "exception_8_hour_break": false,
        "exception_wait_time": false,
        "exception_short_haul": false,
        "exception_ca_farm_school_bus": false,
        "cycle2": null,
        "exception_24_hour_restart2": false,
        "exception_8_hour_break2": false,
        "exception_wait_time2": false,
        "exception_short_haul2": false,
        "exception_ca_farm_school_bus2": false,
        "export_combined": true,
        "export_recap": true,
        "export_odometers": true,
        "metric_units": false,
        "username": null,
        "cycle": "70_8",
        "driver_company_id": null,
        "minute_logs": true,
        "duty_status": "off_duty",
        "eld_mode": "logs",
        "drivers_license_number": null,
        "drivers_license_state": null,
        "yard_moves_enabled": false,
        "personal_conveyance_enabled": false,
        "role": "driver",
        "status": "deactivated",
        "created_at": "2017-01-20T22:05:54Z",
        "updated_at": "2017-01-20T22:05:54.870158Z"
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 4
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <users>
    <user>
      <id>1</id>
      <email>2c3e42cdaf57@keeptruckin.com</email>
      <first_name>2</first_name>
      <last_name>Fo2</last_name>
      <phone nil="true"/>
      <phone_ext nil="true"/>
      <time_zone>Pacific Time (US &amp; Canada)</time_zone>
      <role>driver</role>
      <status>active</status>
      <carrier_name nil="true"/>
      <carrier_street nil="true"/>
      <carrier_city nil="true"/>
      <carrier_state nil="true"/>
      <carrier_zip nil="true"/>
      <violation_alerts>1_hour</violation_alerts>
      <terminal_street nil="true"/>
      <terminal_city nil="true"/>
      <terminal_state nil="true"/>
      <terminal_zip nil="true"/>
      <exception_24_hour_restart>false</exception_24_hour_restart>
      <exception_8_hour_break>false</exception_8_hour_break>
      <exception_wait_time>false</exception_wait_time>
      <exception_short_haul>false</exception_short_haul>
      <exception_ca_farm_school_bus>false</exception_ca_farm_school_bus>
      <export_combined>true</export_combined>
      <export_recap>true</export_recap>
      <export_odometers>true</export_odometers>
      <metric_units>false</metric_units>
      <username nil="true"/>
      <cycle>60_7</cycle>
      <driver_company_id nil="true"/>
      <minute_logs>false</minute_logs>
      <eld_mode>none</eld_mode>
      <drivers_license_number nil="true"/>
      <drivers_license_state nil="true"/>
      <yard_moves_enabled>false</yard_moves_enabled>
      <personal_conveyance_enabled>false</personal_conveyance_enabled>
      <duty_status>off_duty</duty_status>
      <created_at>2016-02-24T06:26:00Z</created_at>
      <updated_at>2016-02-24T06:26:00.000000Z</updated_at>
    </user>
  </users>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>1</total>
  </pagination>
</data>
Suggest Edits

/users/:id

Get a specific user

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/users/id

Path Params

id
int32
required

User's ID.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/users/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/users/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/users/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/users/id");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/users/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "user": {
    "id": 294979,
    "email": null,
    "first_name": "John",
    "last_name": "Connor",
    "phone": "",
    "phone_ext": null,
    "time_zone": "Pacific Time (US & Canada)",
    "metric_units": false,
    "carrier_name": "Demo Carrier",
    "carrier_street": "415 Truckin St.",
    "carrier_city": "San Francisco",
    "carrier_state": "CA",
    "carrier_zip": "94105",
    "violation_alerts": "1_hour",
    "terminal_street": "350 Sansome St",
    "terminal_city": "San Francisco",
    "terminal_state": "CA",
    "terminal_zip": "94104",
    "cycle": "70_8",
    "exception_24_hour_restart": false,
    "exception_8_hour_break": false,
    "exception_wait_time": false,
    "exception_short_haul": false,
    "exception_ca_farm_school_bus": false,
    "cycle2": null,
    "exception_24_hour_restart2": false,
    "exception_8_hour_break2": false,
    "exception_wait_time2": false,
    "exception_short_haul2": false,
    "exception_ca_farm_school_bus2": false,
    "export_combined": true,
    "export_recap": true,
    "export_odometers": true,
    "username": "demo_driver_1_kt3647454",
    "driver_company_id": null,
    "minute_logs": true,
    "duty_status": "off_duty",
    "eld_mode": "logs",
    "drivers_license_number": "",
    "drivers_license_state": "",
    "yard_moves_enabled": true,
    "personal_conveyance_enabled": true,
    "role": "driver",
    "status": "active",
    "created_at": "2016-08-09T00:43:40Z",
    "updated_at": "2017-04-20T21:08:32.134197Z"
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <id>294979</id>
  <email nil="true"/>
  <first_name>John</first_name>
  <last_name>Connor</last_name>
  <phone></phone>
  <phone_ext nil="true"/>
  <time_zone>Pacific Time (US &amp; Canada)</time_zone>
  <metric_units>false</metric_units>
  <carrier_name>Demo Carrier</carrier_name>
  <carrier_street>415 Truckin St.</carrier_street>
  <carrier_city>San Francisco</carrier_city>
  <carrier_state>CA</carrier_state>
  <carrier_zip>94105</carrier_zip>
  <violation_alerts>1_hour</violation_alerts>
  <terminal_street>350 Sansome St</terminal_street>
  <terminal_city>San Francisco</terminal_city>
  <terminal_state>CA</terminal_state>
  <terminal_zip>94104</terminal_zip>
  <cycle>70_8</cycle>
  <exception_24_hour_restart>false</exception_24_hour_restart>
  <exception_8_hour_break>false</exception_8_hour_break>
  <exception_wait_time>false</exception_wait_time>
  <exception_short_haul>false</exception_short_haul>
  <exception_ca_farm_school_bus>false</exception_ca_farm_school_bus>
  <cycle2 nil="true"/>
  <exception_24_hour_restart2>false</exception_24_hour_restart2>
  <exception_8_hour_break2>false</exception_8_hour_break2>
  <exception_wait_time2>false</exception_wait_time2>
  <exception_short_haul2>false</exception_short_haul2>
  <exception_ca_farm_school_bus2>false</exception_ca_farm_school_bus2>
  <export_combined>true</export_combined>
  <export_recap>true</export_recap>
  <export_odometers>true</export_odometers>
  <username>demo_driver_1_kt3647454</username>
  <driver_company_id nil="true"/>
  <minute_logs>true</minute_logs>
  <duty_status>off_duty</duty_status>
  <eld_mode>logs</eld_mode>
  <drivers_license_number></drivers_license_number>
  <drivers_license_state></drivers_license_state>
  <yard_moves_enabled>true</yard_moves_enabled>
  <personal_conveyance_enabled>true</personal_conveyance_enabled>
  <role>driver</role>
  <status>active</status>
  <created_at>2016-08-09T00:43:40Z</created_at>
  <updated_at>2017-04-20T21:08:32.134197Z</updated_at>
</data>
{
  "error_message": "user not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>user not found</error_message>
</error>
Suggest Edits

/users

Create a new user

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.keeptruckin.com/v1/users

Body Params

first_name
string
required

User's first name.

last_name
string
required

User's last name.

email
string

User's email address. Either email address or username is required but both can be set.

username
string

User's username. Either email address or username is required but both can be set.

password
string
required

User's password.

role
string
required

User's role. Valid values include driver, fleet_user, and admin.

phone
string

User's phone number.

phone_ext
string

User's phone number extension.

driver_company_id
string

Fleet-specific internal driver ID. Only applies to drivers.

time_zone
string

User's home terminal time zone.

group_ids
array of integers

Group IDs that fleet user has access to. Only applies to users with role fleet_user.

group_visibility
string

Data visibility for fleet users. Valid values include all and limited. Only applies to users with role fleet_user.

carrier_name
string

Carrier name.

carrier_street
string

Carrier street address.

carrier_city
string

Carrier city.

carrier_state
string

Carrier state abbreviation.

carrier_zip
string

Carrier's zip code.

violation_alerts
string

Frequency of violation alerts shown in the mobile app to drivers. Valid values include never 15_minutes, 30_minutes, 45_minutes, and 1_hour.

terminal_street
string

Home terminal street address.

terminal_city
string

Home terminal city.

terminal_state
string

Home terminal state.

terminal_zip
string

Home terminal zip code.

cycle
string

Driver's primary cycle. Valid values include 70_8, 60_7, 70_8_o, 60_7_o, 70_8_p, 60_7_p, 80_8, 80_8_o, 80_8_p, tx_70_7, ak_70_7, ak_80_8, ak_70_7_o, ak_80_8_o, ak_70_7_p, ak_80_8_p, 70_7, 120_14, canada_oil, 80_7, 120_14_north, and Other.

exception_24_hour_restart
boolean

Set true when driver is using 24 hours restart exception for cycle.

exception_8_hour_break
boolean

Set true when driver is using 8 hour break exception for cycle.

exception_wait_time
boolean

Set true when driver is using wait time exception for cycle.

exception_short_haul
boolean

Set true when driver is using short haul exception for cycle.

exception_ca_farm_school_bus
boolean

Set true when driver is using CA farm/school bus exception for cycle.

export_combined
boolean

Set true to export logs and DVIRs on the same page.

export_recap
boolean

Set true to export recap with logs.

export_odometers
boolean

Set true to export odometers with logs.

metric_units
boolean

Set true to use metric units.

minute_logs
boolean

Set true to use minute resolution log events.

eld_mode
string

Driver's ELD mode. Valid values include none and logs.

drivers_license_number
string

Driver's license number.

drivers_license_state
string

Driver's license issuing state.

yard_moves_enabled
boolean

Set true if yard moves are allowed for the driver.

personal_conveyance_enabled
boolean

Set true if personal conveyance is allowed for the driver.

status
string

User's status. Valid values include active, pending, and deactivated.

cycle2
string

Driver's secondary cycle. Valid values include 70_8, 60_7, 70_8_o, 60_7_o, 70_8_p, 60_7_p, 80_8, 80_8_o, 80_8_p, tx_70_7, ak_70_7, ak_80_8, ak_70_7_o, ak_80_8_o, ak_70_7_p, ak_80_8_p, 70_7, 120_14, canada_oil, 80_7, 120_14_north, and Other.

exception_24_hour_restart2
boolean

Set true when driver is using 24 hours restart exception for secondary cycle.

exception_8_hour_break2
boolean

Set true when driver is using 8 hour break exception for secondary cycle.

exception_wait_time2
boolean

Set true when driver is using wait time exception for secondary cycle.

exception_short_haul2
boolean

Set true when driver is using short haul exception for secondary cycle.

exception_ca_farm_school_bus2
boolean

Set true when driver is using CA farm/school bus exception for secondary cycle.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request POST \
  --url https://api.keeptruckin.com/v1/users
var request = require("request");

var options = { method: 'POST', url: 'https://api.keeptruckin.com/v1/users' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.keeptruckin.com/v1/users");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/users"

response = requests.request("POST", url)

print(response.text)
A binary file was returned
{
  "user": {
    "id": 123,
    "email": null,
    "first_name": "John",
    "last_name": "Doe",
    "phone": null,
    "phone_ext": null,
    "time_zone": null,
    "carrier_name": null,
    "carrier_street": null,
    "carrier_city": null,
    "carrier_state": null,
    "carrier_zip": null,
    "violation_alerts": "1_hour",
    "terminal_street": null,
    "terminal_city": null,
    "terminal_state": null,
    "terminal_zip": null,
    "exception_24_hour_restart": false,
    "exception_8_hour_break": false,
    "exception_wait_time": false,
    "exception_short_haul": false,
    "exception_ca_farm_school_bus": false,
    "export_combined": true,
    "export_recap": true,
    "export_odometers": true,
    "metric_units": false,
    "username": "john.doe.demo.fleet",
    "cycle": null,
    "driver_company_id": null,
    "minute_logs": false,
    "duty_status": "off_duty",
    "eld_mode": "none",
    "drivers_license_number": null,
    "drivers_license_state": null,
    "yard_moves_enabled": false,
    "personal_conveyance_enabled": false,
    "role": "driver",
    "status": "active",
    "created_at": "2017-03-30T05:36:59Z",
    "updated_at": "2017-03-30T05:36:59.084295Z"
  }
}
{
  "error_message": "password is missing, first_name is missing, last_name is missing, role is missing, role does not have a valid value"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <id>123</id>
  <email />
  <first_name>John</first_name>
  <last_name>Doe</last_name>
  <phone />
  <phone_ext />
  <time_zone />
  <carrier_name />
  <carrier_street />
  <carrier_city />
  <carrier_state />
  <carrier_zip />
  <violation_alerts>1_hour</violation_alerts>
  <terminal_street />
  <terminal_city />
  <terminal_state />
  <terminal_zip />
  <exception_24_hour_restart>false</exception_24_hour_restart>
  <exception_8_hour_break>false</exception_8_hour_break>
  <exception_wait_time>false</exception_wait_time>
  <exception_short_haul>false</exception_short_haul>
  <exception_ca_farm_school_bus>false</exception_ca_farm_school_bus>
  <export_combined>true</export_combined>
  <export_recap>true</export_recap>
  <export_odometers>true</export_odometers>
  <metric_units>false</metric_units>
  <username>john.doe.demo.fleet</username>
  <cycle />
  <driver_company_id />
  <minute_logs>false</minute_logs>
  <duty_status>off_duty</duty_status>
  <eld_mode>none</eld_mode>
  <drivers_license_number />
  <drivers_license_state />
  <yard_moves_enabled>false</yard_moves_enabled>
  <personal_conveyance_enabled>false</personal_conveyance_enabled>
  <role>driver</role>
  <status>active</status>
  <created_at>2017-03-30T05:36:59Z</created_at>
  <updated_at>2017-03-30T05:36:59.084295Z</updated_at>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>password is missing, first_name is missing, last_name is missing, role is missing, role does not have a valid value</error_message>
</error>
Suggest Edits

/users

Update an existing user

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.keeptruckin.com/v1/users/id

Path Params

id
int32
required

Body Params

first_name
string

User's first name.

last_name
string

User's last name.

email
string

User's email address. Either email address or username is required but both can be set.

username
string

User's username. Either email address or username is required but both can be set.

password
string

User's password.

role
string

User's role. Valid values include driver, fleet_user, and admin. Role can only be changed from fleet_user to admin and vice versa.

phone
string

User's phone number.

phone_ext
string

User's phone number extension.

driver_company_id
string

Fleet-specific internal driver ID. Only applies to drivers.

time_zone
string

User's home terminal time zone.

group_ids
array of integers

Group IDs that fleet user has access to. Only applies to users with role fleet_user.

group_visibility
string

Data visibility for fleet users. Valid values include all and limited. Only applies to users with role fleet_user.

carrier_name
string

Carrier name.

carrier_street
string

Carrier street address.

carrier_city
string

Carrier city.

carrier_state
string

Carrier state abbreviation.

carrier_zip
string

Carrier's zip code.

violation_alerts
string

Frequency of violation alerts shown in the mobile app to drivers. Valid values include never 15_minutes, 30_minutes, 45_minutes, and 1_hour.

terminal_street
string

Home terminal street address.

terminal_city
string

Home terminal city.

terminal_state
string

Home terminal state.

terminal_zip
string

Home terminal zip code.

cycle
string

Driver's primary cycle. Valid values include 70_8, 60_7, 70_8_o, 60_7_o, 70_8_p, 60_7_p, 80_8, 80_8_o, 80_8_p, tx_70_7, ak_70_7, ak_80_8, ak_70_7_o, ak_80_8_o, ak_70_7_p, ak_80_8_p, 70_7, 120_14, canada_oil, 80_7, 120_14_north, and Other.

exception_24_hour_restart
boolean

Set true when driver is using 24 hours restart exception for cycle.

exception_8_hour_break
boolean

Set true when driver is using 8 hour break exception for cycle.

exception_wait_time
boolean

Set true when driver is using wait time exception for cycle.

exception_short_haul
boolean

Set true when driver is using short haul exception for cycle.

exception_ca_farm_school_bus
boolean

Set true when driver is using CA farm/school bus exception for cycle.

export_combined
boolean

Set to true to export logs and DVIRs on the same page.

export_recap
boolean

Set to true to export recap with logs.

export_odometers
boolean

Set true to export odometers with logs.

metric_units
boolean

Set true to use metric units.

minute_logs
boolean

Set true to use minute resolution log events.

eld_mode
string

Driver's ELD mode. Valid values include none and logs.

drivers_license_number
string

Driver's license number.

drivers_license_state
string

Driver's license issuing state.

yard_moves_enabled
boolean

Set true if yard moves are allowed for the driver.

personal_conveyance_enabled
boolean

Set true if personal conveyance is allowed for the driver.

status
string

User's status. Valid values include active, pending, and deactivated.

cycle2
string

Driver's secondary cycle. Valid values include 70_8, 60_7, 70_8_o, 60_7_o, 70_8_p, 60_7_p, 80_8, 80_8_o, 80_8_p, tx_70_7, ak_70_7, ak_80_8, ak_70_7_o, ak_80_8_o, ak_70_7_p, ak_80_8_p, 70_7, 120_14, canada_oil, 80_7, 120_14_north, and Other.

exception_24_hour_restart2
boolean

Set true when driver is using 24 hours restart exception for secondary cycle.

exception_8_hour_break2
boolean

Set true when driver is using 8 hour break exception for secondary cycle.

exception_wait_time2
boolean

Set true when driver is using wait time exception for secondary cycle.

exception_short_haul2
boolean

Set true when driver is using short haul exception for secondary cycle.

exception_ca_farm_school_bus2
boolean

Set true when driver is using CA farm/school bus exception for secondary cycle.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request PUT \
  --url https://api.keeptruckin.com/v1/users/id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.keeptruckin.com/v1/users/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/users/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.keeptruckin.com/v1/users/id");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/users/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned
{
  "user": {
    "id": 294979,
    "email": null,
    "first_name": "John",
    "last_name": "Connor",
    "phone": "",
    "phone_ext": null,
    "time_zone": "Pacific Time (US & Canada)",
    "carrier_name": "Demo Carrier",
    "carrier_street": "415 Truckin St.",
    "carrier_city": "San Francisco",
    "carrier_state": "CA",
    "carrier_zip": "94105",
    "violation_alerts": "1_hour",
    "terminal_street": "350 Sansome St",
    "terminal_city": "San Francisco",
    "terminal_state": "CA",
    "terminal_zip": "94104",
    "exception_24_hour_restart": false,
    "exception_8_hour_break": false,
    "exception_wait_time": false,
    "exception_short_haul": false,
    "exception_ca_farm_school_bus": false,
    "export_combined": true,
    "export_recap": true,
    "export_odometers": true,
    "metric_units": false,
    "username": "demo_driver_1_kt3647454",
    "cycle": "70_8",
    "driver_company_id": null,
    "minute_logs": true,
    "duty_status": "off_duty",
    "eld_mode": "logs",
    "drivers_license_number": "",
    "drivers_license_state": "",
    "yard_moves_enabled": true,
    "personal_conveyance_enabled": true,
    "role": "driver",
    "status": "active",
    "created_at": "2016-08-09T00:43:40Z",
    "updated_at": "2017-03-30T01:06:13.169610Z"
  }
}
{
  "error_message": "status does not have a valid value"
}
{
  "error_message": "user not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <id>158</id>
    <email>d77d64aa04d1@keeptruckin.com</email>
    <first_name>Addison</first_name>
    <last_name>Hahn</last_name>
    <phone nil="true"/>
    <phone_ext nil="true"/>
    <time_zone>Mountain Time (US &amp; Canada)</time_zone>
    <role>fleet_user</role>
    <status>active</status>
    <duty_status>off_duty</duty_status>
    <created_at>2016-03-16T08:22:44Z</created_at>
    <updated_at>2016-03-16T08:22:44.226952Z</updated_at>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>status does not have a valid value</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>user not found</error_message>
</error>
Suggest Edits

Vehicle Object

 

A vehicle object represents a tractor or a truck. As mentioned in the User Object section, some of the fleet's data is associated with vehicles. This includes location information, fault codes, fuel consumption, IFTA distance reports, etc. In order to start tracking this information, you'll need to assign an ELD Device object to your vehicle.

Following set of endpoints can be used to manage vehicles including list vehicles, creating vehicles, updating vehicles, and deactivating them. Typically this API can be used by a third party service such as a TMS or an Asset Management System to provision vehicles.

Deleting Vehicles

Similar to user object, a vehicle cannot be deleted once it has been created. The status of the vehicle can be changed to deactivated but you will continue to see the vehicle in web dashboard.

Trailers

A vehicle does not represent a trailer. Thought we do not prevent you from creating vehicles to represent trailers, they cannot be used to to indicate trailer information on vehicle inspection report, etc.

Suggest Edits

/vehicles

List company vehicles

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/vehicles

Query Params

driver_ids
string

Current driver IDs of the vehicles.

fuel_type
string

Vehicle's fuel type. Valid values include diesel, gasoline, propane, lng, cng, ethanol, methanol, e85, m85, a55, biodiesel, and other.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/vehicles
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/vehicles' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/vehicles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/vehicles");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/vehicles"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "vehicles": [
    {
      "vehicle": {
        "id": 4,
        "company_id": 5,
        "number": "Demo Vehicle",
        "status": "active",
        "ifta": true,
        "vin": "WP0AB2966NS458669",
        "make": "Demo",
        "model": "Vehicle",
        "year": "2016",
        "license_plate_state": "CA",
        "license_plate_number": "5M37250",
        "metric_units": false,
        "fuel_type": "diesel",
        "prevent_auto_odometer_entry": false,
        "eld_device": {
          "id": 2,
          "identifier": "000074802542164638439715893965",
          "model": "lbb-1"
        },
        "current_driver": {
          "id": 11,
          "first_name": "Demo",
          "last_name": "Driver",
          "username": "demo_driver",
          "email": null,
          "driver_company_id": null,
          "status": "active",
          "role": "driver"
        }
      }
    }
  ],
  "pagination": {
    "per_page": 100,
    "page_no": 1,
    "total": 1
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <vehicles>
    <vehicle>
      <id>4</id>
      <company_id>5</company_id>
      <number>Demo Vehicle</number>
      <status>active</status>
      <ifta>true</ifta>
      <vin>WP0AB2966NS458669</vin>
      <make>Demo</make>
      <model>Vehicle</model>
      <year>2016</year>
      <license_plate_state>CA</license_plate_state>
      <license_plate_number>5M37250</license_plate_number>
      <metric_units>false</metric_units>
      <fuel_type>diesel</fuel_type>
      <prevent_auto_odometer_entry>false</prevent_auto_odometer_entry>
      <eld_device>
        <id>2</id>
        <identifier>000074802542164638439715893965</identifier>
        <model>lbb-1</model>
      </eld_device>
      <current_driver>
        <id>11</id>
        <first_name>Demo</first_name>
        <last_name>Driver</last_name>
        <username>demo_driver</username>
        <email nil="true"/>
        <driver_company_id nil="true"/>
        <status>active</status>
        <role>driver</role>
      </current_driver>
    </vehicle>
  </vehicles>
  <pagination>
    <per_page>100</per_page>
    <page_no>1</page_no>
    <total>1</total>
  </pagination>
</data>
Suggest Edits

/vehicles/:id

Get a specific vehicle

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/vehicles/id

Path Params

id
int32
required

Vehicle's ID.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
string

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/vehicles/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/vehicles/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/vehicles/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/vehicles/id");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/vehicles/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "vehicle": {
    "id": 4,
    "company_id": 5,
    "number": "Demo Vehicle",
    "status": "active",
    "ifta": true,
    "vin": "WP0AB2966NS458669",
    "make": "Demo",
    "model": "Vehicle",
    "year": "2016",
    "license_plate_state": "CA",
    "license_plate_number": "5M37250",
    "metric_units": false,
    "fuel_type": "diesel",
    "prevent_auto_odometer_entry": false,
    "eld_device": {
      "id": 2,
      "identifier": "000074802542164638439715893965",
      "model": "lbb-1"
    },
    "current_driver": {
      "id": 11,
      "first_name": "Demo",
      "last_name": "Driver",
      "username": "demo_driver",
      "email": null,
      "driver_company_id": null,
      "status": "active",
      "role": "driver"
    }
  }
}
{
  "error_message": "vehicle not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <id>4565</id>
    <company_id>8990</company_id>
    <number>301</number>
    <status>active</status>
    <ifta>true</ifta>
    <vin>WP0AB2966NS458669</vin>
    <make>Demo</make>
    <model>Vehicle</model>
    <year>2016</year>
    <license_plate_state>CA</license_plate_state>
    <license_plate_number>5M37250</license_plate_number>
    <metric_units>false</metric_units>
    <fuel_type>diesel</fuel_type>
    <prevent_auto_odometer_entry>false</prevent_auto_odometer_entry>
    <eld_device>
        <id>4144</id>
        <identifier>99999999</identifier>
        <model>lbb-1</model>
    </eld_device>
    <current_driver>
        <id>294979</id>
        <first_name>John</first_name>
        <last_name>Connor</last_name>
        <username>demo_driver_1_kt3647454</username>
        <email nil="true"/>
        <driver_company_id nil="true"/>
        <status>active</status>
        <role>driver</role>
    </current_driver>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>vehicle not found</error_message>
</error>
Suggest Edits

/vehicles

Create a new vehicle

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.keeptruckin.com/v1/vehicles

Body Params

number
string
required

Vehicle's number.

eld_device_id
int32

ID of the ELD Device to assign.

ifta
boolean

Set true if vehicle is included in IFTA calculations.

metric_units
boolean

Set true if the vehicle uses metric units.

fuel_type
string

Vehicle's fuel type. Valid values include diesel, gasoline, propane, lng, cng, ethanol, methanol, e85, m85, a55, biodiesel, and other.

vin
string

Vehicle's VIN.

license_plate_state
string

Vehicle's licences plate issuing state.

license_plate_number
string

Vehicle's licences plate number.

make
string

Vehicle's make.

model
string

Vehicle's model.

year
string

Vehicle's year.

prevent_auto_odometer_entry
boolean

Set true if odometer value should not be recorded from vehicle.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request POST \
  --url https://api.keeptruckin.com/v1/vehicles
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.keeptruckin.com/v1/vehicles' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/vehicles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.keeptruckin.com/v1/vehicles");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/vehicles"

response = requests.request("POST", url)

print(response.text)
A binary file was returned
{
  "vehicle": {
    "id": 4,
    "company_id": 5,
    "number": "Demo Vehicle",
    "status": "active",
    "ifta": true,
    "vin": "WP0AB2966NS458669",
    "make": "Demo",
    "model": "Vehicle",
    "year": "2016",
    "license_plate_state": "CA",
    "license_plate_number": "5M37250",
    "metric_units": false,
    "fuel_type": "diesel",
    "eld_device": {
      "id": 2,
      "identifier": "000074802542164638439715893965",
      "model": "lbb-1"
    },
    "current_driver": {
      "id": 11,
      "first_name": "Demo",
      "last_name": "Driver",
      "username": "demo_driver",
      "email": null,
      "driver_company_id": null,
      "status": "active",
      "role": "driver"
    }
  }
}
{
  "error_message": "vehicle could not be created",
  "details": {
    "number": [
      "has already been taken"
    ]
  }
}
<?xml version="1.0" encoding="UTF-8" ?>
<data>
  <id>4</id>
  <company_id>5</company_id>
  <number>Demo Vehicle</number>
  <status>active</status>
  <ifta>true</ifta>
  <vin>WP0AB2966NS458669</vin>
  <make>Demo</make>
  <model>Vehicle</model>
  <year>2016</year>
  <license_plate_state>CA</license_plate_state>
  <license_plate_number>5M37250</license_plate_number>
  <metric_units>false</metric_units>
  <fuel_type>diesel</fuel_type>
  <eld_device>
    <id>2</id>
    <identifier>000074802542164638439715893965</identifier>
    <model>lbb-1</model>
  </eld_device>
  <current_driver>
    <id>11</id>
    <first_name>Demo</first_name>
    <last_name>Driver</last_name>
    <username>demo_driver</username>
    <email />
    <driver_company_id />
    <status>active</status>
    <role>driver</role>
  </current_driver>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>vehicle could not be created</error_message>
  <details>
    <detail>Number has already been taken</detail>
  </details>
</error>
Suggest Edits

/vehicles

Update an existing vehicle

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.keeptruckin.com/v1/vehicles

Path Params

id
int32
required

id of the vehicle to update

Body Params

eld_device_id
int32

ID of the ELD Device to assign.

ifta
boolean

Set true if vehicle is included in IFTA calculations.

metric_units
boolean

Set true if the vehicle uses metric units.

fuel_type
string

Vehicle's fuel type. Valid values include diesel, gasoline, propane, lng, cng, ethanol, methanol, e85, m85, a55, biodiesel, and other.

vin
string

Vehicle's VIN.

license_plate_state
string

Vehicle's licences plate issuing state.

license_plate_number
string

Vehicle's licences plate number.

make
string

Vehicle's make.

model
string

Vehicle's model.

year
string

Vehicle's year.

prevent_auto_odometer_entry
boolean

Set true if odometer value should not be recorded from vehicle.

status
string

Vehicle's status. Valid values include active and deactivated.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request PUT \
  --url https://api.keeptruckin.com/v1/vehicles
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.keeptruckin.com/v1/vehicles' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/vehicles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.keeptruckin.com/v1/vehicles");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/vehicles"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned
{
  "vehicle": {
    "id": 4565,
    "company_id": 8990,
    "number": "301",
    "status": "active",
    "ifta": true,
    "vin": "WP0AB2966NS458669",
    "make": "Demo",
    "model": "Vehicle",
    "year": "2016",
    "license_plate_state": "CA",
    "license_plate_number": "5M37250",
    "metric_units": false,
    "fuel_type": "diesel",
    "prevent_auto_odometer_entry": false,
    "eld_device": {
      "id": 4144,
      "identifier": "99999999",
      "model": "lbb-1"
    },
    "current_driver": {
      "id": 294979,
      "first_name": "John",
      "last_name": "Connor",
      "username": "demo_driver_1_kt3647454",
      "email": null,
      "driver_company_id": null,
      "status": "active",
      "role": "driver"
    }
  }
}
{
  "error_message": "vehicle could not be updated"
}
{
  "error_message": "vehicle not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <id>4565</id>
  <company_id>8990</company_id>
  <number>301</number>
  <status>active</status>
  <ifta>true</ifta>
  <vin>WP0AB2966NS458669</vin>
  <make>Demo</make>
  <model>Vehicle</model>
  <year>2016</year>
  <license_plate_state>CA</license_plate_state>
  <license_plate_number>5M37250</license_plate_number>
  <metric_units>false</metric_units>
  <fuel_type>diesel</fuel_type>
  <prevent_auto_odometer_entry>false</prevent_auto_odometer_entry>
  <eld_device>
    <id>4144</id>
    <identifier>99999999</identifier>
    <model>lbb-1</model>
  </eld_device>
  <current_driver>
    <id>294979</id>
    <first_name>John</first_name>
    <last_name>Connor</last_name>
    <username>demo_driver_1_kt3647454</username>
    <email nil="true"/>
    <driver_company_id nil="true"/>
    <status>active</status>
    <role>driver</role>
  </current_driver>
</data>
<?xml version="1.0" encoding="UTF-8" ?>
<error>
	<error_message>vehicle could not be updated</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>vehicle not found</error_message>
</error>
Suggest Edits

ELD Device Object

 

An ELD Device object represents the actual hardware device that is used to record data from engine and other sensors. Once the ELD Device record is assigned to a vehicle, all data recorded after the assignment is attributed to the specific vehicle. If the ELD Device record is re-assigned to a different vehicle, the data recorded after the re-assignment is attributes to the new vehicle.

Recording data

Assign an ELD device record to a Vehicle record before using the hardware otherwise the data will not be attributed to the specific vehicle.

Suggest Edits

/eld_devices

List company eld devices

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/eld_devices

Query Params

identifiers
array of strings

List of ELD identifiers.

vehicle_ids
array of integers

List of vehicle IDs assigned to ELDs.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
string

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/eld_devices
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/eld_devices' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/eld_devices")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/eld_devices");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/eld_devices"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "eld_devices": [
    {
      "eld_device": {
        "vehicle": {
          "id": 1,
          "number": "Demo Vehicle",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        },
        "id": 1,
        "identifier": "81323613",
        "model": "lbb-1"
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 1
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <eld_devices>
        <eld_device>
            <vehicle>
                <id>11004</id>
                <number>303</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458662</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <id>9200</id>
            <identifier>99999979</identifier>
            <model>lbb-1</model>
        </eld_device>
        <eld_device>
            <vehicle>
                <id>11003</id>
                <number>302</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458661</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <id>9199</id>
            <identifier>99999989</identifier>
            <model>lbb-1</model>
        </eld_device>
        <eld_device>
            <vehicle>
                <id>4565</id>
                <number>301</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458669</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <id>4144</id>
            <identifier>99999999</identifier>
            <model>lbb-1</model>
        </eld_device>
    </eld_devices>
    <pagination>
        <per_page>25</per_page>
        <page_no>1</page_no>
        <total>3</total>
    </pagination>
</data>
Suggest Edits

Group Object

 

A Group record is a collection of drivers or vehicles. You can use Groups to retrieve data for a select set of drivers or vehicles. You can also restrict fleet manager's access to limited groups.

Following set of endpoints can be used to manage groups and their members. Members are further classified into drivers(users) and vehicles.

Data visibility

Since some of the fleet's data is associated with both vehicle and user, the fleet manager can see data tied a vehicle and a user if he has access to a group with either that user or vehicle. The objects that are associated with both vehicle and user include vehicle inspection reports, driving events, driver performance events, etc.

Suggest Edits

/groups

List company groups

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/groups

Query Params

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/groups
var request = require("request");

var options = { method: 'GET', url: 'https://api.keeptruckin.com/v1/groups' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/groups");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "groups": [
    {
      "group": {
        "id": 6,
        "name": "Garden, Electronics & Baby",
        "company_id": 75,
        "creator": null
      }
    },
    {
      "group": {
        "id": 5,
        "name": "music",
        "company_id": 75,
        "user": {
          "id": 158,
          "first_name": "Amory",
          "last_name": "Davis",
          "username": null,
          "email": "d77d64aa04d1@keeptruckin.com",
          "driver_company_id": 75,
          "status": "active",
          "role": "admin"
        }
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 2
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <groups>
        <group>
            <id>2481</id>
            <name>Albuquerque</name>
            <company_id>8990</company_id>
            <user>
                <id>295456</id>
                <first_name>Amory</first_name>
                <last_name>Davis</last_name>
                <username nil="true"/>
                <email>amory.davis+demo@keeptruckin.com</email>
                <driver_company_id nil="true"/>
                <status>active</status>
                <role>admin</role>
            </user>
        </group>
        <group>
            <id>2742</id>
            <name>Blue Group</name>
            <company_id>8990</company_id>
            <user>
                <id>381682</id>
                <first_name>Taurie</first_name>
                <last_name>Bjerken</last_name>
                <username nil="true"/>
                <email>taurie+demofleet@keeptruckin.com</email>
                <driver_company_id nil="true"/>
                <status>active</status>
                <role>admin</role>
            </user>
        </group>
    </groups>
    <pagination>
        <per_page>25</per_page>
        <page_no>1</page_no>
        <total>2</total>
    </pagination>
</data>
Suggest Edits

/groups/:id

Get a specific group

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/groups/id

Path Params

id
int32
required

ID of the group.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/groups/id
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/groups/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/groups/id");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "group": {
    "id": 7,
    "name": "Grocery & Shoes",
    "company_id": 75,
    "user": {
      "id": 295456,
      "first_name": "Amory",
      "last_name": "Davis",
      "username": null,
      "email": "d77d64aa04d1@keeptruckin.com",
      "driver_company_id": null,
      "status": "active",
      "role": "admin"
    }
  }
}
{
  "error_message": "group not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
		<id>7</id>
    <name>Grocery & Shoes</name>
    <company_id>75</company_id>
    <user>
        <id>295456</id>
        <first_name>Amory</first_name>
        <last_name>Davis</last_name>
        <username nil="true"/>
        <email>d77d64aa04d1@keeptruckin.com</email>
        <driver_company_id nil="true"/>
        <status>active</status>
        <role>admin</role>
    </user>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>group not found</error_message>
</error>
Suggest Edits

/groups

Create a new group

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.keeptruckin.com/v1/groups

Body Params

name
string
required

Group's name.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request POST \
  --url https://api.keeptruckin.com/v1/groups
var request = require("request");

var options = { method: 'POST', url: 'https://api.keeptruckin.com/v1/groups' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.keeptruckin.com/v1/groups");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups"

response = requests.request("POST", url)

print(response.text)
A binary file was returned
{
  "group": {
    "id": 1,
    "name": "East Coast",
    "company_id": 75,
    "user": {
      "id": 158,
      "first_name": "Addison",
      "last_name": "Hahn",
      "username": null,
      "email": "d77d64aa04d1@keeptruckin.com",
      "driver_company_id": null,
      "status": "active",
      "role": "admin"
    }
  }
}
{
  "error_message": "name is missing"
}
<?xml version="1.0" encoding="UTF-8" ?>
<data>
  <id>1</id>
  <name>East Coast</name>
  <company_id>75</company_id>
  <user>
    <id>158</id>
    <first_name>Addison</first_name>
    <last_name>Hahn</last_name>
    <username></username>
    <email>d77d64aa04d1@keeptruckin.com</email>
    <driver_company_id></driver_company_id>
    <status>active</status>
    <role>admin</role>
  </user>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>name is missing</error_message>
</error>
Suggest Edits

/groups/:id

Update an existing group

 

Header Auth

 Authentication is required for this endpoint.
puthttps://api.keeptruckin.com/v1/groups/id

Path Params

id
int32
required

ID of the group.

Body Params

name
string
required

Group's name.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request PUT \
  --url https://api.keeptruckin.com/v1/groups/id
var request = require("request");

var options = { method: 'PUT',
  url: 'https://api.keeptruckin.com/v1/groups/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("PUT", "https://api.keeptruckin.com/v1/groups/id");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id"

response = requests.request("PUT", url)

print(response.text)
A binary file was returned
{
  "group": {
    "id": 1,
    "name": "East Coast",
    "company_id": 75,
    "user": {
      "id": 158,
      "first_name": "Addison",
      "last_name": "Hahn",
      "username": null,
      "email": "d77d64aa04d1@keeptruckin.com",
      "driver_company_id": null,
      "status": "active",
      "role": "admin"
    }
  }
}
{
  "error_message": "name is missing"
}
{
  "error_message": "group not found"
}
<?xml version="1.0" encoding="UTF-8" ?>
<data>
  <id>1</id>
  <name>East Coast</name>
  <company_id>75</company_id>
  <user>
    <id>158</id>
    <first_name>Addison</first_name>
    <last_name>Hahn</last_name>
    <username></username>
    <email>d77d64aa04d1@keeptruckin.com</email>
    <driver_company_id></driver_company_id>
    <status>active</status>
    <role>admin</role>
  </user>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>name is missing</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group not found</error_message>
</error>
Suggest Edits

/groups/:id

Delete an existing group

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.keeptruckin.com/v1/groups/id

Path Params

id
int32
required

Group's ID.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request DELETE \
  --url https://api.keeptruckin.com/v1/groups/id
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.keeptruckin.com/v1/groups/id' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.keeptruckin.com/v1/groups/id");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned
{
  "success": true
}
{
  "error_message": "group could not be destroyed"
}
{
  "error_message": "group not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <success>true</success>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group could not be destroyed</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group not found</error_message>
</error>
Suggest Edits

/groups/:id/users

List drivers in a group

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/groups/id/users

Path Params

id
int32
required

Group's ID.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/groups/id/users
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/groups/id/users' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/groups/id/users");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id/users"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "users": [
    {
      "user": {
        "id": 378674,
        "first_name": "Brian",
        "last_name": "Ingram",
        "username": null,
        "email": null,
        "driver_company_id": null,
        "status": "deactivated",
        "role": "driver"
      }
    },
    {
      "user": {
        "id": 378672,
        "first_name": "Mark",
        "last_name": "Jordan",
        "username": "demo_driver_2_kt3647454",
        "email": null,
        "driver_company_id": null,
        "status": "active",
        "role": "driver"
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 2
  }
}
{
  "error_message": "group not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <users>
    <user>
      <id>378674</id>
      <first_name>Brian</first_name>
      <last_name>Ingram</last_name>
      <username nil="true"/>
      <email nil="true"/>
      <driver_company_id nil="true"/>
      <status>deactivated</status>
      <role>driver</role>
    </user>
    <user>
      <id>378672</id>
      <first_name>Mark</first_name>
      <last_name>Jordan</last_name>
      <username>demo_driver_2_kt3647454</username>
      <email nil="true"/>
      <driver_company_id nil="true"/>
      <status>active</status>
      <role>driver</role>
    </user>
  </users>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>2</total>
  </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>group not found</error_message>
</error>
Suggest Edits

/groups/:id/vehicles

List vehicles in a group

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/groups/id/vehicles

Path Params

id
int32
required

Group's ID.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/groups/id/vehicles
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/groups/id/vehicles' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id/vehicles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/groups/id/vehicles");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id/vehicles"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "vehicles": [
    {
      "vehicle": {
        "id": 4565,
        "number": "301",
        "status": "active",
        "make": "Demo",
        "model": "Vehicle"
      }
    },
    {
      "vehicle": {
        "id": 11004,
        "number": "303",
        "status": "active",
        "make": "Demo",
        "model": "Vehicle"
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 2
  }
}
{
  "error_message": "group not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <vehicles>
    <vehicle>
      <id>4565</id>
      <number>301</number>
      <status>active</status>
      <make>Demo</make>
      <model>Vehicle</model>
    </vehicle>
    <vehicle>
      <id>11004</id>
      <number>303</number>
      <status>active</status>
      <make>Demo</make>
      <model>Vehicle</model>
    </vehicle>
  </vehicles>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>2</total>
  </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>group not found</error_message>
</error>
Suggest Edits

/groups/:id/users

Add drivers to a group

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.keeptruckin.com/v1/groups/id/users

Path Params

id
int32
required

Group's ID.

Query Params

ids
array of integers

List of driver IDs to add to the group.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request POST \
  --url https://api.keeptruckin.com/v1/groups/id/users
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.keeptruckin.com/v1/groups/id/users' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.keeptruckin.com/v1/groups/id/users");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id/users"

response = requests.request("POST", url)

print(response.text)
A binary file was returned
{
  "success": true
}
{
  "error_message": "group not found"
}
{
  "error_message": "user Alexandrea Koch 11 could not be added to the group"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <success>true</success>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group not found</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>user Alexandrea Koch 11 could not be added to the group</error_message>
</error>
Suggest Edits

/groups/:id/vehicles

Add vehicles to a group

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.keeptruckin.com/v1/groups/id/vehicles

Path Params

id
int32
required

id of the group

Query Params

ids
array of integers

List of vehicle IDs to add to the group.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request POST \
  --url https://api.keeptruckin.com/v1/groups/id/vehicles
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.keeptruckin.com/v1/groups/id/vehicles' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id/vehicles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.keeptruckin.com/v1/groups/id/vehicles");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id/vehicles"

response = requests.request("POST", url)

print(response.text)
A binary file was returned
{
  "success": true
}
{
  "error_message": "group not found"
}
{
  "error_message": "vehicle V-1000 11 could not be added to the group"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <success>true</success>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group not found</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>vehicle V-1000 11 could not be added to the group</error_message>
</error>
Suggest Edits

/groups/:id/users

Delete users from a group

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.keeptruckin.com/v1/groups/id/users

Path Params

id
int32
required

Group's ID.

Query Params

ids
array of integers

List of driver IDs to remove from the group.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request DELETE \
  --url https://api.keeptruckin.com/v1/groups/id/users
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.keeptruckin.com/v1/groups/id/users' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id/users")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.keeptruckin.com/v1/groups/id/users");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id/users"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned
{
  "success": true
}
{
  "error_message": "group not found"
}
{
  "error_message": "user Alexandrea Koch 11 could not be removed from the group"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <success>true</success>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group not found</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>user Alexandrea Koch 11 could not be removed from the group</error_message>
</error>
Suggest Edits

/groups/:id/vehicles

Delete vehicles from a group

 

Header Auth

 Authentication is required for this endpoint.
deletehttps://api.keeptruckin.com/v1/groups/id/vehicles

Path Params

id
int32
required

Group's ID.

Query Params

ids
array of integers

List of vehicle IDs to remove from the group.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
string

ID of the Fleet Admin accessing the API.

curl --request DELETE \
  --url https://api.keeptruckin.com/v1/groups/id/vehicles
var request = require("request");

var options = { method: 'DELETE',
  url: 'https://api.keeptruckin.com/v1/groups/id/vehicles' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/groups/id/vehicles")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Delete.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("DELETE", "https://api.keeptruckin.com/v1/groups/id/vehicles");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/groups/id/vehicles"

response = requests.request("DELETE", url)

print(response.text)
A binary file was returned
{
  "success": true
}
{
  "error_message": "group not found"
}
{
  "error_message": "vehicle V-1000 11 could not be removed from the group"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <success>true</success>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>group not found</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>vehicle V-1000 11 could not be removed from the group</error_message>
</error>
 

The following set of endpoints can be used to access drivers' Hours of Service information which includes:

  1. Available time left in driver's current cycle: The available time includes cycle, shift, drive, and optionally break time remaining in driver's current cycle. The metrics are calculated on the fly so the times are accurate up to the second level.
  2. Number of hours worked in last cycle days: The numbers of hours worked includes time spent in on-duty and driving statuses in the last cycle days e.g. if driver follows 60 hour 7 day US Property cycle the API will return 7 days of hours worked.
  3. Hours of Service Violations The responds includes all hours of service violations of drivers' in the given time range.
  4. Hours of Service logs of drivers': Each hours of service log include log form attributes, duty status changes, remarks, cycle restarts, and violations.
Suggest Edits

/available_time

List company drivers with available times

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/available_time

Query Params

driver_ids
array of integers

List of driver IDs.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/available_time
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/available_time' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/available_time")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/available_time");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/available_time"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "users": [
    {
      "user": {
        "duty_status": "off_duty",
        "id": 161,
        "first_name": "Alexandrea",
        "last_name": "Koch",
        "username": "alexandrea_koch",
        "email": null,
        "driver_company_id": 75,
        "status": "active",
        "role": "driver",
        "available_time": {
          "drive": 39600,
          "shift": 50400,
          "cycle": 252000,
          "break": 28800
        },
        "recap": {
          "on_duty_duration": [
            {
              "date": "2016-07-18",
              "duration": 1200.0
            },
            {
              "date": "2016-07-17",
              "duration": 600.0
            },
            {
              "date": "2016-07-16",
              "duration": 0
            },
            {
              "date": "2016-07-15",
              "duration": 0
            },
            {
              "date": "2016-07-14",
              "duration": 0
            },
            {
              "date": "2016-07-13",
              "duration": 0
            },
            {
              "date": "2016-07-12",
              "duration": 0
            }
          ],
          "driving_duration": [
            {
              "date": "2016-07-18",
              "duration": 1200.0
            },
            {
              "date": "2016-07-17",
              "duration": 600.0
            },
            {
              "date": "2016-07-16",
              "duration": 0
            },
            {
              "date": "2016-07-15",
              "duration": 0
            },
            {
              "date": "2016-07-14",
              "duration": 0
            },
            {
              "date": "2016-07-13",
              "duration": 0
            },
            {
              "date": "2016-07-12",
              "duration": 0
            }
          ]
        },
        "last_hos_status": {
          "status": "on_duty",
          "time": "2016-07-18T07:40:00Z"
        },
        "last_cycle_reset": {
          "type": "34_hour",
          "start_time": "2016-07-16T22:00:00Z",
          "end_time": "2016-07-18T08:00:00Z"
        }
      }
    },
    {
      "user": {
        "id": 159,
        "first_name": "Anahi",
        "last_name": "Flatley",
        "driver_company_id": 75,
        "duty_status": "on_duty",
        "available_time": {
          "drive": 39600,
          "shift": 50400,
          "cycle": 252000,
          "break": 28800
        },
        "recap": {
          "on_duty_duration": [
            {
              "date": "2016-07-18",
              "duration": 0
            },
            {
              "date": "2016-07-17",
              "duration": 0
            },
            {
              "date": "2016-07-16",
              "duration": 0
            },
            {
              "date": "2016-07-15",
              "duration": 0
            },
            {
              "date": "2016-07-14",
              "duration": 0
            },
            {
              "date": "2016-07-13",
              "duration": 0
            },
            {
              "date": "2016-07-12",
              "duration": 0
            }
          ],
          "driving_duration": [
            {
              "date": "2016-07-18",
              "duration": 0
            },
            {
              "date": "2016-07-17",
              "duration": 0
            },
            {
              "date": "2016-07-16",
              "duration": 0
            },
            {
              "date": "2016-07-15",
              "duration": 0
            },
            {
              "date": "2016-07-14",
              "duration": 0
            },
            {
              "date": "2016-07-13",
              "duration": 0
            },
            {
              "date": "2016-07-12",
              "duration": 0
            }
          ]
        },
        "last_hos_status": {
          "status": "on_duty",
          "time": "2016-07-18T07:40:00Z"
        },
        "last_cycle_reset": null
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 2
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <users>
    <user>
      <duty_status>off_duty</duty_status>
      <id>161</id>
      <first_name>Alexandrea</first_name>
      <last_name>Koch</last_name>
      <username nil="true"/>
      <email nil="true"/>
      <driver_company_id>75</driver_company_id>
      <status>deactivated</status>
      <role>driver</role>
      <available_time>
        <drive>39600</drive>
        <shift>50400</shift>
        <cycle>252000</cycle>
        <break>28800</break>
      </available_time>
      <recap>
        <on_duty_duration>
          <on_duty_duration>
            <date>2016-07-18</date>
            <duration>1200.0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-17</date>
            <duration>600.0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-16</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-15</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-14</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-13</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-12</date>
            <duration>0</duration>
          </on_duty_duration>
        </on_duty_duration>
        <driving_duration>
          <driving_duration>
            <date>2016-07-18</date>
            <duration>1200.0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-17</date>
            <duration>600.0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-16</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-15</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-14</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-13</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-12</date>
            <duration>0</duration>
          </driving_duration>
        </driving_duration>
      </recap>
      <last_hos_status>
        <status>on_duty</status>
        <time>2016-07-18T07:40:00Z</time>
      </last_hos_status>
      <last_cycle_reset>
        <type>34_hour</type>
        <start_time>2016-07-16T22:00:00Z</start_time>
        <end_time>2016-07-18T08:00:00Z</end_time>
      </last_cycle_reset>
    </user>
    <user>
      <id>159</id>
      <first_name>Anahi</first_name>
      <last_name>Flatley</last_name>
      <driver_company_id>75</driver_company_id>
      <duty_status>on_duty</duty_status>
      <available_time>
        <drive>39600</drive>
        <shift>50400</shift>
        <cycle>252000</cycle>
        <break>28800</break>
      </available_time>
      <recap>
        <on_duty_duration>
          <on_duty_duration>
            <date>2016-07-18</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-17</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-16</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-15</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-14</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-13</date>
            <duration>0</duration>
          </on_duty_duration>
          <on_duty_duration>
            <date>2016-07-12</date>
            <duration>0</duration>
          </on_duty_duration>
        </on_duty_duration>
        <driving_duration>
          <driving_duration>
            <date>2016-07-18</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-17</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-16</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-15</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-14</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-13</date>
            <duration>0</duration>
          </driving_duration>
          <driving_duration>
            <date>2016-07-12</date>
            <duration>0</duration>
          </driving_duration>
        </driving_duration>
      </recap>
      <last_hos_status>
        <status>on_duty</status>
        <time>2016-07-18T07:40:00Z</time>
      </last_hos_status>
      <last_cycle_reset nil="true"/>
    </user>
  </users>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>2</total>
  </pagination>
</data>
Suggest Edits

/hours_of_service

List company drivers with hours of service

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/hours_of_service

Query Params

driver_ids
array of integers

List of driver IDs for Hours of Service records.

start_date
date

Start date for Hours of Service records.

end_date
date

End date for Hours of Service records.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/hours_of_service
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/hours_of_service' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/hours_of_service")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/hours_of_service");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/hours_of_service"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "hours_of_services": [
    {
      "hours_of_service": {
        "id": 47,
        "date": "2016-11-22",
        "off_duty_duration": 43200,
        "on_duty_duration": 7200,
        "sleeper_duration": 0,
        "driving_duration": 21600,
        "waiting_duration": 0,
        "driver": {
          "id": 11,
          "first_name": "Demo",
          "last_name": "Driver",
          "username": "demo_driver",
          "email": null,
          "driver_company_id": null,
          "status": "active",
          "role": "driver"
        }
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 1
  }
}
{
  "error_message": "date duration cannot be greater than 1 year"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <hours_of_services>
        <hours_of_service>
            <id>47</id>
            <date>2016-11-22</date>
            <off_duty_duration>43200</off_duty_duration>
            <on_duty_duration>7200</on_duty_duration>
            <sleeper_duration>0</sleeper_duration>
            <driving_duration>21600</driving_duration>
            <waiting_duration>0</waiting_duration>
            <driver>
                <id>11</id>
                <first_name>Demo</first_name>
                <last_name>Driver</last_name>
                <username>demo_driver</username>
                <email />
                <driver_company_id />
                <status>active</status>
                <role>driver</role>
            </driver>
        </hours_of_service>
    </hours_of_services>
    <pagination>
        <per_page>25</per_page>
        <page_no>1</page_no>
        <total>1</total>
    </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>date duration cannot be greater than 1 year</error_message>
</error>
Suggest Edits

/hos_violations

List company drivers' HOS violations

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/hos_violations

Query Params

driver_ids
array of integers
min_start_time
date

Start time for HOS violations.

max_start_time
date

End time for HOS violations.

violation_types
array of strings

List of violation types. Valid values include break_30, driving_11, duty_14, duty_16, cycle_60, cycle_70, driving_10, duty_15, cycle_60_p, cycle_70_p, canada_driving_13, canada_driving_15, canada_duty_14, canada_duty_16, canada_duty_18, canada_duty_20, canada_daily_break_8, canada_daily_break_10, canada_daily_driving_13, canada_daily_duty_14, canada_cycle_70, canada_cycle_80, canada_cycle_120, canada_break_24, canada_break_24_70, canada_break_24_80, canada_oil_driving_13, canada_oil_duty_14, canada_oil_duty_16, canada_oil_break_3_24, canada_oil_daily_driving_13, canada_oil_daily_duty_14, canada_oil_daily_break_10, ca_driving_12, ca_duty_16, ca_cycle_80, ca_driving_10, ca_duty_15, ca_duty_16_p, ca_cycle_80_p, tx_driving_12, tx_duty_15, tx_cycle_70, ak_cycle_70, ak_cycle_80, ak_duty_20, ak_driving_15, ak_cycle_70_p, and ak_cycle_80_p.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/hos_violations
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/hos_violations' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/hos_violations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/hos_violations");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/hos_violations"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "hos_violations": [
    {
      "hos_violation": {
        "id": 97,
        "type": "ca_duty_15",
        "start_time": "2016-03-12T19:00:00Z",
        "end_time": null,
        "name": "15 Hour On Duty Limit",
        "user": {
          "id": 156,
          "first_name": "Harold",
          "last_name": "Hoeger",
          "username": "hobart",
          "email": null,
          "driver_company_id": null,
          "status": "deactivated",
          "role": "driver"
        }
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 1
  }
}
{
  "error_message": "start_time duration cannot be greater than 1 year"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <hos_violations>
    <hos_violation>
      <id>97</id>
      <type>ca_duty_15</type>
      <start_time>2016-03-12T19:00:00Z</start_time>
      <end_time nil="true"/>
      <name>15 Hour On Duty Limit</name>
      <user>
        <id>156</id>
        <first_name>Harold</first_name>
        <last_name>Hoeger</last_name>
        <username>hobart</username>
        <email nil="true"/>
        <driver_company_id nil="true"/>
        <status>deactivated</status>
        <role>driver</role>
      </user>
    </hos_violation>
  </hos_violations>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>1</total>
  </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>start_time duration cannot be greater than 1 year</error_message>
</error>
Suggest Edits

/logs

List company drivers' HOS logs

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/logs

Query Params

driver_ids
array of integers

List of driver IDs for log records.

start_date
date

Start date for HOS log records.

end_date
date

End date for HOS log records.

status
string

Status of the HOS log. Valid values include all, compliant, hos, form_and_manner, and missing_dvirs.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/logs
var request = require("request");

var options = { method: 'GET', url: 'https://api.keeptruckin.com/v1/logs' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/logs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/logs");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/logs"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "logs": [
    {
      "log": {
        "id": 47,
        "date": "2016-11-22",
        "total_miles": 300,
        "metric_units": false,
        "driver_signed_at": "2016-07-16T00:05:21Z",
        "driver_signature_url": "https://keep-truckin-development.s3.amazonaws.com/uploads/log/driver_signature_upload/47/open-uri20160729-30633-1jeoj77?AWSAccessKeyId=AKIAJHHsdfsTJMZBMLQ&Expires=1485085850&Signature=YXqKF9nyfJI%2qEEq3obOLlFzsuKs0%3D",
        "time_zone": "Pacific Time (US & Canada)",
        "cycle": "70_8",
        "driver_first_name": "Demo",
        "driver_last_name": "Driver",
        "carrier_name": "Demo Carrier",
        "carrier_street": "415 Truckin St.",
        "carrier_city": "San Francisco",
        "carrier_state": "CA",
        "carrier_zip": "94105",
        "terminal_street": null,
        "terminal_city": null,
        "terminal_state": null,
        "terminal_zip": null,
        "notes": null,
        "driver_company_id": null,
        "origin": null,
        "destination": null,
        "exception_24_hour_restart": false,
        "exception_8_hour_break": false,
        "exception_wait_time": false,
        "exception_short_haul": false,
        "short_haul": false,
        "eld_mode": "logs",
        "co_driver_full_names": [],
        "odometers": {},
        "trailer_numbers": "17",
        "vehicle_numbers": "12345, 12",
        "off_duty_duration": 43200,
        "on_duty_duration": 7200,
        "sleeper_duration": 0,
        "driving_duration": 21600,
        "waiting_duration": 0,
        "driver": {
          "id": 11,
          "first_name": "Demo",
          "last_name": "Driver",
          "username": "demo_driver",
          "email": null,
          "driver_company_id": null,
          "status": "active",
          "role": "driver"
        },
        "vehicles": [
          {
            "vehicle": {
              "id": 11,
              "number": "12345",
              "year": null,
              "make": null,
              "model": null,
              "vin": null,
              "metric_units": true
            }
          }
        ],
        "remarks": [
          {
            "remark": {
              "id": 1,
              "time": "2016-10-16T23:59:59Z",
              "notes": null,
              "location": null
            }
          }
        ],
        "cycle_restarts": [
          {
            "cycle_restart": {
              "id": 1,
              "start_time": "2016-10-16T08:00:00Z",
              "end_time": "2016-10-17T05:00:00Z",
              "type": "34_hour",
              "name": "34 Hour"
            }
          }
        ],
        "shipping_docs": "123ABC",
        "form_and_manner_errors": [],
        "hos_violations": [
          {
            "hos_violation": {
              "id": 12,
              "type": "canada_driving_13",
              "name": "13 Hour Driving Limit",
              "start_time": "2016-10-16T08:00:00Z",
              "end_time": "2016-10-17T07:00:00Z"
            }
          }
        ],
        "events": [
          {
            "event": {
              "id": 221,
              "type": "driving",
              "notes": null,
              "location": "Mobile, AL",
              "start_time": "2016-10-16T07:00:00Z",
              "end_time": "2016-10-16T09:00:00Z"
            }
          },
          {
            "event": {
              "id": 474,
              "type": "sleeper",
              "notes": null,
              "location": null,
              "start_time": "2016-10-16T09:00:00Z",
              "end_time": "2016-10-16T11:00:00Z"
            }
          },
          {
            "event": {
              "id": 475,
              "type": "driving",
              "notes": null,
              "location": null,
              "start_time": "2016-10-16T11:00:00Z",
              "end_time": "2016-10-17T07:00:00Z"
            }
          }
        ]
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 1
  }
}
{
  "error_message": "date duration cannot be greater than 1 year"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <logs>
    <log>
      <id>47</id>
      <date>2016-11-22</date>
      <total_miles>300</total_miles>
      <metric_units>false</metric_units>
      <driver_signed_at>2016-07-16T00:05:21Z</driver_signed_at>
      <driver_signature_url>https://keep-truckin-development.s3.amazonaws.com/uploads/log/driver_signature_upload/47/open-uri20160729-30633-1jeoj77?AWSAccessKeyId=AKIAJHHsdfsTJMZBMLQ&amp;Expires=1485086013&amp;Signature=0DBFDW3tLtgNYBYbsdfdsBmCNgQ0%3D</driver_signature_url>
      <time_zone>Pacific Time (US &amp; Canada)</time_zone>
      <cycle>70_8</cycle>
      <driver_first_name>Demo</driver_first_name>
      <driver_last_name>Driver</driver_last_name>
      <carrier_name>Demo Carrier</carrier_name>
      <carrier_street>415 Truckin St.</carrier_street>
      <carrier_city>San Francisco</carrier_city>
      <carrier_state>CA</carrier_state>
      <carrier_zip>94105</carrier_zip>
      <terminal_street nil="true"/>
      <terminal_city nil="true"/>
      <terminal_state nil="true"/>
      <terminal_zip nil="true"/>
      <notes nil="true"/>
      <driver_company_id nil="true"/>
      <origin nil="true"/>
      <destination nil="true"/>
      <exception_24_hour_restart>false</exception_24_hour_restart>
      <exception_8_hour_break>false</exception_8_hour_break>
      <exception_wait_time>false</exception_wait_time>
      <exception_short_haul>false</exception_short_haul>
      <short_haul>false</short_haul>
      <eld_mode>logs</eld_mode>
      <co_driver_full_names/>
      <odometers>
      </odometers>
      <trailer_numbers>17</trailer_numbers>
      <vehicle_numbers>12345, 12</vehicle_numbers>
      <off_duty_duration>43200</off_duty_duration>
      <on_duty_duration>7200</on_duty_duration>
      <sleeper_duration>0</sleeper_duration>
      <driving_duration>21600</driving_duration>
      <waiting_duration>0</waiting_duration>
      <driver>
        <id>11</id>
        <first_name>Demo</first_name>
        <last_name>Driver</last_name>
        <username>demo_driver</username>
        <email nil="true"/>
        <driver_company_id nil="true"/>
        <status>active</status>
        <role>driver</role>
      </driver>
      <vehicles>
        <vehicle>
          <id>11</id>
          <number>12345</number>
          <year nil="true"/>
          <make nil="true"/>
          <model nil="true"/>
          <vin nil="true"/>
          <metric_units>true</metric_units>
        </vehicle>
      </vehicles>
      <remarks>
        <remark>
          <id>1</id>
          <time>2016-10-16T23:59:59Z</time>
          <notes nil="true"/>
          <location nil="true"/>
        </remark>
      </remarks>
      <cycle_restarts>
        <cycle_restart>
          <id>1</id>
          <start_time>2016-10-16T08:00:00Z</start_time>
          <end_time>2016-10-17T05:00:00Z</end_time>
          <type>34_hour</type>
          <name>34 Hour</name>
        </cycle_restart>
      </cycle_restarts>
      <shipping_docs>123ABC</shipping_docs>
      <form_and_manner_errors/>
      <hos_violations>
        <hos_violation>
          <hos_violation>
            <id>12</id>
            <type>canada_driving_13</type>
            <name>13 Hour Driving Limit</name>
            <start_time>2016-10-16T08:00:00Z</start_time>
            <end_time>2016-10-17T07:00:00Z</end_time>
          </hos_violation>
        </hos_violation>
      </hos_violations>
      <events>
        <event>
          <event>
            <id>221</id>
            <type>driving</type>
            <notes nil="true"/>
            <location>Mobile, AL</location>
            <start_time>2016-10-16T07:00:00Z</start_time>
            <end_time>2016-10-16T09:00:00Z</end_time>
          </event>
        </event>
        <event>
          <event>
            <id>474</id>
            <type>sleeper</type>
            <notes nil="true"/>
            <location nil="true"/>
            <start_time>2016-10-16T09:00:00Z</start_time>
            <end_time>2016-10-16T11:00:00Z</end_time>
          </event>
        </event>
        <event>
          <event>
            <id>475</id>
            <type>driving</type>
            <notes nil="true"/>
            <location nil="true"/>
            <start_time>2016-10-16T11:00:00Z</start_time>
            <end_time>2016-10-17T07:00:00Z</end_time>
          </event>
        </event>
      </events>
    </log>
  </logs>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>1</total>
  </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>date duration cannot be greater than 1 year</error_message>
</error>
 

KeepTruckin's ELD and mobile app continuously record vehicle's and driver's location. The following set of endpoints can be used to:

  1. Get current locations of all company vehicles.
  2. Get vehicle's location history for a specific day.
  3. Get current locations of all company drivers.
Suggest Edits

/vehicle_locations

List company vehicles with current location and current driver

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/vehicle_locations

Query Params

vehicle_ids
array of integers

List of vehicle IDs.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/vehicle_locations
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/vehicle_locations' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/vehicle_locations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/vehicle_locations");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/vehicle_locations"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "vehicles": [
    {
      "vehicle": {
        "id": 23,
        "number": "V-1000",
        "year": null,
        "make": null,
        "model": null,
        "vin": null,
        "current_location": {
          "id": "af5b6e0d-c442-414c-88d2-d95e5cb7affe",
          "lat": 47.565647,
          "lon": -122.276261,
          "description": "Seattle, WA",
          "located_at": "2016-03-17T12:12:07Z",
          "bearing": 90.0,
          "type": "vehicle_moving",
          "speed": 65.1,
          "engine_hours": 123.56,
          "fuel": 121.33,
          "odometer": 456.22
         },
        "current_driver": {
          "id": 104,
          "first_name": "Jensen",
          "last_name": "Effertz",
          "username": null,
          "email": "6b6cf86e12d4@keeptruckin.com",
          "driver_company_id": null,
          "status": "deactivated",
          "role": "driver"
        }
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 1
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <vehicles>
    <vehicle>
      <id>23</id>
      <number>V-1000</number>
      <year nil="true"/>
      <make nil="true"/>
      <model nil="true"/>
      <vin nil="true"/>
      <current_location>
        <id>af5b6e0d-c442-414c-88d2-d95e5cb7affe</id>
        <lat>47.565647</lat>
        <lon>-122.276261</lon>
        <description>Seattle, WA</description>
        <located_at>2016-03-17T12:12:07Z</located_at>
        <bearing>90.0</bearing>
        <type>vehicle_moving</type>
        <speed>65.1</speed>
        <engine_hours>123.56</engine_hours>
        <fuel>121.33</fuel>
        <odometer>456.22</odometer>
      </current_location>
      <current_driver>
        <id>104</id>
        <first_name>Jensen</first_name>
        <last_name>Effertz</last_name>
        <username nil="true"/>
        <email>6b6cf86e12d4@keeptruckin.com</email>
        <driver_company_id nil="true"/>
        <status>deactivated</status>
        <role>driver</role>
      </current_driver>
    </vehicle>
  </vehicles>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>1</total>
  </pagination>
</data>
Suggest Edits

/vehicle_locations/:id

List vehicle's locations for a company vehicle

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/vehicle_locations/id

Path Params

id
int32
required

Vehicle's ID.

Query Params

date
date
required

Date for which location history is requested.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
string

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url 'https://api.keeptruckin.com/v1/vehicle_locations/id?date=date'
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/vehicle_locations/id',
  qs: { date: 'date' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/vehicle_locations/id?date=date")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/vehicle_locations/id?date=date");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/vehicle_locations/id"

querystring = {"date":"date"}

response = requests.request("GET", url, params=querystring)

print(response.text)
A binary file was returned
{
  "location_histories": [
    {
      "location_history": {
        "id": "af5b6e0d-c442-414c-88d2-d95e5cb7affe",
        "located_at": "2016-05-24T06:01:11Z",
        "lat": 123.0,
        "lon": 456.0,
        "bearing": 1.24,
        "engine_hours": 234.22,
        "type": "vehicle_moving",
        "description": "6.2 mi N of San Francisco, CA",
        "speed": 50.1,
        "odometer": 7.58693991,
        "fuel": 2.96665156
      },
      "location_history": {
        "id": "d1671b6d-d2ba-49f4-b8c3-8d0782a50d44",
        "located_at": "2016-05-24T09:01:11Z",
        "lat": 123.0,
        "lon": 456.0,
        "bearing": 2.24,
        "engine_hours": 244.22,
        "type": "breadcrumb",
        "description": "6.2 mi N of San Francisco, CA",
        "speed": 40.4,
        "odometer": 5.58623553,
        "fuel": 1.34645126
      }
    }
  ]
}
{
  "error_message": "date is missing"
}
{
  "error_message": "vehicle not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <location_histories>
    <location_history>
      <id>af5b6e0d-c442-414c-88d2-d95e5cb7affe</id>
      <located_at>2016-05-24T06:01:11Z</located_at>
      <loc>123.0</loc>
      <lan>456.0</lon>
      <bearing>1.24</bearing>
      <engine_hours>234.22</engine_hours>
      <type>vehicle_moving</type>
      <description>6.2 mi N of San Francisco, CA</description>
      <speed>50.1</speed>
      <odometer>7.58693991</odometer>
      <fuel> 2.96665156</fuel>
    </location_history>
    <location_history>
      <id>d1671b6d-d2ba-49f4-b8c3-8d0782a50d44</id>
      <located_at>2016-05-24T09:01:11Z</located_at>
      <loc>123.0</loc>
      <lan>456.0</lon>
      <bearing>2.24</bearing>
      <engine_hours>244.22</engine_hours>
      <type>breadcrumb</type>
      <description>6.2 mi N of San Francisco, CA</description>
      <speed>40.4</speed>
      <odometer>5.58623553</odometer>
      <fuel> 1.34645126</fuel>
    </location_history>
  </location_histories>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>date is missing</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>vehicle not found</error_message>
</error>
Suggest Edits

/driver_locations

List company drivers with current location and current vehicle

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/driver_locations

Query Params

driver_ids
array of integers

List of driver IDs.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
string

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/driver_locations
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/driver_locations' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/driver_locations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/driver_locations");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/driver_locations"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "users": [
    {
      "user": {
        "id": 156,
        "first_name": "Harold",
        "last_name": "Hoeger",
        "username": "hobart",
        "email": null,
        "driver_company_id": null,
        "status": "deactivated",
        "role": "driver",
        "current_location": {
          "id": 1395371911,
          "lat": -59.8708336274616,
          "lon": -91.2958210901819,
          "description": "Washington, AZ",
          "located_at": "2016-03-17T12:12:07Z"
         },
        "current_vehicle": {
          "id": 32,
          "number": "V-1000",
          "year": "2016",
          "make": null,
          "model": null,
          "vin": "WP0AB2966NS458669"
        }
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 1
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <users>
    <user>
      <id>156</id>
      <first_name>Harold</first_name>
      <last_name>Hoeger</last_name>
      <username>hobart</username>
      <email nil="true"/>
      <driver_company_id nil="true"/>
      <status>deactivated</status>
      <role>driver</role>
      <current_location>
        <id>205783</id>
        <lat>-59.8708336274616</lat>
        <lon>-91.2958210901819</lon>
        <description>Washington, NZ</description>
        <located_at>2016-03-17T12:12:07Z</located_at>
      </current_location>
      <current_vehicle>
        <id>32</id>
        <number>V-1000</number>
        <year>2016</year>
        <make nil="true"/>
        <model nil="true"/>
        <vin>WP0AB2966NS458662</vin>
      </current_vehicle>
    </user>
  </users>
  <pagination>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>1</total>
  </pagination>
</data>
Suggest Edits

Message Object

 

A message object represents a message sent or received by a user. The messaging feature can be used to send location, text, or an attachment. Each message includes read receipt that can be used to tell whether the message has been sent, delivered to user's device, or read by the user.

The API can be used to send message to a user in the fleet on any fleet admin's behalf. To specify the sender use the X-USER-ID header as mentioned in the API Overview section. As mentioned in the overview, we support the concept of a system or an API user. The following APIs allows the client to send message on behalf of any fleet admin, but limit access to messages of system user. Similarly the APIs can be used to update read receipts incoming messages that belong to system user.

Suggest Edits

/messages

Send a message to a company user

 

Header Auth

 Authentication is required for this endpoint.
posthttps://api.keeptruckin.com/v1/messages

Query Params

recipient_id
int32
required

User's ID who will receive the message.

body
string
required

Text that you want to send to the recipient.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request POST \
  --url 'https://api.keeptruckin.com/v1/messages?recipient_id=recipient_id&body=body'
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.keeptruckin.com/v1/messages',
  qs: 
   { recipient_id: 'recipient_id',
     body: 'body' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/messages?recipient_id=recipient_id&body=body")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.keeptruckin.com/v1/messages?recipient_id=recipient_id&body=body");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/messages"

querystring = {"recipient_id":"recipient_id","body":"body"}

response = requests.request("POST", url, params=querystring)

print(response.text)
A binary file was returned
{
  "success": true
}
{
  "error_message": "message could not be delivered"
}
{
  "error_message": "user not found"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <success>true</success>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>message could not be delivered</error_message>
</error>
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <error_message>user not found</error_message>
</error>
Suggest Edits

Inspection Report Object

 

An Inspection Report represents a vehicle's daily inspection report. Inspection report record is tied to both vehicle and driver. Each inspection report can contain multiple trailer and tractor defects.

Suggest Edits

/inspection_reports

List company vehicles' daily inspection reports

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/inspection_reports

Query Params

driver_ids
array of integers

List of driver IDs who submitted DVIRs.

vehicle_ids
array of integers

List of vehicle IDs assigned to DVIRs.

start_date
date

Start date of DVIRs.

end_date
date

End date of DVIRs.

status
string

DVIR's status. Valid values include all, with_defects, with_no_defects, with_signature_missing, unknown, harmless, corrected.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/inspection_reports
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/inspection_reports' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/inspection_reports")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/inspection_reports");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/inspection_reports"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "inspection_reports": [
    {
      "inspection_report": {
        "id": 9,
        "date": "2016-07-22",
        "time": "2016-07-22T14:00:00Z",
        "odometer": null,
        "carrier_name": "Demo Carrier",
        "vehicle_number": "Demo Vehicle",
        "trailer_nums": [
          "17"
        ],
        "location": "Omaha, NE",
        "city": "Omaha",
        "state": "NE",
        "status": "corrected",
        "mechanic_signed_at": "2016-07-22T14:00:00Z",
        "mechanic_signature_url": "https://keep-truckin-development.s3.amazonaws.com/uploads/inspection_report/mechanic_signature_upload/9/open-uri20160712-30633-thc30n?AWSAccessKeyId=AKIAJH12345&Expires=1481274629&Signature=Qi1mXnl0ylJ5tCuds789Ocq44L4%3D",
        "driver_signed_at": "2016-07-22T14:00:00Z",
        "driver_signature_url": "https://keep-truckin-development.s3.amazonaws.com/uploads/inspection_report/driver_signature_upload/9/open-uri20160729-30645-1jeoj77?AWSAccessKeyId=AKIAJH12345&Expires=1481274629&Signature=Qi1mXnl0ylJ5tCuds789Ocq44L4%3D",
        "defects": [
          {
            "defect": {
              "id": 5,
              "area": "tractor",
              "category": "Mirrors",
              "notes": null
            }
          },
          {
            "defect": {
              "id": 6,
              "area": "tractor",
              "category": "Oil Level",
              "notes": null
            }
          }
        ],
        "vehicle": {
          "id": 4,
          "number": "Demo Vehicle",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        },
        "mechanic": {
          "id": 12,
          "first_name": "Joe",
          "last_name": "Williams",
          "username": null,
          "email": "joe@example.com",
          "driver_company_id": null,
          "status": "active",
          "role": "admin"
        },
        "driver": {
          "id": 11,
          "first_name": "Demo",
          "last_name": "Driver",
          "username": "demo_driver",
          "email": null,
          "driver_company_id": null,
          "status": "active",
          "role": "driver"
        }
      }
    }
  ],
  "per_page": 25,
  "page_no": 1,
  "total": 3
}
{
  "error_message": "date duration cannot be greater than 1 year"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <inspection_reports>
        <inspection_report>
            <id>9</id>
            <date>2016-07-22</date>
            <time>2016-07-22T14:00:00Z</time>
            <odometer nil="true"/>
            <carrier_name>Demo Carrier</carrier_name>
            <vehicle_number>Demo Vehicle</vehicle_number>
            <trailer_nums>
                <trailer_num>17</trailer_num>
            </trailer_nums>
            <location>Omaha, NE</location>
            <city>Omaha</city>
            <state>NE</state>
            <status>corrected</status>
            <mechanic_signed_at>2016-07-22T14:00:00Z</mechanic_signed_at>
            <mechanic_signature_url>https://keep-truckin-development.s3.amazonaws.com/uploads/inspection_report/mechanic_signature_upload/9/open-uri20160729-30633-thc30n?AWSAccessKeyId=AKIAJHHVMD6UTJMZBMLQ&amp;Expires=1481275519&amp;Signature=dtBQJE%2Fj9891aui%2BN8RNCMZfNCc%3D</mechanic_signature_url>
            <driver_signed_at>2016-07-22T14:00:00Z</driver_signed_at>
            <driver_signature_url>https://keep-truckin-development.s3.amazonaws.com/uploads/inspection_report/driver_signature_upload/9/open-uri20160729-30633-1jeoj77?AWSAccessKeyId=AKIAJHHVMD6UTJMZBMLQ&amp;Expires=1481275519&amp;Signature=cnmAZmkCK9p2EnKKXPilPz4ntWM%3D</driver_signature_url>
            <defects>
                <defect>
                    <id>5</id>
                    <area>tractor</area>
                    <category>Mirrors</category>
                    <notes nil="true"/>
                </defect>
                <defect>
                    <id>6</id>
                    <area>tractor</area>
                    <category>Oil Level</category>
                    <notes nil="true"/>
                </defect>
            </defects>
            <vehicle>
                <id>4</id>
                <number>Demo Vehicle</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458669</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <mechanic>
                <id>12</id>
                <first_name>Joe</first_name>
                <last_name>Williams</last_name>
                <username nil="true"/>
                <email>joe@example.com</email>
                <driver_company_id nil="true"/>
                <status>active</status>
                <role>admin</role>
            </mechanic>
            <driver>
                <id>11</id>
                <first_name>Demo</first_name>
                <last_name>Driver</last_name>
                <username>demo_driver</username>
                <email nil="true"/>
                <driver_company_id nil="true"/>
                <status>active</status>
                <role>driver</role>
            </driver>
        </inspection_report>
      </inspection_reports>
    <per_page>25</per_page>
    <page_no>1</page_no>
    <total>3</total>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>date duration cannot be greater than 1 year</error_message>
</error>
 

IFTA trip reports and summary objects give mileage information of vehicle. Each IFTA trip represents continuous trip in one jurisdiction on a given day. If the vehicle exits a jurisdiction and enters the same jurisdiction on the same day, there would be multiple IFTA trip records for the vehicle in that jurisdiction. And the IFTA summary returns total miles travelled in all IFTA and non-IFTA jurisdictions in given time period. Following is the list of jurisdictions we support.

Abbreviation
Name

AB

Alberta

AK

Alaska

AL

Alabama

AR

Arkansas

AZ

Arizona

BC

British Columbia

CA

California

CO

Colorado

CT

Connecticut

DC

District of Columbia

DE

Delaware

FL

Florida

GA

Georgia

HI

Hawaii

IA

Iowa

ID

Idaho

IL

Illinois

IN

Indiana

KS

Kansas

KY

Kentucky

LA

Louisiana

MA

Massachusetts

MB

Manitoba

MD

Maryland

ME

Maine

MI

Michigan

MN

Minnesota

MO

Missouri

MS

Mississippi

MT

Montana

MX

México

NB

New Brunswick

NC

North Carolina

ND

North Dakota

NE

Nebraska

NH

New Hampshire

NJ

New Jersey

NL

Newfoundland and Labrador

NM

New Mexico

NS

Nova Scotia

NT

Northwest Territories

NU

Nunavut

NV

Nevada

NY

New York

OH

Ohio

OK

Oklahoma

ON

Ontario

OR

Oregon

PA

Pennsylvania

PE

Prince Edward Island

QC

Quebec

RI

Rhode Island

SC

South Carolina

SD

South Dakota

SK

Saskatchewan

TN

Tennessee

TX

Texas

UT

Utah

VA

Virginia

VT

Vermont

WA

Washington

WI

Wisconsin

WV

West Virginia

WY

Wyoming

YT

Yukon Territory

Suggest Edits

/ifta/trips

List company vehicles' IFTA trip reports

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/ifta/trips

Query Params

jurisdictions
array of strings

List of jurisdiction abbreviations.

vehicle_ids
array of integers

List of vehicle IDs.

start_date
date

Start date of IFTA trips.

end_date
date

End date of IFTA trips.

fuel_type
string

Vehicle's fuel type. Valid values include diesel, gasoline, propane, lng, cng, ethanol, methanol, e85, m85, a55, biodiesel, and other.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
string

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/ifta/trips
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/ifta/trips' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/ifta/trips")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/ifta/trips");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/ifta/trips"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "ifta_trips": [
    {
      "ifta_trip": {
        "id": 42,
        "date": "2016-10-05",
        "jurisdiction": "CA",
        "vehicle": {
          "id": 4,
          "number": "Demo Vehicle",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        },
        "start_odometer": 0.6835081,
        "end_odometer": 1.3670162,
        "start_lat": 2.0,
        "start_lon": 3.0,
        "end_lat": 4.0,
        "end_lon": 5.0,
        "distance": 0.6835081,
        "time_zone": "Pacific Time (US & Canada)"
      }
    },
    {
      "ifta_trip": {
        "id": 25,
        "date": "2016-08-01",
        "jurisdiction": "NJ",
        "vehicle": {
          "id": 4,
          "number": "Demo Vehicle",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        },
        "start_odometer": 2613.59205907,
        "end_odometer": 2719.80921781,
        "start_lat": 2.0,
        "start_lon": 3.0,
        "end_lat": 4.0,
        "end_lon": 5.0,
        "distance": 104.676158659999,
        "time_zone": "Pacific Time (US & Canada)"
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 2
  }
}
{
  "error_message": "date duration cannot be greater than 3 months"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <ifta_trips>
        <ifta_trip>
            <id>42</id>
            <date>2016-10-05</date>
            <jurisdiction>CA</jurisdiction>
            <vehicle>
                <id>4</id>
                <number>Demo Vehicle</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458669</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <start_odometer>0.6835081000000001</start_odometer>
            <end_odometer>1.3670162000000001</end_odometer>
            <start_lat>2.0</start_lat>
            <start_lon>3.0</start_lon>
            <end_lat>4.0</end_lat>
            <end_lon>5.0</end_lon>
            <distance>0.6835081000000001</distance>
            <time_zone>Pacific Time (US &amp; Canada)</time_zone>
        </ifta_trip>
        <ifta_trip>
            <id>25</id>
            <date>2016-08-01</date>
            <jurisdiction>NJ</jurisdiction>
            <vehicle>
                <id>4</id>
                <number>Demo Vehicle</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458669</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <start_odometer>2613.5920590700002</start_odometer>
            <end_odometer>2719.8092178099996</end_odometer>
            <start_lat>2.0</start_lat>
            <start_lon>3.0</start_lon>
            <end_lat>4.0</end_lat>
            <end_lon>5.0</end_lon>
            <distance>104.67615865999939</distance>
            <time_zone>Pacific Time (US &amp; Canada)</time_zone>
        </ifta_trip>
    </ifta_trips>
    <pagination>
        <per_page>25</per_page>
        <page_no>1</page_no>
        <total>2</total>
    </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>date duration cannot be greater than 3 months</error_message>
</error>
Suggest Edits

/ifta/summary

List company vehicles' mileage summary

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/ifta/summary

Query Params

jurisdictions
array of strings

List of jurisdictions abbreviations.

vehicle_ids
array of integers

Vehicle IDs.

start_date
date

Start date of IFTA trips.

end_date
date

End date of IFTA trips.

fuel_type
string

Vehicle's fuel type. Valid values include diesel, gasoline, propane, lng, cng, ethanol, methanol, e85, m85, a55, biodiesel, and other.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

X-Metric-Units
boolean

System of units to use to convert different metrics. true for metric units and false for imperial units.

X-User-Id
int32

ID of the Fleet Admin accessing the API.

curl --request GET \
  --url https://api.keeptruckin.com/v1/ifta/summary
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/ifta/summary' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/ifta/summary")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/ifta/summary");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/ifta/summary"

response = requests.request("GET", url)

print(response.text)
A binary file was returned

{  
 "ifta_trips": [
    {
      "ifta_trip": {
        "jurisdiction": "CA",
        "vehicle": {
          "id": 4,
          "number": "Demo Vehicle",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        },
        "distance": 0.6835081,
        "time_zone": "Pacific Time (US & Canada)"
      }
    },
    {
      "ifta_trip": {
        "jurisdiction": "NJ",
        "vehicle": {
          "id": 4,
          "number": "Demo Vehicle",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        },
        "distance": 104.676158659999,
        "time_zone": "Pacific Time (US & Canada)"
      }
    }
  ],
  "pagination": {
    "per_page": 25,
    "page_no": 1,
    "total": 2
  }
}
{
  "error_message": "date duration cannot be greater than 3 months"
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
    <ifta_trips>
        <ifta_trip>
            <jurisdiction>CA</jurisdiction>
            <vehicle>
                <id>4</id>
                <number>Demo Vehicle</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458669</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <distance>0.6835081000000001</distance>
            <time_zone>Pacific Time (US &amp; Canada)</time_zone>
        </ifta_trip>
        <ifta_trip>
            <jurisdiction>NJ</jurisdiction>
            <vehicle>
                <id>4</id>
                <number>Demo Vehicle</number>
                <year>2016</year>
                <make>Demo</make>
                <model>Vehicle</model>
                <vin>WP0AB2966NS458669</vin>
                <metric_units>false</metric_units>
            </vehicle>
            <distance>104.67615865999939</distance>
            <time_zone>Pacific Time (US &amp; Canada)</time_zone>
        </ifta_trip>
    </ifta_trips>
    <pagination>
        <per_page>25</per_page>
        <page_no>1</page_no>
        <total>2</total>
    </pagination>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<error>
    <error_message>date duration cannot be greater than 3 months</error_message>
</error>
 

The fault codes API returns vehicle faults as reported from vehicle ECUs and collected via the KeepTruckin ELD. Fault codes can have a status of either opened or closed and a type of either constant or intermittent.

Suggest Edits

/fault_codes

List company vehicles' fault codes

 

Header Auth

 Authentication is required for this endpoint.
gethttps://api.keeptruckin.com/v1/fault_codes

Query Params

eld_device_ids
array of integers

List of ELD Device IDs to filter the fault codes.

vehicle_ids
array of integers

List of Vehicle IDs to filter the fault codes.

status
string

Filter fault codes on status. Valid values include open and closed.

type
string

Filter fault codes on type. Valid values include constant and intermittent.

start_date
date

Start date of fault codes to return.

end_date
date

End date of fault codes to return.

per_page
int32

Number of records to return per page.

page_no
int32

Current page number.

Headers

X-Time-Zone
string

Time zone used to format timestamps.

curl --request GET \
  --url https://api.keeptruckin.com/v1/fault_codes
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.keeptruckin.com/v1/fault_codes' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
require 'uri'
require 'net/http'

url = URI("https://api.keeptruckin.com/v1/fault_codes")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
var data = JSON.stringify(false);

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("GET", "https://api.keeptruckin.com/v1/fault_codes");

xhr.send(data);
import requests

url = "https://api.keeptruckin.com/v1/fault_codes"

response = requests.request("GET", url)

print(response.text)
A binary file was returned
{
  "fault_codes": [
    {
      "fault_code": {
        "id": 173164,
        "code_label": "SID-85",
        "code_description": "Engine Oil Burn Valve",
        "source_address_label": "Engine #1",
        "status": "open",
        "first_observed_at": "2017-04-17T07:08:51Z",
        "last_observed_at": "2017-04-19T23:41:17Z",
        "type": "intermittent",
        "fmi": 3,
        "eld_device": {
          "id": 4144,
          "identifier": "99999999",
          "model": "lbb-1"
        },
        "vehicle": {
          "id": 4565,
          "number": "301",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        }
      }
    },
    {
      "fault_code": {
        "id": 173165,
        "code_label": "SPN-6926",
        "code_description": "SCR System Cleaning Inhibited Due to Low Exhaust Temperature",
        "source_address_label": "Hitch Control",
        "status": "open",
        "first_observed_at": "2017-04-17T07:08:51Z",
        "last_observed_at": "2017-04-19T23:41:17Z",
        "type": "constant",
        "fmi": 3,
        "eld_device": {
          "id": 4144,
          "identifier": "99999999",
          "model": "lbb-1"
        },
        "vehicle": {
          "id": 4565,
          "number": "301",
          "year": "2016",
          "make": "Demo",
          "model": "Vehicle",
          "vin": "WP0AB2966NS458669",
          "metric_units": false
        }
      }
    }
  ],
  "per_page": 25,
  "page_no": 1,
  "total": 2
}
<?xml version="1.0" encoding="UTF-8"?>
<data>
  <fault_codes>
    <fault_code>
      <id>173164</id>
      <code_label>SID-85</code_label>
      <code_description>Engine Oil Burn Valve</code_description>
      <source_address_label>Engine #1</source_address_label>
      <status>open</status>
      <first_observed_at>2017-04-17T07:08:51Z</first_observed_at>
      <last_observed_at>2017-04-19T23:51:21Z</last_observed_at>
      <type>intermittent</type>
      <fmi>3</fmi>
      <eld_device>
        <id>4144</id>
        <identifier>99999999</identifier>
        <model>lbb-1</model>
      </eld_device>
      <vehicle>
        <id>4565</id>
        <number>301</number>
        <year>2016</year>
        <make>Demo</make>
        <model>Vehicle</model>
        <vin>WP0AB2966NS458669</vin>
        <metric_units>false</metric_units>
      </vehicle>
    </fault_code>
    <fault_code>
      <id>173165</id>
      <code_label>SPN-6926</code_label>
      <code_description>SCR System Cleaning Inhibited Due to Low Exhaust Temperature</code_description>
      <source_address_label>Hitch Control</source_address_label>
      <status>open</status>
      <first_observed_at>2017-04-17T07:08:51Z</first_observed_at>
      <last_observed_at>2017-04-19T23:51:21Z</last_observed_at>
      <type>constant</type>
      <fmi>3</fmi>
      <eld_device>
        <id>4144</id>
        <identifier>99999999</identifier>
        <model>lbb-1</model>
      </eld_device>
      <vehicle>
        <id>4565</id>
        <number>301</number>
        <year>2016</year>
        <make>Demo</make>
        <model>Vehicle</model>
        <vin>WP0AB2966NS458669</vin>
        <metric_units>false</metric_units>
      </vehicle>
    </fault_code>
  </fault_codes>
  <per_page>25</per_page>
  <page_no>1</page_no>
  <total>2</total>
</data>
 

Webhooks allow you to be notified whenever certain actions occur within your fleet via an HTTP POST request to an endpoint of your choosing. If you have enabled webhooks for your fleet, KeepTruckin will make an HTTP POST request to your endpoint whenever the events you have setup occur.

One common use-case is vehicle location updates. If you want to be notified whenever a vehicle’s current location updates you could subscribe to the vehicle_location_updated action and you will receive a request whenever any vehicle’s location changes.

Webhook requests contain a JSON payload consisting of the action as well as any attributes relevant to the action. The list of currently support actions and their payloads are listed below.

Verifying Authenticity

Each webhook has a shared secret that KeepTruckin will use to sign the requests. The computed signature is included in the X-KT-Webhook-Signature HTTP header and can be used to verify that the request originated at KeepTruckin servers and has not been modified in-flight. You can respond with 403 if the signature does not match your computed expected value.

To compute the webhook signature, take the HMAC-SHA1 hex digest of the JSON payload using the shared secret.

{"action":"test"}
"8cbd43f98ba1e33c28c9"

This would have an X-KT-Webhook-Signature HTTP header value of "5e1a966298ba4f3e91847aea8746198ca0530dd2".

echo -n '{"action":"test"}' | openssl dgst -sha1 -hmac "8cbd43f98ba1e33c28c9"
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), '8cbd43f98ba1e33c28c9', '{"action":"test"}')

Expected Responses

KeepTruckin servers expect specific responses from your server to indicate the successful receipt of a webhook. Make sure that your endpoint handler responds with the appropriate response code. Additionally, your server must accept the connection within 5 seconds and respond within 10 seconds or the request will be assumed to have failed. It is up to the endpoint handler to ensure that requests are only processed once.

  • 200 or 201 - Indicates the webhook was processed successfully. KeepTruckin will consider the request final and will not retry.
  • 403 - Indicates the HMAC signature could not be verified. KeepTruckin will consider the request invalid and will not retry.
  • 4XX or 5XX - Indicates the webhook was not processed and should be retried. KeepTruckin will retry the request based on the schedule below.

Retry Schedule

KeepTruckin will make several attempts to retry failed requests using the following delays between attempts.

  • 10 seconds
  • 1 minute
  • 5 minutes
  • 10 minutes
  • 1 hour
  • 1 hour
  • 1 hour
  • 1 day

Enabling Webhooks (Test Requests)

Whenever you enable a webhook, change the URL, or change the shared secret, KeepTruckin will perform a test request to verify a successful response is received. The webhook will only be enabled if a response code of 200 or 201 is received. The test request payload is always the same:

{"action":"test"}

Supported Actions

Vehicle Current Location Updated (vehicle_location_updated)
Triggered whenever a vehicle location is received that is more recent than the current location.

{
  "action": "vehicle_location_updated",
  "id": "5d3d5cf6-501f-4566-ad07-a80c05c743a7",    // unique identifier for the location object
  "vehicle_id": 123,                               // the vehicle id (foreign key)
  "located_at": "2017-01-01T12:00:00Z",            // time when the location was recorded (ISO8601 format)
  "lat": 34.123,                                   // latitude
  "lon": -84.123,                                  // longitude
  "bearing": 90.0,                                 // the direction of travel (0-360 degrees)
  "engine_hours": 123.56,                          // engine hours reported by the vehicle's ECU
  "speed": 123.5,                                  // speed reported by the vehicle's ECU
  "odometer": 2343232.23,                          // odometer reading reported by the vehicle's ECU
  "fuel": 23423.23,                                // amount of fuel used reported by the vehicle's ECU
  "type": "vehicle_moving",                        // indicates whether the location was captured when the vehicle started moving, stopped moving, the engine started or stopped, or while already in motion
  "description": "3.2 mi SE of San Francisco, CA"  // description of the location
}

Vehicle Location Received (vehicle_location_received)
Triggered for all vehicle locations received regardless of whether they are the most recent or not.

{
  "action": "vehicle_location_received",
  "id": "5d3d5cf6-501f-4566-ad07-a80c05c743a7",    // unique identifier for the location object
  "vehicle_id": 123,                               // the vehicle id (foreign key)
  "located_at": "2017-01-01T12:00:00Z",            // time when the location was recorded (ISO8601 format)
  "lat": 34.123,                                   // latitude
  "lon": -84.123,                                  // longitude
  "bearing": 90.0,                                 // the direction of travel (0-360 degrees)
  "engine_hours": 123.56,                          // engine hours reported by the vehicle's ECU
  "speed": 123.5,                                  // speed reported by the vehicle's ECU
  "odometer": 2343232.23,                          // odometer reading reported by the vehicle's ECU
  "fuel": 23423.23,                                // amount of fuel used reported by the vehicle's ECU
  "type": "vehicle_moving",                        // indicates whether the location was captured when the vehicle started moving, stopped moving, the engine started or stopped, or while already in motion
  "description": "3.2 mi SE of San Francisco, CA"  // description of the location
}

Vehicle Created or Updated (vehicle_upserted)
Triggered whenever a vehicle is created or updated.

{
  "action": "vehicle_upserted",
  "id": 123,
  "company_id": 456,
  "number": "T123",
  "status": "active",
  "ifta": true,
  "vin": "ABC12345678909876",
  "make": "Kenworth",
  "model": "379",
  "year": "2008",
  "license_plate_state": "CA",
  "license_plate_number": "7ABD123",
  "metric_units": false,
  "fuel_type": "diesel",
  "prevent_auto_odometer_entry": false,
  "eld_device_id": 1,
  "eld_device": {
    "id": 1,
    "identifier": "00000001",
    "model": "lbb-2"
  },
  "current_driver": {
    "id": 1,
    "first_name": "Bob",
    "last_name": "Smith",
    "driver_company_id", "1223"
  }
}

Fault Code Opened (fault_code_opened)
Triggered whenever a new fault code is opened on a vehicle.

{
  "action": "fault_code_opened",
  "id": 123,
  "code_description": "Cargo Securement",
  "status": "open",
  "first_observed_at": "2017-01-01T12:45:33Z",
  "last_observed_at": "2017-01-05T12:45:33Z",
  "type": "constant",
  "fmi": 5,
  "code_label": "SPN-5610",
  "source_address_label": "Fuel System",
  "vehicle": {
    "id": 1,
    "number": "T123",
    "make": "Kenworth",
    "model": "379",
    "year": "2008",
    "vin": "ABC12345678909876"
  },
  "eld_device": {
    "id": 1,
    "identifier": "00000001",
    "model": "lbb-2"
  }
}

Fault Code Closed (fault_code_closed)
Triggered whenever an existing fault code is closed on a vehicle.

{
  "action": "fault_code_closed",
  "id": 123,
  "code_description": "Cargo Securement",
  "status": "closed",
  "first_observed_at": "2017-01-01T12:45:33Z",
  "last_observed_at": "2017-01-05T12:45:33Z",
  "type": "constant",
  "fmi": 5,
  "code_label": "SPN-5610",
  "source_address_label": "Fuel System",
  "vehicle": {
    "id": 1,
    "number": "T123",
    "make": "Kenworth",
    "model": "379",
    "year": "2008",
    "vin": "ABC12345678909876"
  },
  "eld_device": {
    "id": 1,
    "identifier": "00000001",
    "model": "lbb-2"
  }
}

User Created or Updated (user_upserted)
Triggered whenever a user is created or updated in your fleet.

{
  "action": "user_upserted",
  "id": 123,
  "role": "driver",
  "status": "active",
  "email": "test.driver@example.com",
  "username": "",
  "first_name": "Test",
  "last_name": "Driver",
  "driver_company_id": "ABC123",
  "phone": "(650) 555-5555",
  "phone_ext": null,
  "carrier_name": "My Fleet",
  "carrier_street": "123 Main St",