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    

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. By using KeepTruckin's API you agree to our API terms of service located at https://keeptruckin.com/api-tos

 

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.

 

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>

 

Authentication (OAuth 2.0)

Allows third-party developers to authorize using OAuth 2.0

 

We use the industry-standard protocol for authorization. OAuth 2.0 provides access to our public APIs with the help of exchange of an authorization token for an access token. For detailed specification, check out the OAuth 2.0 Authorization Framework.

Here is a quick summary of the Authorization Code Flow:

After a successful setup of a developer account with KeepTruckin’s support staff, a developer can log in to the KeepTruckin’s developer portal. The developer needs to register an application on this portal. After registering your app, you will receive a client ID and a client secret. Client ID is considered public information and is used to build the login URLs. The client secret must be kept confidential.

To complete the authorization flow, you need to display a button that starts the connection process /oauth/authorize and a redirect page that would redirect the user back after connecting the application. Full URL could be like this:

https://keeptruckin.com/oauth/authorize?client_id=<uid of application>&redirect_uri=<redirect_uri of application>&response_type=code&scope=<all scopes mentioned in application definition>
Argument
Value
Description
Required

client_id

uid of application

The client ID you received when you first created the application

Yes

redirect_uri

Redirect URI of the application

Indicates the URI to return the user to after authorization is complete.

Yes

response_type

code

Indicates that your server expects to receive an authorization code.

Yes

scope

Scopes mentioned in the application definition:

companies.read
users.read
users.manage
vehicles.read
vehicles.manage
messages.read
messages.manage
fuel_purchases.read
fuel_purchases.manage
groups.read
groups.manage
eld_devices.read
inspection_reports.read
fault_codes.read
driver_performance_events.read
hos_logs.available_time
hos_logs.hours_of_service
hos_logs.hos_violation
hos_logs.logs
locations.vehicle_locations_list
locations.vehicle_locations_single
locations.driver_locations
ifta_reports.trips
ifta_reports.summary
utilization.driver_utilization
utilization.vehicle_utilization
utilization.idle_events
documents.read
dispatches.read
dispatches.manage
dispatch_locations.read
dispatch_locations.manage
forms.read
form_entries.read

One or more scope values indicating which parts of the user's account you wish to access.

Yes

After clicking the button, users are taken to a page like the one below to review the requested permissions and link to their account:

Request to authorize the application to link to KeepTruckin

Request to authorize the application to link to KeepTruckin

When the user clicks on Allow, the page will be redirected to the developer's provided redirect URI. The server exchanges the auth code for an access token by hitting /token endpoint.
Note: The auth code time to live is 10 min. If the auth code is not exchanged for an access token, the auth code will expire, and the customer would need to reauthorize the app to generate a new auth code.

curl -X POST 'https://keeptruckin.com/oauth/token' -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=authorization_code&code=<code returned after resource owner authorization>&redirect_uri=<redirect url specified in developer app>&client_id=<uid of application>&client_secret=<secret of applicatio>'
require 'uri'
require 'net/http'
require 'json'

url = URI('https://keeptruckin.com/oauth/token')

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

request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/x-www-form-urlencoded'
params = {
    :grant_type    => 'authorization_code',
    :code          => '<code returned after resource owner authorization>',
    :redirect_uri  => '<redirect url specified in developer app>',
    :client_id     => '<uid of application>',
    :client_secret => '<secret of applicatio>',
}
request.body = params.to_json

response = http.request(request)
puts response.read_body

The server replies back with an access token and expiration time.

{
 "access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
 "token_type": "Bearer", 
 "expires_in": 7200,
 "refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}

Once an access token is expired, the developer can simply get a new access token using the refresh token that is returned in initial response like following.

curl -X POST 'https://keeptruckin.com/oauth/token' -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=refresh_token&refresh_token=<refresh token returned with access token>&redirect_uri=<redirect url specified in developer app>&client_id=<uuid of application>&client_secret=<secret of applicatio>'
require 'uri'
require 'net/http'
require 'json'

url = URI('https://keeptruckin.com/oauth/token')

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

request = Net::HTTP::Post.new(url)
request['Content-Type'] = 'application/x-www-form-urlencoded'
params = {
    :grant_type    => 'refresh_token',
    :refresh_token => '<refresh_token returned with access_token>',
    :redirect_uri  => '<redirect url specified in developer app>',
    :client_id     => '<uid of application>',
    :client_secret => '<secret of applicatio>',
}
request.body = params.to_json

response = http.request(request)
puts response.read_body

Once the OAuth access token is obtained, you can start making requests to the API. A bearer token is required to make requests.

Header Name
Value

Authorization

Bearer <OAuth Access Token>

Sample API call to /v1/users endpoint.

curl --request GET 'https://api.keeptruckin.com/v1/users' -H 'Authorization: Bearer <OAUTH_TOKEN>'
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)
request['Authorization'] = 'Bearer <OAUTH_TOKEN>'

response = http.request(request)
puts response.read_body
var request = require("request");

var options = { method: 'GET', url: 'https://api.keeptruckin.com/v1/users', headers: {'Authorization': 'Bearer <OAUTH_TOKEN>'} };

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

  console.log(body);
});
 

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'
 

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 User

 

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.

 

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).

 

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.

 

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'
 

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
  }
}
 

Changelog

 

All notable changes to the APIs are documented as follows.

11-Nov-2019

Added

  • updated_after query parameter to /inspection_reports
  • dispatch_ids query parameter to /form_entries
  • driver_ids query parameter to /form_entries
  • vehicle_ids query parameter to /form_entries
  • Documentation for Goefence Public API endpoints
 

KeepTruckin's OAuth Scopes

 

Following is a list of all the OAuth scopes currently supported by our API.

All GET endpoints require only read access of the respective scope. However for any endpoint other than get, write access is required.

Scope
Access Type
Endpoints Allowed

Drivers and Fleet Managers

  • Read
  • Write

GET /:version/users
GET /:version/users/:id
PUT /:version/users/:id
POST /:version/users

Vehicles

  • Read
  • Write

GET /:version/vehicles
GET /:version/vehicles/:id
POST /:version/vehicles
PUT /:version/vehicles/:id

Messages

  • Read
  • Write

GET /:version/messages
POST /:version/messages
PUT /:version/messages

Fuel Purchases

  • Read
  • Write

GET /:version/fuel_purchases
GET /:version/fuel_purchases/:id
POST /:version/fuel_purchases
PUT /:version/fuel_purchases/:id
DELETE /:version/fuel_purchases/:id

Groups

  • Read
  • Write

GET /:version/groups
POST /:version/groups
GET /:version/groups/:id
DELETE /:version/groups/:id
PUT /:version/groups/:id
GET /:version/groups/:id/users
GET /:version/groups/:id/drivers
GET /:version/groups/:id/fleet_managers
GET /:version/groups/:id/vehicles
POST /:version/groups/:id/users
POST /:version/groups/:id/vehicles
DELETE /:version/groups/:id/users
DELETE /:version/groups/:id/vehicles

ELDs

  • Read

GET /:version/eld_devices

Inspection Reports

  • Read

GET /:version/inspection_reports

Fault Codes

  • Read

GET /:version/fault_codes

Scorecards

  • Read

GET /:version/driver_performance_events

Drivers with Available Time

  • Read

GET /:version/available_time

Drivers with Hours of Service

  • Read

GET /:version/hours_of_service

HOS Violations

  • Read

GET /:version/hos_violations

HOS Logs

  • Read

GET /:version/logs

Vehicles with Current Location and Current Driver

  • Read

GET /:version/vehicle_locations

Vehicle Location History

  • Read

GET /:version/vehicle_locations/:vehicle_id

Drivers with Current Location and Current Vehicle

  • Read

GET /:version/driver_locations

IFTA Trip Reports

  • Read

GET /:version/ifta/trips

Vehicles' Mileage Summary

  • Read

GET /:version/ifta/summary

Utilization Summary by Driver

  • Read

GET /:version/driver_utilization

Utilization Summary by Vehicle

  • Read

GET /:version/vehicle_utilization

Utilization Records

  • Read

GET /:version/idle_events

Documents

  • Read

GET /:version/documents
GET /:version/documents/:id

Company Details

  • Read

GET /:version/companies

Dispatch Forms

  • Read

GET /:version/forms

Dispatch Form Entries

  • Read

GET /:version/form_entries

Dispatch Locations

  • Read
  • Write

GET /:version/dispatch_locations
POST /:version/dispatch_locations
PUT /:version/dispatch_locations
DELETE /:version/dispatch_locations

Dispatches

  • Read
  • Write

GET /:version/dispatches
POST /:version/dispatches
PUT /:version/dispatches

Geofences

  • Read
  • Write

GET /:version/geofences
POST /:version/geofences
GET /:version/geofences/:id
PUT /:version/geofences/:id
DELETE /:version/geofences/:id

Geofence Events

  • Read

GET /:version/geofences/events

 

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.

 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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.

manual_driving_enabled
boolean

Set true when driver is allowed to manually add driving time

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

You couldn't be authenticated

{
  "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,
    "manual_driving_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>
  <manual_driving_enabled>false</manual_driving_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>
 

/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.

manual_driving_enabled
boolean

Set true when driver is allowed to manually add driving time

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

You couldn't be authenticated

{
  "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,
    "manual_driving_enabled": false,
    "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>294979</id>
	  <email/>
    <first_name>John</first_name>
    <last_name>Connor</last_name>
    <phone></phone>
    <phone_ext />
    <time_zone>Pacific Time (US &amp; Canada)</time_zone>
    <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>
    <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>demo_driver_1_kt3647454</username>
    <cycle>70_8</cycle>
    <driver_company_id />
    <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>
    <manual_driving_enabled>false</manual_driving_enabled>
    <role>driver</role>
    <status>active</status>
    <created_at>2016-08-09T00:43:40Z</created_at>
    <updated_at>2017-03-30T01:06:13.169610Z</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>
 

/users (OAuth 2.0)

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 used 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.

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)
request['Authorization'] = 'Bearer <OAUTH_TOKEN>'

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/users/:id (OAuth 2.0)

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.

 
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)
request['Authorization'] = 'Bearer <OAUTH_TOKEN>'

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/users (OAuth 2.0)

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.

manual_driving_enabled
boolean

Set true when driver is allowed to manually add driving time

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.

 
require 'uri'
require 'net/http'
require 'json'

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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
    :email                        => nil,
    :first_name                   => "John",
    :last_name                    => "Doe",
    :phone                        => nil,
    :phone_ext                    => nil,
    :time_zone                    => nil,
    :carrier_name                 => nil,
    :carrier_street               => nil,
    :carrier_city                 => nil,
    :carrier_state                => nil,
    :carrier_zip                  => nil,
    :violation_alerts             => "1_hour",
    :terminal_street              => nil,
    :terminal_city                => nil,
    :terminal_state               => nil,
    :terminal_zip                 => nil,
    :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",
    :password                     => "password",
    :cycle                        => nil,
    :driver_company_id            => nil,
    :minute_logs                  => false,
    :duty_status                  => "off_duty",
    :eld_mode                     => "none",
    :drivers_license_number       => nil,
    :drivers_license_state        => nil,
    :yard_moves_enabled           => false,
    :personal_conveyance_enabled  => false,
    :manual_driving_enabled       => false,
    :role                         => "driver",
    :status                       => "active",
}
request.body = params.to_json

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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,
    "manual_driving_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>
  <manual_driving_enabled>false</manual_driving_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>
 

/users/:id (OAuth 2.0)

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.

manual_driving_enabled
boolean

Set true when driver is allowed to manually add driving time

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.

 
require 'uri'
require 'net/http'
require 'json'

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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
    :email                        => nil,
    :first_name                   => "John1",
    :last_name                    => "Doe1",
    :phone                        => nil,
    :phone_ext                    => nil,
    :time_zone                    => nil,
    :carrier_name                 => nil,
    :carrier_street               => nil,
    :carrier_city                 => nil,
    :carrier_state                => nil,
    :carrier_zip                  => nil,
    :violation_alerts             => "1_hour",
    :terminal_street              => nil,
    :terminal_city                => nil,
    :terminal_state               => nil,
    :terminal_zip                 => nil,
    :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",
    :password                     => "password",
    :cycle                        => nil,
    :driver_company_id            => nil,
    :minute_logs                  => false,
    :duty_status                  => "off_duty",
    :eld_mode                     => "none",
    :drivers_license_number       => nil,
    :drivers_license_state        => nil,
    :yard_moves_enabled           => false,
    :personal_conveyance_enabled  => false,
    :manual_driving_enabled       => false,
    :role                         => "driver",
}

request.body = params.to_json

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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,
    "manual_driving_enabled": false,
    "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>294979</id>
	  <email/>
    <first_name>John</first_name>
    <last_name>Connor</last_name>
    <phone></phone>
    <phone_ext />
    <time_zone>Pacific Time (US &amp; Canada)</time_zone>
    <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>
    <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>demo_driver_1_kt3647454</username>
    <cycle>70_8</cycle>
    <driver_company_id />
    <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>
    <manual_driving_enabled>false</manual_driving_enabled>
    <role>driver</role>
    <status>active</status>
    <created_at>2016-08-09T00:43:40Z</created_at>
    <updated_at>2017-03-30T01:06:13.169610Z</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>
 

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. Though 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.

 

/vehicles

List company vehicles

 

Header Auth

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

Query Params

driver_ids
array of integers

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.

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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/vehicles (OAuth 2.0)

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.

 
require 'uri'
require 'net/http'
require 'json'

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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
    :company_id          => 1,
    :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             => nil,
      :driver_company_id => nil,
      :status            => "active",
      :role              => "driver"
    }
  }
request.body = params.to_json

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/vehicles/:id (OAuth 2.0)

Update an existing vehicle

 

Header Auth

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

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.

 
require 'uri'
require 'net/http'
require 'json'

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

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

request = Net::HTTP::Put.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'

params = {
    :company_id          => 1,
    :number              => "Demo Vehicle",
    :status              => "active",
    :ifta                => true,
    :vin                 => "WP0AB2966NS458669",
    :make                => "Demo",
    :model               => "Vehicle",
    :year                => "2017",
    :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             => nil,
      :driver_company_id => nil,
      :status            => "active",
      :role              => "driver"
    }
  }
request.body = params.to_json

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/vehicles/:id (OAuth 2.0)

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.

 
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

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.

 

/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

You couldn't be authenticated

{
  "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>
 

/eld_devices (OAuth 2.0)

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.

 
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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

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.

 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/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

You couldn't be authenticated

{
  "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>
 

/groups (OAuth 2.0)

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.

 
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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/groups/:id (OAuth 2.0)

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.

 
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Get.new(url)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/groups (OAuth 2.0)

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.

 
require 'uri'
require 'net/http'
require 'json'

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)
request['Authorization'] = "Bearer <OAUTH_TOKEN>"
request['Content-Type'] = 'application/json'
params = {
  :name                => "East Coast",
}
request.body = params.to_json

response = http.request(request)
puts response.read_body
A binary file was returned

You couldn't be authenticated

{
  "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>
 

/groups/:id (OAuth 2.0)

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