Samsara provides API endpoints so that you can build powerful applications and custom solutions with sensor data. Samsara has endpoints available to track and analyze sensors, vehicles, and entire fleets.
The Samsara API is a RESTful API. It uses standard HTTP authentication, verbs, and response codes, and it returns JSON response bodies. If you're familiar with what you can build with a REST API, then this will be your go-to API reference.
If you have any questions, please visit https://samsara.com/help.
All our APIs can be accessed through HTTP requests to URLs like:
https://api.samsara.com/v1/<endpoint>
To authenticate your API request you will need to include your secret token. You can manage your API tokens in the Dashboard. They are visible under Settings->Organization->API Tokens
.
Your API tokens carry many privileges, so be sure to keep them secure. Do not share your secret API tokens in publicly accessible areas such as GitHub, client-side code, and so on.
Authentication to the API is performed via Bearer Token in the HTTP Authorization header. Provide your API token as the access_token
value in an Authorization: Bearer
header. You do not need to provide a password:
Authorization: Bearer {access_token}
All API requests must be made over HTTPS. Calls made over plain HTTP or without authentication will fail.
API tokens now have granular scopes. For more on granular scopes and which scopes are required for our legacy APIs, read here.
You can find more info about request methods, response codes, error codes, and versioning here.
Fetch all addresses/geofences for the organization. An address contains either a circle or polygon geofence describing the address boundaries.
[- {
- "contacts": [
- {
- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "id": 123,
- "lastName": "Jones",
- "phone": "111-222-3344"
}
], - "createdAtTime": "2019-05-18T20:27:35Z",
- "formattedAddress": "350 Rhode Island St, San Francisco, CA",
- "geofence": {
- "circle": {
- "latitude": 37.765363,
- "longitude": -122.403098,
- "radiusMeters": 250
}, - "polygon": {
- "vertices": [
- {
- "latitude": 37.765363,
- "longitude": -122.403098
}
]
}
}, - "id": 123,
- "name": "Samsara HQ",
- "notes": "Delivery site 1",
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
]
}
]
Add one or more addresses to the organization
List of addresses/geofences to add. An address must always be provided, and a geofence of either circular or a polygonal type must also always be provided. For circular geofences, lat/long are optional and will be automatically populated through geocoding asynchronously if not provided, but radiusMeters is required. For polygonal geofences, lat/long coordinates are required. For each address, only one of 'circle' or 'polygon' should be provided. If both are provided, the geofence will be saved as a polygon.
required | Array of objects |
{- "addresses": [
- {
- "contactIds": [
- 123
], - "formattedAddress": "350 Rhode Island St, San Francisco, CA",
- "geofence": {
- "circle": {
- "latitude": 37.765363,
- "longitude": -122.403098,
- "radiusMeters": 250
}, - "polygon": {
- "vertices": [
- {
- "latitude": 37.765363,
- "longitude": -122.403098
}
]
}
}, - "name": "Samsara HQ",
- "notes": "Delivery site 1",
- "tagIds": [
- 123
]
}
]
}
[- {
- "contacts": [
- {
- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "id": 123,
- "lastName": "Jones",
- "phone": "111-222-3344"
}
], - "createdAtTime": "2019-05-18T20:27:35Z",
- "formattedAddress": "350 Rhode Island St, San Francisco, CA",
- "geofence": {
- "circle": {
- "latitude": 37.765363,
- "longitude": -122.403098,
- "radiusMeters": 250
}, - "polygon": {
- "vertices": [
- {
- "latitude": 37.765363,
- "longitude": -122.403098
}
]
}
}, - "id": 123,
- "name": "Samsara HQ",
- "notes": "Delivery site 1",
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
]
}
]
Fetch an address by its id.
addressId required | integer <int64> ID of the address/geofence |
{- "contacts": [
- {
- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "id": 123,
- "lastName": "Jones",
- "phone": "111-222-3344"
}
], - "createdAtTime": "2019-05-18T20:27:35Z",
- "formattedAddress": "350 Rhode Island St, San Francisco, CA",
- "geofence": {
- "circle": {
- "latitude": 37.765363,
- "longitude": -122.403098,
- "radiusMeters": 250
}, - "polygon": {
- "vertices": [
- {
- "latitude": 37.765363,
- "longitude": -122.403098
}
]
}
}, - "id": 123,
- "name": "Samsara HQ",
- "notes": "Delivery site 1",
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
]
}
Update the name, formatted address, geofence, notes, or tag and contact Ids for an address. The set of tags or contacts associated with this address will be updated to exactly match the list of IDs passed in. To remove all tags or contacts from an address, pass an empty list; to remove notes, pass an empty string.
addressId required | integer <int64> ID of the address/geofence |
Update parts of an address's value. If the geofence 'circle' or 'polygon' key is specified, the update will change the type of geofence accordingly.
contactIds | Array of numbers <int64> (ContactIds) [ items <int64 > ] A list of IDs for contact book entries. |
formattedAddress | string The full address associated with this address/geofence, as it might be recognized by maps.google.com |
object (AddressGeofence) The geofence that defines this address and its bounds. This can either be a circle, or a polygon - only one key should be provided, depending on the geofence type. | |
name | string The name of this address/geofence |
notes | string (AddressNotes) Notes associated with an address. |
tagIds | Array of numbers <int64> (TagIds) [ items <int64 > ] A list of tag IDs. |
{- "contactIds": [
- 123
], - "formattedAddress": "350 Rhode Island St, San Francisco, CA",
- "geofence": {
- "circle": {
- "latitude": 37.765363,
- "longitude": -122.403098,
- "radiusMeters": 250
}, - "polygon": {
- "vertices": [
- {
- "latitude": 37.765363,
- "longitude": -122.403098
}
]
}
}, - "name": "Samsara HQ",
- "notes": "Delivery site 1",
- "tagIds": [
- 123
]
}
"string"
This method adds an address book entry.
address required | string The address of the entry to add, as it would be recognized if provided to maps.google.com. |
name required | string Name of the location to add to the address book. |
radius required | integer Radius in meters of the address (used for matching vehicle trip stops to this location). |
{- "address": "501 York St",
- "name": "HQ",
- "radius": 10
}
"string"
Fetch current locations of all assets.
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
tagIds | Array of strings A comma-separated list of tag IDs. Example: |
{- "assets": [
- {
- "assetSerialNumber": "8dka2810",
- "cable": {
- "assetType": "Thermo King"
}, - "engineHours": 104,
- "id": 1,
- "location": [
- {
- "latitude": 37,
- "location": "525 York, San Francisco, CA",
- "longitude": -122.7,
- "speedMilesPerHour": 35,
- "timeMs": 12314151
}
], - "name": "Trailer 123"
}
], - "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}
}
Fetches all reefers and reefer-specific stats.
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. |
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
{- "data": [
- {
- "assetType": "Thermo King",
- "id": 1,
- "name": "Reefer 123",
- "reeferStats": {
- "ambientAirTemperature": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "dischargeAirTemperature": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "engineHours": [
- {
- "changedAtMs": 1453449599999,
- "engineHours": 1200
}
], - "fuelPercentage": [
- {
- "changedAtMs": 1453449599999,
- "fuelPercentage": 99
}
], - "powerStatus": [
- {
- "changedAtMs": 1453449599999,
- "status": "Active (Continuous)"
}
], - "reeferAlarms": [
- {
- "alarms": [
- {
- "alarmCode": 102,
- "description": "Check Return Air Sensor",
- "operatorAction": "Check and repair at end of trip",
- "severity": 1
}
], - "changedAtMs": 1453449599999
}
], - "returnAirTemperature": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "setPoint": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
]
}
}
], - "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}
}
Fetch the historical locations for the asset.
asset_id required | integer <int64> ID of the asset. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. |
[- {
- "latitude": 37,
- "location": "525 York, San Francisco, CA",
- "longitude": -122.7,
- "speedMilesPerHour": 35,
- "time": 12314151
}
]
Fetch the reefer-specific stats of an asset.
asset_id required | integer <int64> ID of the asset. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. |
{- "assetType": "Thermo King",
- "id": 1,
- "name": "Reefer 123",
- "reeferStats": {
- "alarms": [
- {
- "alarms": [
- {
- "alarmCode": 102,
- "description": "Check Return Air Sensor",
- "operatorAction": "Check and repair at end of trip",
- "severity": 1
}
], - "changedAtMs": 1453449599999
}
], - "engineHours": [
- {
- "changedAtMs": 1453449599999,
- "engineHours": 1200
}
], - "fuelPercentage": [
- {
- "changedAtMs": 1453449599999,
- "fuelPercentage": 99
}
], - "powerStatus": [
- {
- "changedAtMs": 1453449599999,
- "status": "Active (Continuous)"
}
], - "returnAirTemp": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "setPoint": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
]
}
}
List all routes scheduled within a given time period. Routes are returned if both of the following conditions are met:
scheduled_start_ms
is before the timestamp: end_time
(defaults to now)scheduled_end_ms
is after the timestamp: end_time - duration
(defaults to now - 24 hours)Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
end_time | integer <int64> Time in unix milliseconds that represents the end time of the requested time interval. See above for a description of how routes are returned. Defaults to now. |
duration | integer <int64> Time in milliseconds that represents the duration before end_time to query. Defaults to 24 hours. |
[- {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
]
Create a new dispatch route.
required | Array of objects (DispatchJobCreate) The dispatch jobs to create for this route. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Fetch all updates to a job including route data in the last 24 hours or subsequent to an sequence ID. Returns a maximum of 500 job updates. If more than 500 job updates are available, another request made with the prior request's sequence_id will return the next set of available job updates.
sequence_id | string Sequence ID from the response payload of the last request. Defaults to fetching updates from last 24 hours. |
include | string Optionally set include=route to include route object in response payload. |
{- "job_updates": [
- {
- "changed_at_ms": 1462881998034,
- "job_id": 773,
- "job_state": "JobState_Arrived",
- "prev_job_state": "JobState_EnRoute",
- "route": {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}, - "route_id": 556
}
], - "sequence_id": "eyJpZCI6MywiY3JlYXRlZF9hdCI6MTQ5OTQyOTIyMDAwMn0="
}
Fetch a dispatch route by id.
route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Update the dispatch route. Examples of this include:
dispatch_jobs
array. If you add a job to this array, you do not need to include an id
field. One will be created automatically for that new job.route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
required | Array of objects (DispatchJobUpdate) The dispatch jobs for the route. |
id required | integer <int64> ID of route. This must match the route ID passed in URL. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "id": 42,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": "42",
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Delete a dispatch route and its associated jobs.
route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
apply_to_future_routes | boolean This is only for a recurring route. If set to true, delete all following runs of the route. If set to false, only delete the current route. |
{- "apply_to_future_routes": true
}
"string"
Fetch the history of a dispatch route.
route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
start_time | integer <int64> Timestamp representing the start of the period to fetch, inclusive. Used in combination with end_time. Defaults to 0. |
end_time | integer <int64> Timestamp representing the end of the period to fetch, inclusive. Used in combination with start_time. Defaults to nowMs. |
{- "history": [
- {
- "changed_at_ms": 1499411220000,
- "route": {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
}
]
}
Get all active drivers. When drivers leave an organization, you can deactivate them. Use DELETE /v1/fleet/drivers/{id} to deactivate drivers and GET /v1/fleet/drivers/inactive to get inactive drivers. Inactive driver records will still be part of reports such as Hours of Service.
{- "drivers": [
- {
- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
]
}
Create a new driver.
Driver creation body
password required | string Driver's password for the driver app. |
tagIds | Array of numbers <int64> (TagIds) [ items <int64 > ] A list of tag IDs. |
eldAdverseWeatherExemptionEnabled | boolean Flag indicating this driver may use Adverse Weather exemptions in ELD logs. |
eldBigDayExemptionEnabled | boolean Flag indicating this driver may use Big Day excemptions in ELD logs. |
eldDayStartHour | integer 0 indicating midnight-to-midnight ELD driving hours, 12 to indicate noon-to-noon driving hours. |
eldExempt | boolean Flag indicating this driver is exempt from the Electronic Logging Mandate. |
eldExemptReason | string Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt). |
eldPcEnabled | boolean Default: false Flag indicating this driver may select the Personal Conveyance duty status in ELD logs. |
eldYmEnabled | boolean Default: false Flag indicating this driver may select the Yard Move duty status in ELD logs. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
groupId | integer <int64> Deprecated. |
licenseNumber | string Driver's state issued license number. |
licenseState | string Abbreviation of state that issued driver's license. |
name required | string Driver's name. |
notes | string Notes about the driver. |
phone | string Driver's phone number. Please include only digits, ex. 4157771234 |
timezone | string Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use IANA timezone database keys (e.g. |
username | string Driver's login username into the driver app. The username may not contain spaces or |
vehicleGroupTagId | integer <int64> ID of the tag which determines which vehicles a driver will see when selecting vehicles |
vehicleId | integer <int64> ID of the vehicle assigned to the driver for static vehicle assignments. (uncommon). |
{- "password": "mypassword",
- "tagIds": [
- 123
], - "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
{- "conditionalFieldSections": [
- {
- "conditionalFieldFirstIndex": 1,
- "conditionalFieldLastIndex": 1,
- "triggeringFieldIndex": 0,
- "triggeringFieldValue": "Yes"
}
], - "fieldTypes": [
- {
- "label": "Was there damage?",
- "multipleChoiceValueTypeMetadata": {
- "multipleChoiceOptionLabels": [
- {
- "label": "Yes"
}, - {
- "label": "No"
}
]
}, - "valueType": "ValueType_MultipleChoice"
}, - {
- "label": "Damage Photos",
- "valueType": "ValueType_Photo"
}, - {
- "label": "Date",
- "valueType": "ValueType_DateTime"
}
], - "name": "Damage Report",
- "orgId": 123,
- "uuid": "4aff772c-a7bb-45e6-8e41-6a53e34feb83"
}
Fetch all of the documents.
endMs | integer <int64> Time in unix milliseconds that represents the oldest documents to return. Used in combination with durationMs. Defaults to now. |
durationMs | integer <int64> Time in milliseconds that represents the duration before endMs to query. Defaults to 24 hours. |
queryBy | string <string> Enum: "created" "updated" Retrieve most recent documents based on either driverCreatedAtMs or serverUpdatedAtMs. If no value is provided, the default is driverCreatedAtMs. |
{- "driverDocuments": [
- {
- "documentType": "Fuel Receipt",
- "driverCreatedAtMs": 1462881998034,
- "driverId": 555,
- "fields": [
- {
- "label": "Name of the number field",
- "numberValue": 123,
- "value": 123,
- "valueType": "ValueType_Number"
}, - {
- "label": "Name of the string field",
- "stringValue": "Example text value",
- "value": "Example text value",
- "valueType": "ValueType_String"
}, - {
- "label": "Name of the photo field",
- "value": [
- {
- "uuid": "f5271458-21f9-4a9f-a290-780c6d8840ff"
}
], - "valueType": "ValueType_Photo"
}, - {
- "label": "Name of the multiple choice field",
- "multipleChoiceValue": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "value": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "valueType": "ValueType_MultipleChoice"
}, - {
- "dateTimeValue": {
- "dateTimeMs": 1596681182972
}, - "label": "Name of the date time field",
- "value": {
- "dateTimeMs": 1596681182972
}, - "valueType": "ValueType_DateTime"
}, - {
- "label": "Name of the signature field",
- "signatureValue": {
- "name": "John Smith",
- "signedAtMs": 1596681191327,
}, - "value": {
- "name": "John Smith",
- "signedAtMs": 1596681191327,
- "uuid": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7"
}, - "valueType": "ValueType_Signature"
}
], - "id": "2018_42424242",
- "orgId": 555,
- "serverCreatedAtMs": 1462881998034,
- "serverUpdatedAtMs": 1462881998034,
- "vehicleId": 222,
- "dispatchJobId": 773,
- "name": "Fuel Receipt Wichita",
- "notes": "Fueled up before delivery.",
- "state": "Submitted"
}
]
}
Get all inactive drivers. When drivers leave an organization, you can deactivate them. You can use DELETE /v1/fleet/drivers/{id} to deactivate drivers. Inactive driver records will still be part of reports such as Hours of Service.
[- {
- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
]
Get an inactive driver. When drivers leave an organization, you can deactivate them. You can use DELETE /v1/fleet/drivers/{id} to deactivate drivers. You can use PUT /v1/fleet/drivers/{id} to reactivate drivers. Inactive driver records will still be part of reports such as Hours of Service.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Reactivate a driver.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
Driver reactivation body
reactivate required | boolean True indicates that this driver should be reactivated. |
{- "reactivate": true
}
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Get the distance and time each driver in an organization has driven in a given time period.
Note: If data is still being uploaded from the Samsara Driver App, it may not be completely reflected in the response from this endpoint. The best practice is to wait a couple of days before querying this endpoint to make sure that all data from the Samsara Driver App has been uploaded.
snap_to_day_bounds | boolean Snap query result to HOS day boundaries. |
endMs required | integer <int64> End time (ms) of queried time period. Must be greater than startMs. |
orgId required | integer <int64> Organization ID that the drivers belong to |
startMs required | integer <int64> Start time (ms) of queried time period. |
{- "endMs": 1462881998034,
- "orgId": 555,
- "startMs": 1462878398034
}
{- "Summaries": [
- {
- "activeMs": 43200000,
- "distanceMiles": 123.24,
- "driveMs": 21600000,
- "driverId": 444,
- "driverName": "Fred Jacobs",
- "driverUsername": "fjacobs",
- "groupId": 111,
- "onDutyMs": 21600000
}
]
}
Fetch the safety score for the driver.
driverId required | integer <int64> ID of the driver. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
{- "crashCount": 0,
- "driverId": 1234,
- "harshAccelCount": 1,
- "harshBrakingCount": 2,
- "harshEvents": [
- {
- "harshEventType": "Harsh Braking",
- "timestampMs": 1535590776000,
- "vehicleId": 212014918086169
}
], - "harshTurningCount": 0,
- "safetyScore": 97,
- "safetyScoreRank": "26",
- "timeOverSpeedLimitMs": 3769,
- "totalDistanceDrivenMeters": 291836,
- "totalHarshEventCount": 3,
- "totalTimeDrivenMs": 19708293
}
Get an active driver. When drivers leave an organization, you can deactivate them. Use GET /v1/fleet/drivers/inactive/{id} to get an inactive driver, and use DELETE /v1/fleet/drivers/{id} to deactivate drivers.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Deactivate a driver. You can use PUT /v1/fleet/drivers/{id} to reactivate a driver.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
"string"
Update a driver. You can update both active and inactive drivers. Active drivers are drivers that are currently part of your fleet. Inactive drivers are drivers that are not currently part of your fleet. Inactive driver historical data will still be available via different reports such as Hours of Service. Use DELETE /v1/fleet/drivers/{id} to deactivate drivers, and PUT /v1/fleet/drivers/{id} to reactivate drivers.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
Driver update body
tagIds | Array of numbers <int64> (TagIds) [ items <int64 > ] A list of tag IDs. |
eldAdverseWeatherExemptionEnabled | boolean Flag indicating this driver may use Adverse Weather exemptions in ELD logs. |
eldBigDayExemptionEnabled | boolean Flag indicating this driver may use Big Day excemptions in ELD logs. |
eldDayStartHour | integer 0 indicating midnight-to-midnight ELD driving hours, 12 to indicate noon-to-noon driving hours. |
eldExempt | boolean Flag indicating this driver is exempt from the Electronic Logging Mandate. |
eldExemptReason | string Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt). |
eldPcEnabled | boolean Default: false Flag indicating this driver may select the Personal Conveyance duty status in ELD logs. |
eldYmEnabled | boolean Default: false Flag indicating this driver may select the Yard Move duty status in ELD logs. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
groupId | integer <int64> Deprecated. |
licenseNumber | string Driver's state issued license number. |
licenseState | string Abbreviation of state that issued driver's license. |
name required | string Driver's name. |
notes | string Notes about the driver. |
phone | string Driver's phone number. Please include only digits, ex. 4157771234 |
timezone | string Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use IANA timezone database keys (e.g. |
username | string Driver's login username into the driver app. The username may not contain spaces or |
vehicleGroupTagId | integer <int64> ID of the tag which determines which vehicles a driver will see when selecting vehicles |
vehicleId | integer <int64> ID of the vehicle assigned to the driver for static vehicle assignments. (uncommon). |
{- "tagIds": [
- 123
], - "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
List all routes scheduled within a given time period for the given driver. Routes are returned if both of the following conditions are met:
scheduled_start_ms
is before the timestamp: end_time
(defaults to now)scheduled_end_ms
is after the timestamp: end_time - duration
(defaults to now - 24 hours)Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
driver_id required | integer <int64> ID of the driver with the associated routes. Must contain only digits 0-9. |
end_time | integer <int64> Time in unix milliseconds that represents the end time of the requested time interval. See above for a description of how routes are returned. Defaults to now. |
duration | integer <int64> Time in milliseconds that represents the duration before end_time to query. Defaults to 24 hours. |
[- {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
]
Create a new dispatch route for the driver with driver_id.
driver_id required | integer <int64> ID of the driver with the associated routes. Must contain only digits 0-9. |
required | Array of objects (DispatchJobCreate) The dispatch jobs to create for this route. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Create a driver document for the given driver.
You can create a document in one of two states: "Required" or "Submitted":
Setting the document state to "Submitted" will submit the document on behalf of the driver.
Setting the document state to "Required" will create a pre-populated document for the driver to fill out in the Driver App.
Populating document fields
You populate a document's fields according to the document's document type. You can retrieve document types using the GET /v1/fleet/drivers/document_types endpoint.
You must populate a document's fields using the field labels and value types, and the fields must be listed in the same order they appear in the document type. See the request schema below for more details.
Setting document fields to default values
If a document's state is set to "Required", you can set document fields to default values by omitting the field value from the request body or explicitly setting it to null. For example:
{
"documentTypeUuid": "79008acc-56d6-49f4-b5d2-4101ce4b497c",
"fields": [
{
"label": "Number Field",
"valueType": "ValueType_Number",
"numberValue": null
},
{
"label": "Signature Field",
"valueType": "ValueType_Signature"
}
],
"dispatchJobId": 4333299083,
"state":"Required"
}
In the request above, the value for the number field is explicitly set to null, and the value for the signature field is omitted. Both forms are accepted and functionally equivalent. Both will result in the field being pre-populated with a default value.
driver_id required | integer <int64> ID of the driver for whom the document is created. Must contain only digits 0-9. |
To create a document for a given document type, provide the documentTypeUuid
of the type of document you'd like to create. Then, pass in the fields
of the document in the same order that they show up in the given document type.
documentTypeUuid required | string Universally unique identifier for the document type that this document is being created for. |
required | Array of objects (DocumentCreateFields) List of fields for the document. The fields must be listed in the order that that they appear in the document type. Values of fields can be set to null or omitted if the document state is set to "Required". |
dispatchJobId | integer <int64> ID of the Samsara dispatch job for which the document is submitted. |
name | string [ 1 .. 255 ] characters Custom name of the document. If no custom name is given to the document, the admin dashboard and driver app will display the template name as the default document name. |
notes | string Notes submitted with this document. |
state | string Default: "Required" Enum: "Required" "Submitted" The condition of the document created for the driver. Can be either |
{- "documentTypeUuid": "4aff772c-a7bb-45e6-8e41-6a53e34feb83",
- "fields": [
- {
- "label": "Example number field label",
- "numberValue": 999,
- "valueType": "ValueType_Number"
}, - {
- "label": "text",
- "stringValue": "example string",
- "valueType": "ValueType_String"
}, - {
- "label": "Example multi choice label",
- "multipleChoiceValue": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "valueType": "ValueType_MultipleChoice"
}, - {
- "dateTimeValue": {
- "dateTimeMs": 10855639004823
}, - "label": "Example date time label",
- "valueType": "ValueType_DateTime"
}, - {
- "label": "Example photo label",
- "valueType": "ValueType_Photo"
}, - {
- "label": "Example signature label",
- "valueType": "ValueType_Signature"
}
], - "dispatchJobId": 773,
- "name": "Fuel Receipt Wichita",
- "notes": "Fueled up before delivery.",
- "state": "Required"
}
{- "documentType": "Fuel Receipt",
- "driverCreatedAtMs": 1462881998034,
- "driverId": 555,
- "fields": [
- {
- "label": "Name of the number field",
- "numberValue": 123,
- "value": 123,
- "valueType": "ValueType_Number"
}, - {
- "label": "Name of the string field",
- "stringValue": "Example text value",
- "value": "Example text value",
- "valueType": "ValueType_String"
}, - {
- "label": "Name of the photo field",
- "value": [
- {
- "uuid": "f5271458-21f9-4a9f-a290-780c6d8840ff"
}
], - "valueType": "ValueType_Photo"
}, - {
- "label": "Name of the multiple choice field",
- "multipleChoiceValue": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "value": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "valueType": "ValueType_MultipleChoice"
}, - {
- "dateTimeValue": {
- "dateTimeMs": 1596681182972
}, - "label": "Name of the date time field",
- "value": {
- "dateTimeMs": 1596681182972
}, - "valueType": "ValueType_DateTime"
}, - {
- "label": "Name of the signature field",
- "signatureValue": {
- "name": "John Smith",
- "signedAtMs": 1596681191327,
}, - "value": {
- "name": "John Smith",
- "signedAtMs": 1596681191327,
- "uuid": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7"
}, - "valueType": "ValueType_Signature"
}
], - "id": "2018_42424242",
- "orgId": 555,
- "serverCreatedAtMs": 1462881998034,
- "serverUpdatedAtMs": 1462881998034,
- "vehicleId": 222,
- "dispatchJobId": 773,
- "name": "Fuel Receipt Wichita",
- "notes": "Fueled up before delivery.",
- "state": "Submitted"
}
Fetches a single document submission by driver.
driver_id required | integer <int64> ID of the driver who submitted the document. Must contain only digits 0-9. |
document_id required | string ID of document. |
{- "documentType": "Fuel Receipt",
- "driverCreatedAtMs": 1462881998034,
- "driverId": 555,
- "fields": [
- {
- "label": "Name of the number field",
- "numberValue": 123,
- "value": 123,
- "valueType": "ValueType_Number"
}, - {
- "label": "Name of the string field",
- "stringValue": "Example text value",
- "value": "Example text value",
- "valueType": "ValueType_String"
}, - {
- "label": "Name of the photo field",
- "value": [
- {
- "uuid": "f5271458-21f9-4a9f-a290-780c6d8840ff"
}
], - "valueType": "ValueType_Photo"
}, - {
- "label": "Name of the multiple choice field",
- "multipleChoiceValue": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "value": [
- {
- "selected": false,
- "value": "option 1"
}, - {
- "selected": true,
- "value": "option 2"
}
], - "valueType": "ValueType_MultipleChoice"
}, - {
- "dateTimeValue": {
- "dateTimeMs": 1596681182972
}, - "label": "Name of the date time field",
- "value": {
- "dateTimeMs": 1596681182972
}, - "valueType": "ValueType_DateTime"
}, - {
- "label": "Name of the signature field",
- "signatureValue": {
- "name": "John Smith",
- "signedAtMs": 1596681191327,
}, - "value": {
- "name": "John Smith",
- "signedAtMs": 1596681191327,
- "uuid": "9814a1fa-f0c6-408b-bf85-51dc3bc71ac7"
}, - "valueType": "ValueType_Signature"
}
], - "id": "2018_42424242",
- "orgId": 555,
- "serverCreatedAtMs": 1462881998034,
- "serverUpdatedAtMs": 1462881998034,
- "vehicleId": 222,
- "dispatchJobId": 773,
- "name": "Fuel Receipt Wichita",
- "notes": "Fueled up before delivery.",
- "state": "Submitted"
}
Deletes a single document submission by driver.
driver_id required | integer <int64> ID of the driver who submitted the document. Must contain only digits 0-9. |
document_id required | string ID of document. |
"string"
Set an individual driver’s current duty status to 'On Duty' or 'Off Duty'.
To ensure compliance with the ELD Mandate, only authenticated drivers can make direct duty status changes on their own logbook. Any system external to the Samsara Driver App using this endpoint to trigger duty status changes must ensure that such changes are only triggered directly by the driver in question and that the driver has been properly authenticated. This endpoint should not be used to algorithmically trigger duty status changes nor should it be used by personnel besides the driver to trigger duty status changes on the driver’s behalf. Carriers and their drivers are ultimately responsible for maintaining accurate logs and should confirm that their use of the endpoint is compliant with the ELD Mandate.
driver_id required | integer <int64> ID of the driver for whom the duty status is being set. |
duty_status required | string Duty status to set the driver to. The only supported values are 'ON_DUTY' and 'OFF_DUTY'. |
location | string Location to associate the duty status change with. |
remarks | string Remark to associate the duty status change with. |
status_change_at_ms | number <int64> Timestamp that the duty status will begin at specified in milliseconds UNIX time. Defaults to the current time if left blank. This can only be set to up to 8 hours in the past. |
vehicle_id | number <int64> Vehicle ID to associate the duty status change with. |
{- "duty_status": "ON_DUTY",
- "location": "Loading dock",
- "remarks": "Beginning On Duty Shift",
- "status_change_at_ms": 1580834793568,
- "vehicle_id": 1234
}
"string"
Get summarized daily Hours of Service charts for a specified driver.
The response will contain a list of days
, where each entry in the list is the driver's summarized hours of service for that entire day.
The time range for a "day" is defined by the driver
's eldDayStartHour
. By default, this is 0
, which indicates the driver
's "day" is from midnight to midnight in the driver
's respective timezone
. This value is configurable per driver.
The startMs
and endMs
parameters indicate start and end for the date range you'd like to query. These parameters are inclusive. This means that the response will include the "day" that contains startMs
and the "day" that contains endMs
. For example:
Let's say a driver
's eldDayStartHour
is 0
and their timezone is America/Chicago
.
If startMs
was 1576080000000
(December 11, 2019 10:00:00 AM America/Chicago) and an endMs
was 1576166400000
(December 12, 2019 10:00:00 AM America/Los_Angeles), then the response will contain a two day
entries: [December 11, 2019 12:00:00 AM America/Chicago to December 12, 2019 12:00:00 AM America/Chicago], and [December 12, 2019 12:00:00 AM America/Chicago to December 13, 2019 12:00:00 AM America/Chicago].
Note: If data is still being uploaded from the Samsara Driver App, it may not be completely reflected in the response from this endpoint. The best practice is to wait a couple of days before querying this endpoint to make sure that all data from the Samsara Driver App has been uploaded.
driver_id required | integer <int64> ID of the driver with HOS logs. |
startMs required | integer <int64> Beginning of the time range, specified in milliseconds UNIX time. |
endMs required | integer <int64> End of the time range, specified in milliseconds UNIX time. Note: This timestamp should not be in the future. Providing a timestamp in the future will result in unpredictable behavior from the API. (I.e. this field should always be less than or equal to the current time). |
{- "days": [
- {
- "activeHours": 5.4,
- "activeMs": 691200,
- "certified": true,
- "certifiedAtMs": 0,
- "distanceMiles": 123.24,
- "driveMs": 12600000,
- "endMs": 1473836400000,
- "onDutyMs": 21600000,
- "pendingDriveMs": 12600000,
- "pendingOnDutyMs": 21600000,
- "shippingDocIds": [
- "14334",
- "Shipping Document ID 1"
], - "startMs": 1473750000000,
- "trailerIds": [
- "10293",
- "Trailer ID 1"
], - "vehicleIds": [
- 192319,
- 12958
]
}
]
}
Get the HOS (hours of service) signin and signout logs for the specified driver. The response includes 4 fields that are now deprecated.
Note: If data is still being uploaded from the Samsara Driver App, it may not be completely reflected in the response from this endpoint. The best practice is to wait a couple of days before querying this endpoint to make sure that all data from the Samsara Driver App has been uploaded.
driverId required | integer <int64> Driver ID to query. |
startMs required | integer <int64> Beginning of the time range, specified in milliseconds UNIX time. |
endMs required | integer <int64> End of the time range, specified in milliseconds UNIX time. |
{- "authenticationLogs": [
- {
- "actionType": "signin",
- "address": "THIS FIELD MAY NOT BE POPULATED",
- "addressName": "THIS FIELD MAY NOT BE POPULATED",
- "city": "THIS FIELD MAY NOT BE POPULATED",
- "happenedAtMs": 1462881998034,
- "state": "THIS FIELD MAY NOT BE POPULATED"
}
]
}
Get the HOS (hours of service) logs for the specified driver. This method returns all the HOS statuses that the driver was in during this time period.
Note: If data is still being uploaded from the Samsara Driver App, it may not be completely reflected in the response from this endpoint. The best practice is to wait a couple of days before querying this endpoint to make sure that all data from the Samsara Driver App has been uploaded.
driverId required | integer <int64> Driver ID to query. |
endMs required | integer End of the time range, specified in milliseconds UNIX time. |
startMs required | integer Beginning of the time range, specified in milliseconds UNIX time. |
{- "driverId": 444,
- "endMs": 1462881998034,
- "startMs": 1462878398034
}
{- "logs": [
- {
- "codriverIds": [
- 445
], - "driverId": 444,
- "groupId": 101,
- "hosStatusType": "OFF_DUTY",
- "locCity": "Ahwatukee",
- "locLat": 23.413702345,
- "locLng": -98.502888123,
- "locName": "McLean Site A",
- "locState": "Arizona",
- "logStartMs": 1462881998034,
- "remark": "Lunch Break",
- "vehicleId": 112
}
]
}
Get the current HOS status for all drivers. Note that this includes inactive as well as active drivers. You may need to upgrade your API token to version 2019-07-31 or later to leverage response pagination. See here.
Note: If data is still being uploaded from the Samsara Driver App, it may not be completely reflected in the response from this endpoint. The best practice is to wait a couple of days before querying this endpoint to make sure that all data from the Samsara Driver App has been uploaded.
after | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with 'after'. |
{- "drivers": [
- {
- "currentDutyStatusCode": "OFF_DUTY",
- "cycleRemaining": 252000000,
- "cycleTomorrow": 252000000,
- "driveMsToday": 252000000,
- "driverId": 444,
- "driverName": "Fred Jacobs",
- "drivingInViolationCycle": 50400000,
- "drivingInViolationToday": 39600000,
- "onDutyMsToday": 252000000,
- "pendingDriveMsToday": 252000000,
- "pendingOnDutyMsToday": 252000000,
- "shiftDriveRemaining": 39600000,
- "shiftRemaining": 50400000,
- "timeInCurrentStatus": 5000,
- "timeUntilBreak": 28800000,
- "vehicleName": "Vehicle 1"
}
], - "pagination": {
- "endCursor": "MTA1MDc5MB==",
- "hasNextPage": true
}
}
Get list of the vehicles. This method returns a list of the vehicles in the Samsara Cloud and information about them.
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
{- "groupId": 101,
- "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}, - "vehicles": [
- {
- "engineHours": 1500,
- "fuelLevelPercent": 0.3,
- "id": 112,
- "name": "Truck A7",
- "note": "Red truck 2015 M16",
- "odometerMeters": 60130000,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "vin": "1FUJA6BD31LJ09646"
}
]
}
Get current location of vehicles.
after | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. |
limit | number <int64> [ 1 .. 512 ] Default: 512 Pagination parameter indicating the number of results to return in this request. Used in conjunction with 'after'. |
vehicleIds | Array of strings A comma-separated list of vehicle IDs. Example: |
tagIds | Array of strings A comma-separated list of tag IDs. Example: |
{- "pagination": {
- "endCursor": "MTA1MDc5MB==",
- "hasNextPage": true
}, - "vehicles": [
- {
- "driverId": 1,
- "heading": 246.42,
- "id": 112,
- "latitude": 123.456,
- "location": "1 Main St, Dallas, TX",
- "longitude": 32.897,
- "name": "Truck A7",
- "odometerMeters": 71774705,
- "odometerType": "GPS",
- "onTrip": true,
- "routeIds": [
- 2244514,
- 2311654
], - "speed": 64.37,
- "time": 1462881998034,
- "vin": "JTNBB46KX73011966"
}
]
}
Get DVIRs for the org within provided time constraints
end_ms required | integer Time in millis until the last dvir log. |
duration_ms required | integer <= 7776000000 Time in millis which corresponds to the duration before the end_ms. Must be less than or equal to 90 days. |
{- "dvirs": [
- {
- "authorSignature": {
- "driverId": 2581,
- "email": "j.smith@yahoo.com",
- "mechanicUserId": 14849,
- "name": "John Smith",
- "signedAt": 12535500000,
- "type": "driver",
- "username": "jsmith"
}, - "defectsCorrected": true,
- "defectsNeedNotBeCorrected": false,
- "id": 19,
- "inspectionType": "pre trip",
- "mechanicNotes": "The vehicle is now safe.",
- "mechanicOrAgentSignature": {
- "driverId": 2581,
- "email": "j.smith@yahoo.com",
- "mechanicUserId": 14849,
- "name": "John Smith",
- "signedAt": 12535500000,
- "type": "driver",
- "username": "jsmith"
}, - "nextDriverSignature": {
- "driverId": 2581,
- "email": "j.smith@yahoo.com",
- "name": "John Smith",
- "signedAt": 12535500000,
- "type": "driver",
- "username": "jsmith"
}, - "odometerMiles": 49912,
- "startedAtMs": 1453449599999,
- "timeMs": 1453449599999,
- "trailerDefects": [
- {
- "comment": "Air Compressor not working",
- "defectType": "AIR_COMPRESSOR",
- "id": 18,
- "resolved": true,
- "resolvedAt": 1453449599999,
- "resolvedByDriverId": 2581,
- "resolvedByMechanicId": 14849
}
], - "trailerId": 19,
- "trailerName": "Storer's Trailer 19",
- "vehicle": {
- "id": 19,
- "name": "Storer's vehicle 19"
}, - "vehicleCondition": "SATISFACTORY",
- "vehicleDefects": [
- {
- "comment": "Air Compressor not working",
- "defectType": "AIR_COMPRESSOR",
- "id": 18,
- "resolved": true,
- "resolvedAt": 1453449599999,
- "resolvedByDriverId": 2581,
- "resolvedByMechanicId": 14849
}
]
}
]
}
Create a new dvir, marking a vehicle or trailer safe or unsafe.
DVIR creation body
inspectionType required | string Value: "mechanic" Only type 'mechanic' is currently accepted. |
mechanicNotes | string Any notes from the mechanic. |
odometerMiles | integer The current odometer of the vehicle. |
previousDefectsCorrected | boolean Whether any previous defects were corrected. If this vehicle or trailer was previously marked unsafe, and this DVIR marks it as safe, either previousDefectsCorrected or previousDefectsIgnored must be true. |
previousDefectsIgnored | boolean Whether any previous defects were ignored. If this vehicle or trailer was previously marked unsafe, and this DVIR marks it as safe, either previousDefectsCorrected or previousDefectsIgnored must be true. |
resolvedDefectIds | Array of integers <int64> [ items <int64 > ] List of defect IDs to resolve. The defects must be associated with the provided vehicle or trailer. |
safe required | string Enum: "safe" "unsafe" Whether or not this vehicle or trailer is safe to drive. |
trailerId | integer Id of trailer being inspected. Either vehicleId or trailerId must be provided. |
userEmail required | string The Samsara login email for the person creating the DVIR. The email must correspond to a Samsara user's email. |
vehicleId | integer Id of vehicle being inspected. Either vehicleId or trailerId must be provided. |
{- "inspectionType": "mechanic",
- "mechanicNotes": "Replaced headlight on passenger side.",
- "odometerMiles": 38426,
- "previousDefectsCorrected": true,
- "previousDefectsIgnored": false,
- "resolvedDefectIds": [
- 18,
- 19
], - "safe": "safe",
- "trailerId": 11,
- "userEmail": "j.smith@yahoo.com",
- "vehicleId": 10
}
{- "authorSignature": {
- "driverId": 2581,
- "email": "j.smith@yahoo.com",
- "mechanicUserId": 14849,
- "name": "John Smith",
- "signedAt": 12535500000,
- "type": "driver",
- "username": "jsmith"
}, - "defectsCorrected": true,
- "defectsNeedNotBeCorrected": false,
- "id": 19,
- "inspectionType": "pre trip",
- "mechanicNotes": "The vehicle is now safe.",
- "mechanicOrAgentSignature": {
- "driverId": 2581,
- "email": "j.smith@yahoo.com",
- "mechanicUserId": 14849,
- "name": "John Smith",
- "signedAt": 12535500000,
- "type": "driver",
- "username": "jsmith"
}, - "nextDriverSignature": {
- "driverId": 2581,
- "email": "j.smith@yahoo.com",
- "name": "John Smith",
- "signedAt": 12535500000,
- "type": "driver",
- "username": "jsmith"
}, - "odometerMiles": 49912,
- "startedAtMs": 1453449599999,
- "timeMs": 1453449599999,
- "trailerDefects": [
- {
- "comment": "Air Compressor not working",
- "defectType": "AIR_COMPRESSOR",
- "id": 18,
- "resolved": true,
- "resolvedAt": 1453449599999,
- "resolvedByDriverId": 2581,
- "resolvedByMechanicId": 14849
}
], - "trailerId": 19,
- "trailerName": "Storer's Trailer 19",
- "vehicle": {
- "id": 19,
- "name": "Storer's vehicle 19"
}, - "vehicleCondition": "SATISFACTORY",
- "vehicleDefects": [
- {
- "comment": "Air Compressor not working",
- "defectType": "AIR_COMPRESSOR",
- "id": 18,
- "resolved": true,
- "resolvedAt": 1453449599999,
- "resolvedByDriverId": 2581,
- "resolvedByMechanicId": 14849
}
]
}
Get list of the vehicles with any engine faults or check light data.
We suggest you use our updated and more flexible vehicle/stats endpoints for fetching vehicle fault codes.
{- "vehicles": [
- {
- "id": 112,
- "j1939": {
- "checkEngineLight": {
- "emissionsIsOn": true,
- "protectIsOn": true,
- "stopIsOn": true,
- "warningIsOn": true
}, - "diagnosticTroubleCodes": [
- {
- "fmiId": 0,
- "fmiText": "string",
- "occurrenceCount": 0,
- "spnDescription": "string",
- "spnId": 0,
- "txId": 0
}
]
}, - "passenger": {
- "checkEngineLight": {
- "isOn": true
}, - "diagnosticTroubleCodes": [
- {
- "dtcDescription": "string",
- "dtcId": 0,
- "dtcShortCode": "string"
}
]
}
}
]
}
This API allows you to update metadata for a single vehicle.
required | Array of objects |
{- "vehicles": [
- {
- "id": 112,
- "name": "Truck A7",
- "note": "Red truck 2015 M16"
}
]
}
"string"
Fetch trailer assignment data for all trailers in your organization.
startMs | integer <int64> Timestamp in Unix epoch miliseconds representing the start of the period to fetch. Omitting both startMs and endMs only returns current assignments. |
endMs | integer <int64> Timestamp in Unix epoch miliseconds representing the end of the period to fetch. Omitting endMs sets endMs as the current time |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
{- "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}, - "trailers": [
- {
- "id": 2041,
- "name": "myTrailer",
- "trailerAssignments": [
- {
- "driverId": 2047,
- "endMs": 1462881998034,
- "startMs": 1462878398034
}
]
}
]
}
Fetch trailer assignment data for a single trailer.
trailerId required | integer <int64> ID of trailer. Must contain only digits 0-9. |
startMs | integer <int64> Timestamp in Unix epoch milliseconds representing the start of the period to fetch. Omitting both startMs and endMs only returns current assignments. |
endMs | integer <int64> Timestamp in Unix epoch milliseconds representing the end of the period to fetch. Omitting endMs sets endMs as the current time |
{- "id": 2041,
- "name": "myTrailer",
- "trailerAssignments": [
- {
- "driverId": 2047,
- "endMs": 1462881998034,
- "startMs": 1462878398034
}
]
}
Get historical trips data for specified vehicle. This method returns a set of historical trips data for the specified vehicle in the specified time range.
vehicleId required | integer <int64> Vehicle ID to query. |
startMs required | integer Beginning of the time range, specified in milliseconds UNIX time. Limited to a 90 day window with respect to startMs and endMs |
endMs required | integer End of the time range, specified in milliseconds UNIX time. |
{- "trips": [
- {
- "assetIds": [
- 122
], - "codriverIds": [
- 122
], - "distanceMeters": 2500,
- "driverId": 719,
- "endAddress": {
- "address": "123 Main St, Sunnyvale, CA 94089",
- "id": 581,
- "name": "Ramen Tatsunoya"
}, - "endCoordinates": {
- "latitude": 23.413702345,
- "longitude": -91.502888123
}, - "endLocation": "571 S Lake Ave, Pasadena, CA 91101",
- "endMs": 1462881998034,
- "endOdometer": 210430500,
- "fuelConsumedMl": 75700,
- "startAddress": {
- "address": "123 Main St, Sunnyvale, CA 94089",
- "id": 581,
- "name": "Ramen Tatsunoya"
}, - "startCoordinates": {
- "latitude": 29.443702345,
- "longitude": -98.502888123
}, - "startLocation": "16 N Fair Oaks Ave, Pasadena, CA 91103",
- "startMs": 1462878398034,
- "startOdometer": 210430450,
- "tollMeters": 32000
}
]
}
Fetch locations for all vehicles between a start/end time. The maximum query duration is 30 minutes (1800000 ms).
startMs required | integer Time in Unix epoch milliseconds for the start of the query (cannot exceed 30 minutes) |
endMs required | integer Time in Unix epoch milliseconds for the end of the query (cannot exceed 30 minutes) |
[- {
- "id": 112,
- "locations": [
- {
- "latitude": 37.2,
- "location": "525 York, San Francisco, CA",
- "longitude": -122.5,
- "speedMilesPerHour": 35.2,
- "timeMs": 1535586471332
}
], - "name": "Truck A7"
}
]
Fetch engine state and aux input data for all vehicles between a start/end time. This endpoint provides the current state of all vehicles, not just the state changes, during the requested time period. Data returned may be affected by device connectivity and processing time.
startMs required | integer Time in Unix epoch milliseconds for the start of the query. |
endMs required | integer Time in Unix epoch milliseconds for the end of the query. |
series | string Enum: "engineState" "auxInput1" "auxInput2" Comma-separated list of stat types. Options are engineState, auxInput1, and auxInput2. If this parameter is excluded, all 3 stat types will be returned. Example: series=engineState,auxInput2 |
tagIds | string Comma-separated list of tag ids. Example: tagIds=1,2,3 |
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
{- "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}, - "vehicleStats": [
- {
- "auxInput1": {
- "name": "Boom",
- "values": [
- {
- "timeMs": 1546542978484,
- "value": true
}
]
}, - "auxInput2": {
- "name": "Boom",
- "values": [
- {
- "timeMs": 1546542978484,
- "value": true
}
]
}, - "engineState": [
- {
- "timeMs": 1546542978484,
- "value": "Running"
}
], - "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "vehicleId": 112
}
]
}
Fetch harsh event details for a vehicle.
vehicleId required | integer <int64> ID of the vehicle. Must contain only digits 0-9. |
timestamp required | integer <int64> Timestamp in milliseconds representing the timestamp of a harsh event. |
{- "harshEventType": "Harsh Braking",
- "isDistracted": true,
- "location": {
- "address": "350 Rhode Island St, San Francisco, CA",
- "latitude": 33.07614328,
- "longitude": -96.14907287
}
}
Fetch the safety score for the vehicle.
vehicleId required | integer <int64> ID of the vehicle. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
{- "crashCount": 0,
- "harshAccelCount": 1,
- "harshBrakingCount": 2,
- "harshEvents": [
- {
- "harshEventType": "Harsh Braking",
- "timestampMs": 1535590776000,
- "vehicleId": 212014918086169
}
], - "harshTurningCount": 0,
- "safetyScore": 97,
- "safetyScoreRank": "26",
- "timeOverSpeedLimitMs": 3769,
- "totalDistanceDrivenMeters": 291836,
- "totalHarshEventCount": 3,
- "totalTimeDrivenMs": 19708293,
- "vehicleId": 4321
}
Gets a specific vehicle.
vehicle_id_or_external_id required | string ID of the vehicle. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource, or automatically populated by fields on the vehicle. To specify an external ID as part of a path parameter, use the following format: |
{- "ExternalIds": {
- "maintenanceId": "ABFS18600"
}, - "HarshAccelSetting": "Heavy",
- "Id": 112,
- "Name": "Truck A7",
- "VehicleInfo": {
- "Make": "Honda",
- "Model": "Odyssey",
- "Vin": "1FUJA6BD31LJ09646",
- "Year": 1997
}
}
Updates the specified vehicle using JSON merge patch format. See IETF RFC 7396: https://tools.ietf.org/html/rfc7396.
vehicle_id_or_external_id required | string ID of the vehicle. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource, or automatically populated by fields on the vehicle. To specify an external ID as part of a path parameter, use the following format: |
object | |
harsh_accel_setting | integer <string> Enum: "Passenger" "Light Truck" "Heavy" "Off" "Auto" Harsh Event Detection Setting
|
name | string Name |
{- "externalIds": {
- "maintenanceId": "ABFS18600"
}, - "harsh_accel_setting": "Passenger",
- "name": "string"
}
{- "ExternalIds": {
- "maintenanceId": "ABFS18600"
}, - "HarshAccelSetting": "Heavy",
- "Id": 112,
- "Name": "Truck A7",
- "VehicleInfo": {
- "Make": "Honda",
- "Model": "Odyssey",
- "Vin": "1FUJA6BD31LJ09646",
- "Year": 1997
}
}
List all routes scheduled within a given time period for the given vehicle. Routes are returned if both of the following conditions are met:
scheduled_start_ms
is before the timestamp: end_time
(defaults to now)scheduled_end_ms
is after the timestamp: end_time - duration
(defaults to now - 24 hours)Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
vehicle_id required | integer <int64> ID of the vehicle with the associated routes. Must contain only digits 0-9. |
end_time | integer <int64> Time in unix milliseconds that represents the end time of the requested time interval. See above for a description of how routes are returned. Defaults to now. |
duration | integer <int64> Time in milliseconds that represents the duration before end_time to query. Defaults to 24 hours. |
[- {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
]
Create a new dispatch route for the vehicle with vehicle_id.
vehicle_id required | integer <int64> ID of the vehicle with the associated routes. Must contain only digits 0-9. |
required | Array of objects (DispatchJobCreate) The dispatch jobs to create for this route. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Fetch locations for a given vehicle between a start/end time. The maximum query duration is one hour.
vehicle_id required | integer <int64> ID of the vehicle with the associated routes. Must contain only digits 0-9. |
startMs required | integer <int64> Time in Unix epoch milliseconds for the start of the query (cannot exceed 1 hour) |
endMs required | integer <int64> Time in Unix epoch milliseconds for the end of the query (cannot exceed 1 hour) |
[- {
- "latitude": 37.2,
- "location": "525 York, San Francisco, CA",
- "longitude": -122.5,
- "speedMilesPerHour": 35.2,
- "timeMs": 1535586471332
}
]
Fetch all of the data inputs.
startMs | integer <int64> Timestamp in unix milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. defaults to nowMs. |
endMs | integer <int64> Timestamp in unix milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. Defaults to nowMs. |
{- "dataInputs": [
- {
- "id": 12345,
- "name": "Pump Flow",
- "points": [
- {
- "timeMs": 1453449599999,
- "value": 12.332
}
]
}
]
}
Fetch datapoints from a given data input.
data_input_id required | integer <int64> ID of the data input. Must contain only digits 0-9. |
startMs | integer <int64> Timestamp in unix milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. defaults to nowMs. |
endMs | integer <int64> Timestamp in unix milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. Defaults to nowMs. |
{- "id": 12345,
- "name": "Pump Flow",
- "points": [
- {
- "timeMs": 1453449599999,
- "value": 12.332
}
]
}
Fetch configured programs on the camera.
camera_id required | integer <int64> The camera_id should be valid for the given accessToken. |
[- {
- "programId": 1,
- "programName": "Barcode verification program"
}
]
Fetch the latest run for a camera or program by default. If startedAtMs is supplied, fetch the specific run that corresponds to that start time.
camera_id required | integer <int64> The camera_id should be valid for the given accessToken. |
program_id | integer <int64> The configured program's ID on the camera. |
startedAtMs | integer <int64> EndMs is an optional param. It will default to the current time. |
include | string Include is a filter parameter. Accepts 'pass', 'reject' or 'no_read'. |
limit | integer <int64> Limit is an integer value from 1 to 1,000. |
{- "cameraId": 1234512345123,
- "endedAtMs": 0,
- "inspectionResults": [
- {
- "captureAtMs": 1553811994730,
- "result": "PASS",
- "stepResults": [
- {
- "angleCheck": {
- "angleConfigured": {
- "high": 150,
- "low": 90
}, - "angleFound": 60,
- "endStepName": "Edge 2",
- "startStepName": "Edge 1"
}, - "barcode": [
- {
- "contents": "10855639004823",
- "matchString": "10855639004823",
- "type": "EAN8"
}
], - "booleanLogic": {
- "operator": "AND",
- "steps": [
- {
- "name": "Expiration Date",
- "result": "PASS"
}
]
}, - "caliper": {
- "angleRange": {
- "high": 360,
- "low": 0
}, - "contrastRange": {
- "high": 100,
- "low": 50
}, - "distanceFound": 555.55,
- "enforceAngleRange": true,
- "enforceStraightnessRange": true,
- "filterPolarity": "LIGHT TO DARK",
- "maxDistance": 1000,
- "minDistance": 500,
- "sharpnessRange": {
- "high": 100,
- "low": 80
}, - "straightnessRange": {
- "high": 100,
- "low": 80
}, - "unit": "Millimeters"
}, - "contour": {
- "angleDegrees": 0,
- "angleTolerance": 50,
- "matchPercentage": 46,
- "matchThreshold": 18
}, - "distance": {
- "distanceFound": 1000.22,
- "endStepName": "Bottom Right Square",
- "enforceOffsetAngleRange": true,
- "maxDistance": 900,
- "maxOffsetAngle": 90,
- "minDistance": 1500,
- "minOffsetAngle": 45,
- "offsetAngleFound": 50,
- "startStepName": "Top Left Square",
- "unit": "Millimeters"
}, - "expirationDate": {
- "dateOffset": 1,
- "foundDate": "06/13/2019",
- "matchDate": "06/13/2019"
}, - "findCopies": {
- "angleTolerance": 10,
- "foundCount": 1,
- "maxCount": 5,
- "minCount": 1,
- "threshold": 70
}, - "findEdge": {
- "angleFound": 90,
- "angleRange": {
- "high": 360,
- "low": 0
}, - "contrastPercent": 72.8,
- "contrastRange": {
- "high": 100,
- "low": 50
}, - "enforceAngleRange": true,
- "enforceStraightnessRange": true,
- "filterPolarity": "ANY",
- "sharpnessPercent": 95,
- "sharpnessRange": {
- "high": 100,
- "low": 80
}, - "straightnessFound": 95,
- "straightnessRange": {
- "high": 100,
- "low": 80
}
}, - "findShapes": {
- "foundCount": 1,
- "maxCount": 5,
- "minCount": 1
}, - "fixture": {
- "coordinates": {
- "x": 10,
- "y": 10
}, - "found": true,
- "rotationDegrees": 90
}, - "labelMatch": {
- "score": 10,
- "threshold": 10
}, - "name": "Chicken Caesar Label",
- "presenceAbsence": {
- "blueRange": {
- "high": 150,
- "low": 90
}, - "checkForAbsence": true,
- "grayscaleRange": {
- "high": 100,
- "low": 20
}, - "greenRange": {
- "high": 150,
- "low": 90
}, - "hueRange": {
- "high": 100,
- "low": 20
}, - "redRange": {
- "high": 150,
- "low": 90
}, - "saturationRange": {
- "high": 50,
- "low": 10
}, - "score": 50,
- "threshold": 50,
- "thresholdMode": "Percentage",
- "thresholdRange": {
- "high": 80,
- "low": 30
}, - "valueRange": {
- "high": 50,
- "low": 10
}
}, - "result": "PASS",
- "textMatch": {
- "foundText": "ABCD",
- "matchString": "ABCD"
}
}
]
}
], - "isOngoing": true,
- "program": {
- "id": 1,
- "name": "Barcode verification program"
}, - "runSummary": {
- "itemsPerMinute": 0.1,
- "noReadCount": 0,
- "rejectCount": 0,
- "successCount": 181
}, - "startedAtMs": 1553808606097
}
Fetch runs.
durationMs required | integer <int64> DurationMs is a required param. This works with the EndMs parameter. Indicates the duration in which the visionRuns will be fetched |
endMs | integer <int64> EndMs is an optional param. It will default to the current time. |
{- "visionRuns": [
- {
- "deviceId": 1234512345123,
- "endedAtMs": 0,
- "programId": 1,
- "reportMetadata": {
- "itemsPerMinute": 0.1,
- "noReadCount": 181,
- "rejectCount": 0,
- "successCount": 181
}, - "startedAtMs": 1553808606097
}
]
}
Fetch runs by camera.
camera_id required | integer <int64> The camera_id should be valid for the given accessToken. |
durationMs required | integer <int64> DurationMs is a required param. This works with the EndMs parameter. Indicates the duration in which the visionRuns will be fetched |
endMs | integer <int64> EndMs is an optional param. It will default to the current time. |
[- {
- "deviceId": 1234512345123,
- "endedAtMs": 0,
- "program": {
- "id": 1,
- "name": "Barcode verification program"
}, - "reportMetadata": {
- "itemsPerMinute": 0.1,
- "noReadCount": 0,
- "rejectCount": 0,
- "successCount": 181
}, - "startedAtMs": 1553808606097
}
]
Fetch runs by camera and program.
camera_id required | integer <int64> The camera_id should be valid for the given accessToken. |
program_id required | integer <int64> The configured program's ID on the camera. |
started_at_ms required | integer <int64> Started_at_ms is a required param. Indicates the start time of the run to be fetched. |
include | string Include is a filter parameter. Accepts 'pass', 'reject' or 'no_read'. |
{- "deviceId": 1234512345123,
- "endedAtMs": 0,
- "programId": 1,
- "reportMetadata": {
- "itemsPerMinute": 0.1,
- "noReadCount": 0,
- "rejectCount": 0,
- "successCount": 181
}, - "results": [
- {
- "captureAtMs": 1553811994730,
- "image": {
- "expiresAtMs": 1553812994730,
}, - "result": "PASS",
- "stepResults": [
- {
- "angleCheck": {
- "angleConfigured": {
- "high": 150,
- "low": 90
}, - "angleFound": 60,
- "endStepName": "Edge 2",
- "startStepName": "Edge 1"
}, - "barcode": [
- {
- "contents": "10855639004823",
- "matchString": "10855639004823",
- "type": "EAN8"
}
], - "booleanLogic": {
- "operator": "AND",
- "steps": [
- {
- "name": "Expiration Date",
- "result": "PASS"
}
]
}, - "caliper": {
- "angleRange": {
- "high": 360,
- "low": 0
}, - "contrastRange": {
- "high": 100,
- "low": 50
}, - "distanceFound": 555.55,
- "enforceAngleRange": true,
- "enforceStraightnessRange": true,
- "filterPolarity": "LIGHT TO DARK",
- "maxDistance": 1000,
- "minDistance": 500,
- "sharpnessRange": {
- "high": 100,
- "low": 80
}, - "straightnessRange": {
- "high": 100,
- "low": 80
}, - "unit": "Millimeters"
}, - "contour": {
- "angleDegrees": 0,
- "angleTolerance": 50,
- "matchPercentage": 46,
- "matchThreshold": 18
}, - "distance": {
- "distanceFound": 1000.22,
- "endStepName": "Bottom Right Square",
- "enforceOffsetAngleRange": true,
- "maxDistance": 900,
- "maxOffsetAngle": 90,
- "minDistance": 1500,
- "minOffsetAngle": 45,
- "offsetAngleFound": 50,
- "startStepName": "Top Left Square",
- "unit": "Millimeters"
}, - "expirationDate": {
- "dateOffset": 1,
- "foundDate": "06/13/2019",
- "matchDate": "06/13/2019"
}, - "findCopies": {
- "angleTolerance": 10,
- "foundCount": 1,
- "maxCount": 5,
- "minCount": 1,
- "threshold": 70
}, - "findEdge": {
- "angleFound": 90,
- "angleRange": {
- "high": 360,
- "low": 0
}, - "contrastPercent": 72.8,
- "contrastRange": {
- "high": 100,
- "low": 50
}, - "enforceAngleRange": true,
- "enforceStraightnessRange": true,
- "filterPolarity": "ANY",
- "sharpnessPercent": 95,
- "sharpnessRange": {
- "high": 100,
- "low": 80
}, - "straightnessFound": 95,
- "straightnessRange": {
- "high": 100,
- "low": 80
}
}, - "findShapes": {
- "foundCount": 1,
- "maxCount": 5,
- "minCount": 1
}, - "fixture": {
- "coordinates": {
- "x": 10,
- "y": 10
}, - "found": true,
- "rotationDegrees": 90
}, - "labelMatch": {
- "score": 10,
- "threshold": 10
}, - "name": "Chicken Caesar Label",
- "presenceAbsence": {
- "blueRange": {
- "high": 150,
- "low": 90
}, - "checkForAbsence": true,
- "grayscaleRange": {
- "high": 100,
- "low": 20
}, - "greenRange": {
- "high": 150,
- "low": 90
}, - "hueRange": {
- "high": 100,
- "low": 20
}, - "redRange": {
- "high": 150,
- "low": 90
}, - "saturationRange": {
- "high": 50,
- "low": 10
}, - "score": 50,
- "threshold": 50,
- "thresholdMode": "Percentage",
- "thresholdRange": {
- "high": 80,
- "low": 30
}, - "valueRange": {
- "high": 50,
- "low": 10
}
}, - "result": "PASS",
- "textMatch": {
- "foundText": "ABCD",
- "matchString": "ABCD"
}
}
]
}
], - "startedAtMs": 1553808606097
}
Get historical data for machine objects. This method returns a set of historical data for all machines
Time range to query for events
endMs required | integer End of the time range, specified in milliseconds UNIX time. |
startMs required | integer Beginning of the time range, specified in milliseconds UNIX time. |
{- "endMs": 1462881998034,
- "startMs": 1462878398034
}
{- "machines": [
- {
- "id": 1,
- "name": "1/3 HP Motor",
- "vibrations": [
- {
- "X": 0.01,
- "Y": 1.23,
- "Z": 2.55,
- "time": 1453449599999
}
]
}
]
}
Get machine objects. This method returns a list of the machine objects in the Samsara Cloud and information about them.
{- "machines": [
- {
- "id": 123,
- "name": "Freezer ABC",
- "notes": "This is in the left hallway behind the conveyor belt"
}
]
}
Get cargo monitor status (empty / full) for requested sensors.
List of sensor IDs to query.
sensors required | Array of integers <int64> [ items <int64 > ] List of sensor IDs to query. |
{- "sensors": [
- 122
]
}
{- "groupId": 101,
- "sensors": [
- {
- "cargoEmpty": true,
- "cargoStatusTime": "2019-04-17T16:42:55Z",
- "id": 122,
- "name": "Trailer Cargo Sensor",
- "trailerId": 123,
- "vehicleId": 124
}
]
}
Get door monitor status (closed / open) for requested sensors.
List of sensor IDs to query.
sensors required | Array of integers <int64> [ items <int64 > ] List of sensor IDs to query. |
{- "sensors": [
- 122
]
}
{- "groupId": 101,
- "sensors": [
- {
- "doorClosed": true,
- "doorStatusTime": "2019-04-17T16:42:55Z",
- "id": 122,
- "name": "Trailer Door Sensor",
- "trailerId": 123,
- "vehicleId": 124
}
]
}
Get historical data for specified sensors. This method returns a set of historical data for the specified sensors in the specified time range and at the specified time resolution.
Time range and resolution, and list of sensor ID, field pairs to query.
endMs required | integer End of the time range, specified in milliseconds UNIX time. |
fillMissing | string Default: "withNull" Enum: "withNull" "withPrevious" |
required | Array of objects <= 40 items |
startMs required | integer Beginning of the time range, specified in milliseconds UNIX time. |
stepMs required | integer Time resolution for which data should be returned, in milliseconds. Specifying 3600000 will return data at hour intervals. |
{- "endMs": 1462881998034,
- "fillMissing": "withNull",
- "series": [
- {
- "field": "ambientTemperature",
- "widgetId": 1
}
], - "startMs": 1462878398034,
- "stepMs": 3600000
}
{- "results": [
- {
- "series": [
- 1
], - "timeMs": 1453449599999
}
]
}
Get humidity for requested sensors. This method returns the current relative humidity for the requested sensors.
List of sensor IDs to query.
sensors required | Array of integers <int64> [ items <int64 > ] List of sensor IDs to query. |
{- "sensors": [
- 122
]
}
{- "groupId": 101,
- "sensors": [
- {
- "humidity": 53,
- "humidityTime": "2019-04-17T16:42:55Z",
- "id": 122,
- "name": "Freezer Humidity Sensor",
- "trailerId": 123,
- "vehicleId": 124
}
]
}
Get temperature for requested sensors. This method returns the current ambient temperature (and probe temperature if applicable) for the requested sensors.
List of sensor IDs to query.
sensors required | Array of integers <int64> [ items <int64 > ] List of sensor IDs to query. |
{- "sensors": [
- 122
]
}
{- "groupId": 101,
- "sensors": [
- {
- "ambientTemperature": 11057,
- "ambientTemperatureTime": "2019-04-17T16:42:55Z",
- "id": 122,
- "name": "Freezer Temp Sensor",
- "probeTemperature": -20145,
- "probeTemperatureTime": "2019-04-17T16:42:55Z",
- "trailerId": 123,
- "vehicleId": 124
}
]
}
Fetch current locations of all assets.
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
tagIds | Array of strings A comma-separated list of tag IDs. Example: |
{- "assets": [
- {
- "assetSerialNumber": "8dka2810",
- "cable": {
- "assetType": "Thermo King"
}, - "engineHours": 104,
- "id": 1,
- "location": [
- {
- "latitude": 37,
- "location": "525 York, San Francisco, CA",
- "longitude": -122.7,
- "speedMilesPerHour": 35,
- "timeMs": 12314151
}
], - "name": "Trailer 123"
}
], - "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}
}
Fetches all reefers and reefer-specific stats.
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. |
startingAfter | string Pagination parameter indicating the cursor position to continue returning results after. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'endingBefore' parameter. |
endingBefore | string Pagination parameter indicating the cursor position to return results before. Used in conjunction with the 'limit' parameter. Mutually exclusive with 'startingAfter' parameter. |
limit | number <int64> Pagination parameter indicating the number of results to return in this request. Used in conjunction with either 'startingAfter' or 'endingBefore'. |
{- "data": [
- {
- "assetType": "Thermo King",
- "id": 1,
- "name": "Reefer 123",
- "reeferStats": {
- "ambientAirTemperature": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "dischargeAirTemperature": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "engineHours": [
- {
- "changedAtMs": 1453449599999,
- "engineHours": 1200
}
], - "fuelPercentage": [
- {
- "changedAtMs": 1453449599999,
- "fuelPercentage": 99
}
], - "powerStatus": [
- {
- "changedAtMs": 1453449599999,
- "status": "Active (Continuous)"
}
], - "reeferAlarms": [
- {
- "alarms": [
- {
- "alarmCode": 102,
- "description": "Check Return Air Sensor",
- "operatorAction": "Check and repair at end of trip",
- "severity": 1
}
], - "changedAtMs": 1453449599999
}
], - "returnAirTemperature": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "setPoint": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
]
}
}
], - "pagination": {
- "endCursor": "MTU5MTEzNjA2OTU0MzQ3",
- "hasNextPage": true,
- "hasPrevPage": true,
- "startCursor": "MTU5MTEzNjA2OTU0MzQ3"
}
}
Fetch the historical locations for the asset.
asset_id required | integer <int64> ID of the asset. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. |
[- {
- "latitude": 37,
- "location": "525 York, San Francisco, CA",
- "longitude": -122.7,
- "speedMilesPerHour": 35,
- "time": 12314151
}
]
Fetch the reefer-specific stats of an asset.
asset_id required | integer <int64> ID of the asset. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. |
{- "assetType": "Thermo King",
- "id": 1,
- "name": "Reefer 123",
- "reeferStats": {
- "alarms": [
- {
- "alarms": [
- {
- "alarmCode": 102,
- "description": "Check Return Air Sensor",
- "operatorAction": "Check and repair at end of trip",
- "severity": 1
}
], - "changedAtMs": 1453449599999
}
], - "engineHours": [
- {
- "changedAtMs": 1453449599999,
- "engineHours": 1200
}
], - "fuelPercentage": [
- {
- "changedAtMs": 1453449599999,
- "fuelPercentage": 99
}
], - "powerStatus": [
- {
- "changedAtMs": 1453449599999,
- "status": "Active (Continuous)"
}
], - "returnAirTemp": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
], - "setPoint": [
- {
- "changedAtMs": 1453449599999,
- "tempInMilliC": 31110
}
]
}
}
Fetch the safety score for the driver.
driverId required | integer <int64> ID of the driver. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
{- "crashCount": 0,
- "driverId": 1234,
- "harshAccelCount": 1,
- "harshBrakingCount": 2,
- "harshEvents": [
- {
- "harshEventType": "Harsh Braking",
- "timestampMs": 1535590776000,
- "vehicleId": 212014918086169
}
], - "harshTurningCount": 0,
- "safetyScore": 97,
- "safetyScoreRank": "26",
- "timeOverSpeedLimitMs": 3769,
- "totalDistanceDrivenMeters": 291836,
- "totalHarshEventCount": 3,
- "totalTimeDrivenMs": 19708293
}
Fetch harsh event details for a vehicle.
vehicleId required | integer <int64> ID of the vehicle. Must contain only digits 0-9. |
timestamp required | integer <int64> Timestamp in milliseconds representing the timestamp of a harsh event. |
{- "harshEventType": "Harsh Braking",
- "isDistracted": true,
- "location": {
- "address": "350 Rhode Island St, San Francisco, CA",
- "latitude": 33.07614328,
- "longitude": -96.14907287
}
}
Fetch the safety score for the vehicle.
vehicleId required | integer <int64> ID of the vehicle. Must contain only digits 0-9. |
startMs required | integer <int64> Timestamp in milliseconds representing the start of the period to fetch, inclusive. Used in combination with endMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
endMs required | integer <int64> Timestamp in milliseconds representing the end of the period to fetch, inclusive. Used in combination with startMs. Total duration (endMs - startMs) must be greater than or equal to 1 hour. |
{- "crashCount": 0,
- "harshAccelCount": 1,
- "harshBrakingCount": 2,
- "harshEvents": [
- {
- "harshEventType": "Harsh Braking",
- "timestampMs": 1535590776000,
- "vehicleId": 212014918086169
}
], - "harshTurningCount": 0,
- "safetyScore": 97,
- "safetyScoreRank": "26",
- "timeOverSpeedLimitMs": 3769,
- "totalDistanceDrivenMeters": 291836,
- "totalHarshEventCount": 3,
- "totalTimeDrivenMs": 19708293,
- "vehicleId": 4321
}
[- {
- "authType": "default",
- "email": "user@company.com",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "id": 123,
- "organizationRole": "Full Admin",
- "tagRoles": [
- {
- "role": "Full Admin",
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tag": {
- "id": 12345,
- "name": "North Carolina Distribution",
- "parentTagId": 12345
}
}
]
}
]
Add a user to the organization.
User properties. Only one of organizationRoleId or tagRoles is required.
authType required | string Enum: "default" "saml" The authentication type the user uses to authenticate. To use SAML this organization must have a configured SAML integration. |
name required | string The first and last name of the user. |
organizationRoleId | string The id of the role the user is assigned to at the organization level. This will be blank for users that only have access to specific tags. |
Array of objects If specified, the user will be an administrator for these tags. If left blank, the user has access to the entire organization. | |
email required | string The email address of this user. |
{- "authType": "default",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "tagRoles": [
- {
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tagId": "123"
}
], - "email": "user@company.com"
}
{- "authType": "default",
- "email": "user@company.com",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "id": 123,
- "organizationRole": "Full Admin",
- "tagRoles": [
- {
- "role": "Full Admin",
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tag": {
- "id": 12345,
- "name": "North Carolina Distribution",
- "parentTagId": 12345
}
}
]
}
Get a user.
userId required | integer <int64> ID of the user. Must contain only digits 0-9. |
User properties. Only one of organizationRoleId or tagRoles is required.
authType required | string Enum: "default" "saml" The authentication type the user uses to authenticate. To use SAML this organization must have a configured SAML integration. |
name required | string The first and last name of the user. |
organizationRoleId | string The id of the role the user is assigned to at the organization level. This will be blank for users that only have access to specific tags. |
Array of objects If specified, the user will be an administrator for these tags. If left blank, the user has access to the entire organization. | |
email required | string The email address of this user. |
{- "authType": "default",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "tagRoles": [
- {
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tagId": "123"
}
], - "email": "user@company.com"
}
{- "authType": "default",
- "email": "user@company.com",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "id": 123,
- "organizationRole": "Full Admin",
- "tagRoles": [
- {
- "role": "Full Admin",
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tag": {
- "id": 12345,
- "name": "North Carolina Distribution",
- "parentTagId": 12345
}
}
]
}
Update some fields on a user. Only fields to be changed need to be supplied. Note that if you change an object or collection, you must supply the complete collection. For example, to add a tag role to a user, you must specify all tag roles that the user should have.
userId required | integer <int64> ID of the user. Must contain only digits 0-9. |
User properties. Note that when updating tagRoles, the complete list of tag roles must be supplied for the user. To delete all tag roles set the value to null or an empty array.
authType | string Enum: "default" "saml" The authentication type the user uses to authenticate. To use SAML this organization must have a configured SAML integration. |
name | string The first and last name of the user. |
organizationRoleId | string The id of the role the user is assigned to at the organization level. This will be blank for users that only have access to specific tags. |
Array of objects If specified, the user will be an administrator for these tags. If left blank, the user has access to the entire organization. |
{- "authType": "default",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "tagRoles": [
- {
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tagId": "123"
}
]
}
{- "authType": "default",
- "email": "user@company.com",
- "name": "Jane Doe",
- "organizationRoleId": "23d4d8d3-dc10-4e7a-a183-69968751f23e",
- "id": 123,
- "organizationRole": "Full Admin",
- "tagRoles": [
- {
- "role": "Full Admin",
- "roleId": "8a9371af-82d1-4158-bf91-4ecc8d3a114c",
- "tag": {
- "id": 12345,
- "name": "North Carolina Distribution",
- "parentTagId": 12345
}
}
]
}
Contacts can be setup in order to send alerts via SMS text or email to individuals in your organization. You can retrieve a list of all contacts, or you can fetch each contact individually.
Add a contact to the organization.
Add a contact.
string Email address of the contact. | |
firstName | string First name of the contact. |
lastName | string Last name of the contact. |
phone | string Phone number of the contact. |
{- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "lastName": "Jones",
- "phone": "111-222-3344"
}
{- "data": {
- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "id": 123,
- "lastName": "Jones",
- "phone": "111-222-3344"
}
}
Fetch a contact by its id.
contact_id required | integer <int64> ID of the contact. Must contain only digits 0-9. |
{- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "id": 123,
- "lastName": "Jones",
- "phone": "111-222-3344"
}
Update the name, phone number or email of a contact using the contact id. Only fields to be changed need to be supplied.
contact_id required | integer <int64> ID of the contact. Must contain only digits 0-9. |
Update the email, first name, last name, or phone number of a contact using the contact_id.
string Email address of the contact. | |
firstName | string First name of the contact. |
lastName | string Last name of the contact. |
phone | string Phone number of the contact. |
{- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "lastName": "Jones",
- "phone": "111-222-3344"
}
{- "data": {
- "email": "jane.jones@yahoo.com",
- "firstName": "Jane",
- "id": 123,
- "lastName": "Jones",
- "phone": "111-222-3344"
}
}
List all routes scheduled within a given time period. Routes are returned if both of the following conditions are met:
scheduled_start_ms
is before the timestamp: end_time
(defaults to now)scheduled_end_ms
is after the timestamp: end_time - duration
(defaults to now - 24 hours)Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
end_time | integer <int64> Time in unix milliseconds that represents the end time of the requested time interval. See above for a description of how routes are returned. Defaults to now. |
duration | integer <int64> Time in milliseconds that represents the duration before end_time to query. Defaults to 24 hours. |
[- {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
]
Create a new dispatch route.
required | Array of objects (DispatchJobCreate) The dispatch jobs to create for this route. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Fetch all updates to a job including route data in the last 24 hours or subsequent to an sequence ID. Returns a maximum of 500 job updates. If more than 500 job updates are available, another request made with the prior request's sequence_id will return the next set of available job updates.
sequence_id | string Sequence ID from the response payload of the last request. Defaults to fetching updates from last 24 hours. |
include | string Optionally set include=route to include route object in response payload. |
{- "job_updates": [
- {
- "changed_at_ms": 1462881998034,
- "job_id": 773,
- "job_state": "JobState_Arrived",
- "prev_job_state": "JobState_EnRoute",
- "route": {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}, - "route_id": 556
}
], - "sequence_id": "eyJpZCI6MywiY3JlYXRlZF9hdCI6MTQ5OTQyOTIyMDAwMn0="
}
Fetch a dispatch route by id.
route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Update the dispatch route. Examples of this include:
dispatch_jobs
array. If you add a job to this array, you do not need to include an id
field. One will be created automatically for that new job.route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
required | Array of objects (DispatchJobUpdate) The dispatch jobs for the route. |
id required | integer <int64> ID of route. This must match the route ID passed in URL. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "id": 42,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": "42",
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Delete a dispatch route and its associated jobs.
route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
apply_to_future_routes | boolean This is only for a recurring route. If set to true, delete all following runs of the route. If set to false, only delete the current route. |
{- "apply_to_future_routes": true
}
"string"
Fetch the history of a dispatch route.
route_id_or_external_id required | string ID of the route. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
start_time | integer <int64> Timestamp representing the start of the period to fetch, inclusive. Used in combination with end_time. Defaults to 0. |
end_time | integer <int64> Timestamp representing the end of the period to fetch, inclusive. Used in combination with start_time. Defaults to nowMs. |
{- "history": [
- {
- "changed_at_ms": 1499411220000,
- "route": {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
}
]
}
List all routes scheduled within a given time period for the given driver. Routes are returned if both of the following conditions are met:
scheduled_start_ms
is before the timestamp: end_time
(defaults to now)scheduled_end_ms
is after the timestamp: end_time - duration
(defaults to now - 24 hours)Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
driver_id required | integer <int64> ID of the driver with the associated routes. Must contain only digits 0-9. |
end_time | integer <int64> Time in unix milliseconds that represents the end time of the requested time interval. See above for a description of how routes are returned. Defaults to now. |
duration | integer <int64> Time in milliseconds that represents the duration before end_time to query. Defaults to 24 hours. |
[- {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
]
Create a new dispatch route for the driver with driver_id.
driver_id required | integer <int64> ID of the driver with the associated routes. Must contain only digits 0-9. |
required | Array of objects (DispatchJobCreate) The dispatch jobs to create for this route. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
List all routes scheduled within a given time period for the given vehicle. Routes are returned if both of the following conditions are met:
scheduled_start_ms
is before the timestamp: end_time
(defaults to now)scheduled_end_ms
is after the timestamp: end_time - duration
(defaults to now - 24 hours)Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
vehicle_id required | integer <int64> ID of the vehicle with the associated routes. Must contain only digits 0-9. |
end_time | integer <int64> Time in unix milliseconds that represents the end time of the requested time interval. See above for a description of how routes are returned. Defaults to now. |
duration | integer <int64> Time in milliseconds that represents the duration before end_time to query. Defaults to 24 hours. |
[- {
- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
]
Create a new dispatch route for the vehicle with vehicle_id.
vehicle_id required | integer <int64> ID of the vehicle with the associated routes. Must contain only digits 0-9. |
required | Array of objects (DispatchJobCreate) The dispatch jobs to create for this route. |
complete_last_stop_on_arrival | boolean Default: true When set to true (default), this causes the Route to complete on arrival at the final stop. When set to false, the last stop will capture arrival and departure separately as with other stops. |
driver_id | integer <int64> ID of the driver assigned to the dispatch route. Note that driver_id and vehicle_id are mutually exclusive. If neither is specified, then the route is unassigned. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
name required | string Descriptive name of this route. |
notes | string Notes regarding the details of this route; maximum of 2000 characters; newline characters ('\n')can be used for formatting. |
scheduled_end_ms | integer <int64> The time in Unix epoch milliseconds that the last job in the route is scheduled to end. |
scheduled_meters | integer <int64> The distance expected to be traveled for this route in meters. |
scheduled_start_ms required | integer <int64> The time in Unix epoch milliseconds that the route is scheduled to start. |
start_location_address | string The address of the route's starting location, as it would be recognized if provided to maps.google.com. Optional if a valid start location address ID is provided. |
start_location_address_id | integer <int64> ID of the start location associated with an address book entry. Optional if valid values are provided for start location address and latitude/longitude. If a valid start location address ID is provided, address/latitude/longitude will be used from the address book entry. Name of the address book entry will only be used if the start location name is not provided. |
start_location_lat | number <double> Latitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_lng | number <double> Longitude of the start location in decimal degrees. Optional if a valid start location address ID is provided. |
start_location_name | string The name of the route's starting location. If provided, it will take precedence over the name of the address book entry. |
trailer_id | integer <int64> ID of the trailer assigned to the dispatch route. Note that trailers can only be assigned to routes that have a Vehicle or Driver assigned to them. |
vehicle_id | integer <int64> ID of the vehicle assigned to the dispatch route. Note that vehicle_id and driver_id are mutually exclusive. If neither is specified, then the route is unassigned. |
{- "dispatch_jobs": [
- {
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
{- "dispatch_jobs": [
- {
- "arrived_at_ms": 1462881998034,
- "completed_at_ms": 1462881998034,
- "dispatch_route_id": 55,
- "documents": [
- {
- "driverId": 1234,
- "id": "2018_42424242"
}
], - "driver_id": 444,
- "en_route_at_ms": 1462881998034,
- "estimated_arrival_ms": 1462881998034,
- "group_id": 101,
- "id": 773,
- "job_state": "JobState_Arrived",
- "skipped_at_ms": 1462881998034,
- "vehicle_id": 112,
- "destination_address": "123 Main St, Philadelphia, PA 19106",
- "destination_address_id": 67890,
- "destination_lat": 123.456,
- "destination_lng": 37.459,
- "destination_name": "ACME Inc. Philadelphia HQ",
- "external_ids": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "notes": "Ensure crates are stacked no more than 3 high.",
- "scheduled_arrival_time_ms": 1462881998034,
- "scheduled_departure_time_ms": 1462881998034
}
], - "id": 556,
- "actual_end_ms": 1462882101000,
- "actual_start_ms": 1462882098000,
- "complete_last_stop_on_arrival": true,
- "driver_id": 555,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "group_id": 101,
- "name": "Bid #123",
- "notes": "Please make sure to confirm crate count at each stop on this route.\nTotal number of crates for route: 23.",
- "odometer_end_meters": 2000000,
- "odometer_start_meters": 1000000,
- "scheduled_end_ms": 1462881998034,
- "scheduled_meters": 10000,
- "scheduled_start_ms": 1462881998034,
- "start_location_address": "123 Main St, Philadelphia, PA 19106",
- "start_location_address_id": 67890,
- "start_location_lat": 123.456,
- "start_location_lng": 37.459,
- "start_location_name": "ACME Inc. Philadelphia HQ",
- "trailer_id": 666,
- "vehicle_id": 444
}
Create a new driver.
Driver creation body
password required | string Driver's password for the driver app. |
tagIds | Array of numbers <int64> (TagIds) [ items <int64 > ] A list of tag IDs. |
eldAdverseWeatherExemptionEnabled | boolean Flag indicating this driver may use Adverse Weather exemptions in ELD logs. |
eldBigDayExemptionEnabled | boolean Flag indicating this driver may use Big Day excemptions in ELD logs. |
eldDayStartHour | integer 0 indicating midnight-to-midnight ELD driving hours, 12 to indicate noon-to-noon driving hours. |
eldExempt | boolean Flag indicating this driver is exempt from the Electronic Logging Mandate. |
eldExemptReason | string Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt). |
eldPcEnabled | boolean Default: false Flag indicating this driver may select the Personal Conveyance duty status in ELD logs. |
eldYmEnabled | boolean Default: false Flag indicating this driver may select the Yard Move duty status in ELD logs. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
groupId | integer <int64> Deprecated. |
licenseNumber | string Driver's state issued license number. |
licenseState | string Abbreviation of state that issued driver's license. |
name required | string Driver's name. |
notes | string Notes about the driver. |
phone | string Driver's phone number. Please include only digits, ex. 4157771234 |
timezone | string Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use IANA timezone database keys (e.g. |
username | string Driver's login username into the driver app. The username may not contain spaces or |
vehicleGroupTagId | integer <int64> ID of the tag which determines which vehicles a driver will see when selecting vehicles |
vehicleId | integer <int64> ID of the vehicle assigned to the driver for static vehicle assignments. (uncommon). |
{- "password": "mypassword",
- "tagIds": [
- 123
], - "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Get all inactive drivers. When drivers leave an organization, you can deactivate them. You can use DELETE /v1/fleet/drivers/{id} to deactivate drivers. Inactive driver records will still be part of reports such as Hours of Service.
[- {
- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
]
Get an inactive driver. When drivers leave an organization, you can deactivate them. You can use DELETE /v1/fleet/drivers/{id} to deactivate drivers. You can use PUT /v1/fleet/drivers/{id} to reactivate drivers. Inactive driver records will still be part of reports such as Hours of Service.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Reactivate a driver.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
Driver reactivation body
reactivate required | boolean True indicates that this driver should be reactivated. |
{- "reactivate": true
}
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Get an active driver. When drivers leave an organization, you can deactivate them. Use GET /v1/fleet/drivers/inactive/{id} to get an inactive driver, and use DELETE /v1/fleet/drivers/{id} to deactivate drivers.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Deactivate a driver. You can use PUT /v1/fleet/drivers/{id} to reactivate a driver.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
"string"
Update a driver. You can update both active and inactive drivers. Active drivers are drivers that are currently part of your fleet. Inactive drivers are drivers that are not currently part of your fleet. Inactive driver historical data will still be available via different reports such as Hours of Service. Use DELETE /v1/fleet/drivers/{id} to deactivate drivers, and PUT /v1/fleet/drivers/{id} to reactivate drivers.
driver_id_or_external_id required | string ID of the driver. This can either be the Samsara-specified ID, or an external ID. External IDs are customer specified key-value pairs created in the POST or PATCH requests of this resource. To specify an external ID as part of a path parameter, use the following format: |
Driver update body
tagIds | Array of numbers <int64> (TagIds) [ items <int64 > ] A list of tag IDs. |
eldAdverseWeatherExemptionEnabled | boolean Flag indicating this driver may use Adverse Weather exemptions in ELD logs. |
eldBigDayExemptionEnabled | boolean Flag indicating this driver may use Big Day excemptions in ELD logs. |
eldDayStartHour | integer 0 indicating midnight-to-midnight ELD driving hours, 12 to indicate noon-to-noon driving hours. |
eldExempt | boolean Flag indicating this driver is exempt from the Electronic Logging Mandate. |
eldExemptReason | string Reason that this driver is exempt from the Electronic Logging Mandate (see eldExempt). |
eldPcEnabled | boolean Default: false Flag indicating this driver may select the Personal Conveyance duty status in ELD logs. |
eldYmEnabled | boolean Default: false Flag indicating this driver may select the Yard Move duty status in ELD logs. |
object (ExternalIDs) User-defined dictionary of external IDs (key-value pairs). Both the keys and the values of the dictionary are of type string and must be alphanumeric. Each organization can have at most 10 unique external ID keys. To delete an external ID, set its value to null or the empty string ( | |
groupId | integer <int64> Deprecated. |
licenseNumber | string Driver's state issued license number. |
licenseState | string Abbreviation of state that issued driver's license. |
name required | string Driver's name. |
notes | string Notes about the driver. |
phone | string Driver's phone number. Please include only digits, ex. 4157771234 |
timezone | string Home terminal timezone, in order to indicate what time zone should be used to calculate the ELD logs. Driver timezones use IANA timezone database keys (e.g. |
username | string Driver's login username into the driver app. The username may not contain spaces or |
vehicleGroupTagId | integer <int64> ID of the tag which determines which vehicles a driver will see when selecting vehicles |
vehicleId | integer <int64> ID of the vehicle assigned to the driver for static vehicle assignments. (uncommon). |
{- "tagIds": [
- 123
], - "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
{- "id": 556,
- "isDeactivated": true,
- "tags": [
- {
- "id": 12345,
- "name": "Broken Vehicles"
}
], - "currentVehicleId": 879,
- "eldAdverseWeatherExemptionEnabled": true,
- "eldBigDayExemptionEnabled": true,
- "eldDayStartHour": 0,
- "eldExempt": true,
- "eldExemptReason": "string",
- "eldPcEnabled": false,
- "eldYmEnabled": false,
- "externalIds": {
- "maintenanceId": "250020",
- "payrollId": "ABFS18600"
}, - "groupId": 101,
- "licenseNumber": "E1234567",
- "licenseState": "CA",
- "name": "Susan Jones",
- "notes": "Also goes by the nickname 'Furious Fred'.",
- "phone": "5558234327",
- "timezone": "America/Los_Angeles",
- "username": "SusanJones",
- "vehicleGroupTagId": 171,
- "vehicleId": 444
}
Get all messages.
endMs | integer <int64> Time in unix milliseconds that represents the end of time range of messages to return. Used in combination with durationMs. Defaults to now. |
durationMs | integer <int64> Time in milliseconds that represents the duration before endMs to query. Defaults to 24 hours. |
{- "data": [
- {
- "driverId": 555,
- "isRead": true,
- "sender": {
- "name": "John Doe",
- "type": "dispatch"
}, - "sentAtMs": 1462881998034,
- "text": "This is a message."
}
]
}
Send a message to a list of driver ids.
Text to send to a list of driverIds.
driverIds required | Array of numbers <int64> [ items <int64 > ] IDs of the drivers for whom the messages are sent to. |
text required | string <= 2500 characters The text sent in the message. |
{- "driverIds": [
- 111,
- 222,
- 333
], - "text": "This is a message."
}
{- "data": [
- {
- "driverId": 555,
- "text": "This is a message."
}
]
}
{- "tags": [
- {
- "addresses": [
- {
- "id": 345,
- "name": "Truck Lot 345"
}
], - "assets": [
- {
- "id": 789,
- "name": "Trailer 789"
}
], - "drivers": [
- {
- "id": 456,
- "name": "John Smith"
}
], - "groupId": 2348,
- "id": 12345,
- "machines": [
- {
- "id": 567,
- "name": "Vibration Monitor 567"
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345,
- "name": "Temperature Sensor 345"
}
], - "vehicles": [
- {
- "id": 123,
- "name": "Heavy Duty 123"
}
]
}
]
}
Create a new tag.
Array of objects (TaggedAssetBase) The assets that belong to this tag. | |
Array of objects (TaggedDriverBase) The drivers that belong to this tag. | |
Array of objects (TaggedMachineBase) The machines that belong to this tag. | |
name required | string Name of this tag. |
parentTagId | integer <int64> If this tag is part a hierarchical tag tree as a child tag, the parentTagId is the ID of this tag's parent tag. |
Array of objects (TaggedSensorBase) The sensors that belong to this tag. | |
Array of objects (TaggedVehicleBase) The vehicles that belong to this tag. |
{- "assets": [
- {
- "id": 789
}
], - "drivers": [
- {
- "id": 456
}
], - "machines": [
- {
- "id": 567
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345
}
], - "vehicles": [
- {
- "id": 123
}
]
}
{- "addresses": [
- {
- "id": 345,
- "name": "Truck Lot 345"
}
], - "assets": [
- {
- "id": 789,
- "name": "Trailer 789"
}
], - "drivers": [
- {
- "id": 456,
- "name": "John Smith"
}
], - "groupId": 2348,
- "id": 12345,
- "machines": [
- {
- "id": 567,
- "name": "Vibration Monitor 567"
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345,
- "name": "Temperature Sensor 345"
}
], - "vehicles": [
- {
- "id": 123,
- "name": "Heavy Duty 123"
}
]
}
Fetch a tag by id.
tag_id required | integer <int64> ID of the tag. Must contain only digits 0-9. |
{- "addresses": [
- {
- "id": 345,
- "name": "Truck Lot 345"
}
], - "assets": [
- {
- "id": 789,
- "name": "Trailer 789"
}
], - "drivers": [
- {
- "id": 456,
- "name": "John Smith"
}
], - "groupId": 2348,
- "id": 12345,
- "machines": [
- {
- "id": 567,
- "name": "Vibration Monitor 567"
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345,
- "name": "Temperature Sensor 345"
}
], - "vehicles": [
- {
- "id": 123,
- "name": "Heavy Duty 123"
}
]
}
Update a tag with a new name and new members. This API call would replace all old members of a tag with new members specified in the request body. To modify only a few devices associated with a tag use the PATCH endpoint.
tag_id required | integer <int64> ID of the tag. Must contain only digits 0-9. |
Array of objects (TaggedAssetBase) The assets that belong to this tag. | |
Array of objects (TaggedDriverBase) The drivers that belong to this tag. | |
Array of objects (TaggedMachineBase) The machines that belong to this tag. | |
name | string Updated name of this tag. |
parentTagId | integer <int64> If this tag is part a hierarchical tag tree as a child tag, the parentTagId is the ID of this tag's parent tag. |
Array of objects (TaggedSensorBase) The sensors that belong to this tag. | |
Array of objects (TaggedVehicleBase) The vehicles that belong to this tag. |
{- "assets": [
- {
- "id": 789
}
], - "drivers": [
- {
- "id": 456
}
], - "machines": [
- {
- "id": 567
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345
}
], - "vehicles": [
- {
- "id": 123
}
]
}
{- "addresses": [
- {
- "id": 345,
- "name": "Truck Lot 345"
}
], - "assets": [
- {
- "id": 789,
- "name": "Trailer 789"
}
], - "drivers": [
- {
- "id": 456,
- "name": "John Smith"
}
], - "groupId": 2348,
- "id": 12345,
- "machines": [
- {
- "id": 567,
- "name": "Vibration Monitor 567"
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345,
- "name": "Temperature Sensor 345"
}
], - "vehicles": [
- {
- "id": 123,
- "name": "Heavy Duty 123"
}
]
}
Add or delete specific members from a tag, or modify the name of a tag.
tag_id required | integer <int64> ID of the tag. Must contain only digits 0-9. |
object Specify devices, etc. that should be added to the tag. | |
object Specify devices, etc. that should be removed from the tag. | |
name | string Updated name of this tag. |
parentTagId | integer <int64> If this tag is part a hierarchical tag tree as a child tag, the parentTagId is the ID of this tag's parent tag. |
{- "add": {
- "assets": [
- {
- "id": 789
}
], - "drivers": [
- {
- "id": 456
}
], - "machines": [
- {
- "id": 567
}
], - "sensors": [
- {
- "id": 345
}
], - "vehicles": [
- {
- "id": 123
}
]
}, - "delete": {
- "assets": [
- {
- "id": 789
}
], - "drivers": [
- {
- "id": 456
}
], - "machines": [
- {
- "id": 567
}
], - "sensors": [
- {
- "id": 345
}
], - "vehicles": [
- {
- "id": 123
}
]
}, - "name": "Broken Vehicles",
- "parentTagId": 8389
}
{- "addresses": [
- {
- "id": 345,
- "name": "Truck Lot 345"
}
], - "assets": [
- {
- "id": 789,
- "name": "Trailer 789"
}
], - "drivers": [
- {
- "id": 456,
- "name": "John Smith"
}
], - "groupId": 2348,
- "id": 12345,
- "machines": [
- {
- "id": 567,
- "name": "Vibration Monitor 567"
}
], - "name": "Broken Vehicles",
- "parentTagId": 8389,
- "sensors": [
- {
- "id": 345,
- "name": "Temperature Sensor 345"
}
], - "vehicles": [
- {
- "id": 123,
- "name": "Heavy Duty 123"
}
]
}